From ef2264e9790ae7e700ad3cf5fb3dbad05efd98d8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:06:46 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- CMakeLists.txt | 4 +- doc/kfilereplace/Makefile.am | 2 - doc/kfilereplace/addstringsdialog_window.png | Bin 24518 -> 0 bytes doc/kfilereplace/backup_option.png | Bin 979 -> 0 bytes doc/kfilereplace/casesensitive_option.png | Bin 1177 -> 0 bytes doc/kfilereplace/command_option.png | Bin 1132 -> 0 bytes doc/kfilereplace/edit.png | Bin 1076 -> 0 bytes doc/kfilereplace/edit_add.png | Bin 820 -> 0 bytes doc/kfilereplace/edit_remove.png | Bin 713 -> 0 bytes doc/kfilereplace/eraser.png | Bin 339 -> 0 bytes doc/kfilereplace/filereplace.png | Bin 1115 -> 0 bytes doc/kfilereplace/filesearch.png | Bin 1163 -> 0 bytes doc/kfilereplace/filesimulate.png | Bin 1113 -> 0 bytes doc/kfilereplace/index.docbook | 613 ------- doc/kfilereplace/invert.png | Bin 1218 -> 0 bytes doc/kfilereplace/kfr_standalone_main_window_1.png | Bin 84930 -> 0 bytes doc/kfilereplace/optionsdialog_main_window_1.png | Bin 44754 -> 0 bytes doc/kfilereplace/optionsdialog_main_window_2.png | Bin 36903 -> 0 bytes doc/kfilereplace/project.png | Bin 808 -> 0 bytes doc/kfilereplace/projectdialog_main_window_1.png | Bin 54660 -> 0 bytes doc/kfilereplace/projectdialog_main_window_2.png | Bin 61588 -> 0 bytes doc/kfilereplace/recursive_option.png | Bin 615 -> 0 bytes doc/kfilereplace/regularexpression_option.png | Bin 959 -> 0 bytes doc/kfilereplace/report_example.png | Bin 61894 -> 0 bytes doc/kfilereplace/results_view.png | Bin 54796 -> 0 bytes doc/kfilereplace/stop.png | Bin 1330 -> 0 bytes doc/kfilereplace/strings_view.png | Bin 9518 -> 0 bytes doc/kfilereplace/toolbar.png | Bin 8217 -> 0 bytes doc/kfilereplace/unsortedList.png | Bin 279 -> 0 bytes doc/quanta/adv-quanta.docbook | 2 +- doc/tdefilereplace/Makefile.am | 2 + doc/tdefilereplace/addstringsdialog_window.png | Bin 0 -> 24518 bytes doc/tdefilereplace/backup_option.png | Bin 0 -> 979 bytes doc/tdefilereplace/casesensitive_option.png | Bin 0 -> 1177 bytes doc/tdefilereplace/command_option.png | Bin 0 -> 1132 bytes doc/tdefilereplace/edit.png | Bin 0 -> 1076 bytes doc/tdefilereplace/edit_add.png | Bin 0 -> 820 bytes doc/tdefilereplace/edit_remove.png | Bin 0 -> 713 bytes doc/tdefilereplace/eraser.png | Bin 0 -> 339 bytes doc/tdefilereplace/filereplace.png | Bin 0 -> 1115 bytes doc/tdefilereplace/filesearch.png | Bin 0 -> 1163 bytes doc/tdefilereplace/filesimulate.png | Bin 0 -> 1113 bytes doc/tdefilereplace/index.docbook | 613 +++++++ doc/tdefilereplace/invert.png | Bin 0 -> 1218 bytes .../kfr_standalone_main_window_1.png | Bin 0 -> 84930 bytes doc/tdefilereplace/optionsdialog_main_window_1.png | Bin 0 -> 44754 bytes doc/tdefilereplace/optionsdialog_main_window_2.png | Bin 0 -> 36903 bytes doc/tdefilereplace/project.png | Bin 0 -> 808 bytes doc/tdefilereplace/projectdialog_main_window_1.png | Bin 0 -> 54660 bytes doc/tdefilereplace/projectdialog_main_window_2.png | Bin 0 -> 61588 bytes doc/tdefilereplace/recursive_option.png | Bin 0 -> 615 bytes doc/tdefilereplace/regularexpression_option.png | Bin 0 -> 959 bytes doc/tdefilereplace/report_example.png | Bin 0 -> 61894 bytes doc/tdefilereplace/results_view.png | Bin 0 -> 54796 bytes doc/tdefilereplace/stop.png | Bin 0 -> 1330 bytes doc/tdefilereplace/strings_view.png | Bin 0 -> 9518 bytes doc/tdefilereplace/toolbar.png | Bin 0 -> 8217 bytes doc/tdefilereplace/unsortedList.png | Bin 0 -> 279 bytes kfilereplace/CMakeLists.txt | 56 - kfilereplace/ChangeLog | 211 --- kfilereplace/Makefile.am | 43 - kfilereplace/commandengine.cpp | 213 --- kfilereplace/commandengine.h | 58 - kfilereplace/configurationclasses.cpp | 188 --- kfilereplace/configurationclasses.h | 165 -- kfilereplace/configure.in.in | 12 - kfilereplace/hi22-app-kfilereplace.png | Bin 999 -> 0 bytes kfilereplace/hi32-app-kfilereplace.png | Bin 1789 -> 0 bytes kfilereplace/hi48-app-kfilereplace.png | Bin 2835 -> 0 bytes kfilereplace/kaddstringdlg.cpp | 273 ---- kfilereplace/kaddstringdlg.h | 76 - kfilereplace/kaddstringdlgs.ui | 426 ----- kfilereplace/kfilereplace.cpp | 111 -- kfilereplace/kfilereplace.desktop | 55 - kfilereplace/kfilereplace.h | 46 - kfilereplace/kfilereplace.tdevelop | 190 --- kfilereplace/kfilereplaceiface.h | 30 - kfilereplace/kfilereplacelib.cpp | 381 ----- kfilereplace/kfilereplacelib.h | 65 - kfilereplace/kfilereplacepart.cpp | 1679 -------------------- kfilereplace/kfilereplacepart.desktop | 95 -- kfilereplace/kfilereplacepart.h | 160 -- kfilereplace/kfilereplacepartui.rc | 75 - kfilereplace/kfilereplaceui.rc | 10 - kfilereplace/kfilereplaceview.cpp | 672 -------- kfilereplace/kfilereplaceview.h | 117 -- kfilereplace/kfilereplaceviewwdg.ui | 555 ------- kfilereplace/knewprojectdlg.cpp | 531 ------- kfilereplace/knewprojectdlg.h | 85 - kfilereplace/knewprojectdlgs.ui | 898 ----------- kfilereplace/koptionsdlg.cpp | 236 --- kfilereplace/koptionsdlg.h | 59 - kfilereplace/koptionsdlgs.ui | 347 ---- kfilereplace/main.cpp | 77 - kfilereplace/report.cpp | 282 ---- kfilereplace/report.h | 58 - kfilereplace/toolbar/CMakeLists.txt | 13 - kfilereplace/toolbar/Makefile.am | 3 - kfilereplace/toolbar/cr22-action-back.png | Bin 1348 -> 0 bytes kfilereplace/toolbar/cr22-action-backup_option.png | Bin 979 -> 0 bytes .../toolbar/cr22-action-casesensitive_option.png | Bin 1177 -> 0 bytes .../toolbar/cr22-action-command_option.png | Bin 1132 -> 0 bytes kfilereplace/toolbar/cr22-action-editadd.png | Bin 1226 -> 0 bytes kfilereplace/toolbar/cr22-action-editremove.png | Bin 1179 -> 0 bytes kfilereplace/toolbar/cr22-action-filereplace.png | Bin 1115 -> 0 bytes kfilereplace/toolbar/cr22-action-filesearch.png | Bin 1163 -> 0 bytes kfilereplace/toolbar/cr22-action-filesimulate.png | Bin 1113 -> 0 bytes kfilereplace/toolbar/cr22-action-informations.png | Bin 1171 -> 0 bytes kfilereplace/toolbar/cr22-action-invert.png | Bin 1218 -> 0 bytes kfilereplace/toolbar/cr22-action-next.png | Bin 1311 -> 0 bytes kfilereplace/toolbar/cr22-action-projectopen.png | Bin 808 -> 0 bytes .../toolbar/cr22-action-recursive_option.png | Bin 615 -> 0 bytes .../cr22-action-regularexpression_option.png | Bin 959 -> 0 bytes kfilereplace/toolbar/cr22-action-unsortedList.png | Bin 279 -> 0 bytes kfilereplace/tutorial.kwd | Bin 392373 -> 0 bytes kfilereplace/whatthis.h | 101 -- kimagemapeditor/kimagemapeditor.cpp | 4 +- kimagemapeditor/kimedialogs.cpp | 2 +- kimagemapeditor/kimeshell.cpp | 2 +- kimagemapeditor/qextfileinfo.cpp | 8 +- kimagemapeditor/qextfileinfo.h | 6 +- klinkstatus/klinkstatus.tdevelop | 4 +- klinkstatus/src/cfg/klsconfig.kcfgc | 2 +- klinkstatus/src/engine/linkchecker.cpp | 10 +- klinkstatus/src/engine/linkchecker.h | 2 +- klinkstatus/src/klinkstatus.cpp | 4 +- klinkstatus/src/klinkstatus_part.cpp | 4 +- klinkstatus/src/ui/klshistorycombo.cpp | 2 +- klinkstatus/src/ui/sessionwidget.cpp | 6 +- kommander/editor/assoctexteditorimpl.cpp | 2 +- kommander/editor/filechooser.cpp | 2 +- kommander/editor/formfile.cpp | 2 +- kommander/editor/kommander.xml | 2 +- kommander/editor/main.cpp | 2 +- kommander/editor/mainwindow.cpp | 4 +- kommander/editor/mainwindowactions.cpp | 2 +- kommander/editor/messagelog.cpp | 2 +- kommander/factory/kommanderfactory.cpp | 2 +- kommander/pluginmanager/mainwindow.cpp | 4 +- kommander/pluginmanager/pluginmanager.cpp | 2 +- kommander/widget/functionlib.cpp | 2 +- kommander/widget/kommanderfunctions.cpp | 2 +- kommander/widgets/fileselector.cpp | 2 +- kxsldbg/kxsldbg.cpp | 2 +- kxsldbg/kxsldbgpart/kxsldbg_part.cpp | 2 +- kxsldbg/kxsldbgpart/qxsldbgdoc.h | 2 +- kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp | 2 +- lib/compatibility/knewstuff/downloaddialog.cpp | 6 +- lib/compatibility/knewstuff/engine.cpp | 2 +- lib/compatibility/knewstuff/knewstuffgeneric.cpp | 2 +- lib/compatibility/knewstuff/knewstuffsecure.cpp | 4 +- lib/compatibility/knewstuff/provider.cpp | 4 +- lib/compatibility/knewstuff/uploaddialog.cpp | 2 +- lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp | 2 +- lib/compatibility/tdemdi/qextmdi/ktabwidget.cpp | 2 +- .../tdemdi/qextmdi/tdemdichildarea.cpp | 2 +- .../tdemdi/qextmdi/tdemdidockcontainer.cpp | 2 +- .../tdemdi/qextmdi/tdemdiguiclient.cpp | 2 +- lib/qextfileinfo.cpp | 8 +- lib/qextfileinfo.h | 6 +- quanta/components/csseditor/colorrequester.cpp | 2 +- quanta/components/csseditor/csseditor.cpp | 2 +- quanta/components/csseditor/cssselector.cpp | 2 +- quanta/components/csseditor/tlpeditors.cpp | 2 +- quanta/components/debugger/dbgp/CMakeLists.txt | 2 +- quanta/components/framewizard/fmfpeditor.cpp | 2 +- quanta/data/config/plugins.rc | 4 +- quanta/data/config/quanta_preview_config.desktop | 2 +- quanta/data/doc/templates.html | 2 +- quanta/dialogs/actionconfigdialog.cpp | 2 +- quanta/dialogs/copyto.cpp | 4 +- quanta/dialogs/copyto.h | 2 +- quanta/dialogs/dirtydlg.cpp | 8 +- quanta/dialogs/dirtydlg.h | 2 +- quanta/dialogs/dtepeditdlg.cpp | 4 +- quanta/dialogs/filecombo.cpp | 2 +- quanta/dialogs/settings/parseroptions.cpp | 2 +- quanta/dialogs/tagdialogs/colorcombo.cpp | 2 +- quanta/dialogs/tagdialogs/tagdialog.cpp | 2 +- quanta/dialogs/tagdialogs/tagimgdlg.cpp | 4 +- quanta/messages/annotationoutput.cpp | 2 +- quanta/messages/messageoutput.cpp | 2 +- quanta/parsers/dtd/dtd.cpp | 2 +- quanta/parsers/dtd/dtdparser.cpp | 4 +- quanta/parts/kafka/htmlenhancer.cpp | 2 +- quanta/parts/kafka/kafkasyncoptions.cpp | 2 +- quanta/parts/kafka/undoredo.cpp | 2 +- quanta/parts/preview/whtmlpart.cpp | 2 +- quanta/plugins/quantapluginconfig.cpp | 2 +- quanta/plugins/quantaplugineditor.cpp | 2 +- quanta/plugins/quantaplugininterface.cpp | 2 +- quanta/plugins/quantaplugininterface.h | 2 +- quanta/project/project.cpp | 2 +- quanta/project/projectnewgeneral.cpp | 2 +- quanta/project/projectnewlocal.cpp | 2 +- quanta/project/projectnewweb.cpp | 2 +- quanta/project/projectoptions.ui.h | 2 +- quanta/project/projectprivate.cpp | 6 +- quanta/project/projectupload.cpp | 4 +- quanta/project/projectupload.h | 2 +- quanta/project/rescanprj.cpp | 2 +- quanta/project/rescanprj.h | 2 +- quanta/quanta.tdevelop | 2 +- quanta/src/document.cpp | 2 +- quanta/src/dtds.cpp | 4 +- quanta/src/kqapp.cpp | 2 +- quanta/src/quanta.cpp | 8 +- quanta/src/quanta_init.cpp | 10 +- quanta/src/quantadoc.cpp | 2 +- quanta/src/viewmanager.cpp | 2 +- quanta/treeviews/basetreeview.cpp | 2 +- quanta/treeviews/basetreeview.h | 6 +- quanta/treeviews/docfolder.cpp | 2 +- quanta/treeviews/docitem.cpp | 2 +- quanta/treeviews/doctreeview.cpp | 2 +- quanta/treeviews/filestreeview.cpp | 2 +- quanta/treeviews/servertreeview.cpp | 2 +- quanta/treeviews/structtreeview.cpp | 2 +- quanta/treeviews/templatestreeview.cpp | 4 +- quanta/treeviews/uploadtreefile.cpp | 2 +- quanta/treeviews/uploadtreeview.cpp | 2 +- quanta/utility/quantabookmarks.cpp | 2 +- quanta/utility/quantacommon.cpp | 2 +- quanta/utility/quantanetaccess.cpp | 4 +- quanta/utility/tagactionset.cpp | 2 +- tdefilereplace/CMakeLists.txt | 56 + tdefilereplace/ChangeLog | 211 +++ tdefilereplace/Makefile.am | 43 + tdefilereplace/commandengine.cpp | 213 +++ tdefilereplace/commandengine.h | 58 + tdefilereplace/configurationclasses.cpp | 188 +++ tdefilereplace/configurationclasses.h | 165 ++ tdefilereplace/configure.in.in | 12 + tdefilereplace/hi22-app-tdefilereplace.png | Bin 0 -> 999 bytes tdefilereplace/hi32-app-tdefilereplace.png | Bin 0 -> 1789 bytes tdefilereplace/hi48-app-tdefilereplace.png | Bin 0 -> 2835 bytes tdefilereplace/kaddstringdlg.cpp | 273 ++++ tdefilereplace/kaddstringdlg.h | 76 + tdefilereplace/kaddstringdlgs.ui | 426 +++++ tdefilereplace/knewprojectdlg.cpp | 531 +++++++ tdefilereplace/knewprojectdlg.h | 85 + tdefilereplace/knewprojectdlgs.ui | 898 +++++++++++ tdefilereplace/koptionsdlg.cpp | 236 +++ tdefilereplace/koptionsdlg.h | 59 + tdefilereplace/koptionsdlgs.ui | 347 ++++ tdefilereplace/main.cpp | 77 + tdefilereplace/report.cpp | 282 ++++ tdefilereplace/report.h | 58 + tdefilereplace/tdefilereplace.cpp | 111 ++ tdefilereplace/tdefilereplace.desktop | 55 + tdefilereplace/tdefilereplace.h | 46 + tdefilereplace/tdefilereplace.tdevelop | 190 +++ tdefilereplace/tdefilereplaceiface.h | 30 + tdefilereplace/tdefilereplacelib.cpp | 381 +++++ tdefilereplace/tdefilereplacelib.h | 65 + tdefilereplace/tdefilereplacepart.cpp | 1679 ++++++++++++++++++++ tdefilereplace/tdefilereplacepart.desktop | 95 ++ tdefilereplace/tdefilereplacepart.h | 160 ++ tdefilereplace/tdefilereplacepartui.rc | 75 + tdefilereplace/tdefilereplaceui.rc | 10 + tdefilereplace/tdefilereplaceview.cpp | 672 ++++++++ tdefilereplace/tdefilereplaceview.h | 117 ++ tdefilereplace/tdefilereplaceviewwdg.ui | 555 +++++++ tdefilereplace/toolbar/CMakeLists.txt | 13 + tdefilereplace/toolbar/Makefile.am | 3 + tdefilereplace/toolbar/cr22-action-back.png | Bin 0 -> 1348 bytes .../toolbar/cr22-action-backup_option.png | Bin 0 -> 979 bytes .../toolbar/cr22-action-casesensitive_option.png | Bin 0 -> 1177 bytes .../toolbar/cr22-action-command_option.png | Bin 0 -> 1132 bytes tdefilereplace/toolbar/cr22-action-editadd.png | Bin 0 -> 1226 bytes tdefilereplace/toolbar/cr22-action-editremove.png | Bin 0 -> 1179 bytes tdefilereplace/toolbar/cr22-action-filereplace.png | Bin 0 -> 1115 bytes tdefilereplace/toolbar/cr22-action-filesearch.png | Bin 0 -> 1163 bytes .../toolbar/cr22-action-filesimulate.png | Bin 0 -> 1113 bytes .../toolbar/cr22-action-informations.png | Bin 0 -> 1171 bytes tdefilereplace/toolbar/cr22-action-invert.png | Bin 0 -> 1218 bytes tdefilereplace/toolbar/cr22-action-next.png | Bin 0 -> 1311 bytes tdefilereplace/toolbar/cr22-action-projectopen.png | Bin 0 -> 808 bytes .../toolbar/cr22-action-recursive_option.png | Bin 0 -> 615 bytes .../cr22-action-regularexpression_option.png | Bin 0 -> 959 bytes .../toolbar/cr22-action-unsortedList.png | Bin 0 -> 279 bytes tdefilereplace/tutorial.kwd | Bin 0 -> 392373 bytes tdefilereplace/whatthis.h | 101 ++ 283 files changed, 9428 insertions(+), 9428 deletions(-) delete mode 100644 doc/kfilereplace/Makefile.am delete mode 100644 doc/kfilereplace/addstringsdialog_window.png delete mode 100644 doc/kfilereplace/backup_option.png delete mode 100644 doc/kfilereplace/casesensitive_option.png delete mode 100644 doc/kfilereplace/command_option.png delete mode 100644 doc/kfilereplace/edit.png delete mode 100644 doc/kfilereplace/edit_add.png delete mode 100644 doc/kfilereplace/edit_remove.png delete mode 100644 doc/kfilereplace/eraser.png delete mode 100644 doc/kfilereplace/filereplace.png delete mode 100644 doc/kfilereplace/filesearch.png delete mode 100644 doc/kfilereplace/filesimulate.png delete mode 100644 doc/kfilereplace/index.docbook delete mode 100644 doc/kfilereplace/invert.png delete mode 100644 doc/kfilereplace/kfr_standalone_main_window_1.png delete mode 100644 doc/kfilereplace/optionsdialog_main_window_1.png delete mode 100644 doc/kfilereplace/optionsdialog_main_window_2.png delete mode 100644 doc/kfilereplace/project.png delete mode 100644 doc/kfilereplace/projectdialog_main_window_1.png delete mode 100644 doc/kfilereplace/projectdialog_main_window_2.png delete mode 100644 doc/kfilereplace/recursive_option.png delete mode 100644 doc/kfilereplace/regularexpression_option.png delete mode 100644 doc/kfilereplace/report_example.png delete mode 100644 doc/kfilereplace/results_view.png delete mode 100644 doc/kfilereplace/stop.png delete mode 100644 doc/kfilereplace/strings_view.png delete mode 100644 doc/kfilereplace/toolbar.png delete mode 100644 doc/kfilereplace/unsortedList.png create mode 100644 doc/tdefilereplace/Makefile.am create mode 100644 doc/tdefilereplace/addstringsdialog_window.png create mode 100644 doc/tdefilereplace/backup_option.png create mode 100644 doc/tdefilereplace/casesensitive_option.png create mode 100644 doc/tdefilereplace/command_option.png create mode 100644 doc/tdefilereplace/edit.png create mode 100644 doc/tdefilereplace/edit_add.png create mode 100644 doc/tdefilereplace/edit_remove.png create mode 100644 doc/tdefilereplace/eraser.png create mode 100644 doc/tdefilereplace/filereplace.png create mode 100644 doc/tdefilereplace/filesearch.png create mode 100644 doc/tdefilereplace/filesimulate.png create mode 100644 doc/tdefilereplace/index.docbook create mode 100644 doc/tdefilereplace/invert.png create mode 100644 doc/tdefilereplace/kfr_standalone_main_window_1.png create mode 100644 doc/tdefilereplace/optionsdialog_main_window_1.png create mode 100644 doc/tdefilereplace/optionsdialog_main_window_2.png create mode 100644 doc/tdefilereplace/project.png create mode 100644 doc/tdefilereplace/projectdialog_main_window_1.png create mode 100644 doc/tdefilereplace/projectdialog_main_window_2.png create mode 100644 doc/tdefilereplace/recursive_option.png create mode 100644 doc/tdefilereplace/regularexpression_option.png create mode 100644 doc/tdefilereplace/report_example.png create mode 100644 doc/tdefilereplace/results_view.png create mode 100644 doc/tdefilereplace/stop.png create mode 100644 doc/tdefilereplace/strings_view.png create mode 100644 doc/tdefilereplace/toolbar.png create mode 100644 doc/tdefilereplace/unsortedList.png delete mode 100644 kfilereplace/CMakeLists.txt delete mode 100644 kfilereplace/ChangeLog delete mode 100644 kfilereplace/Makefile.am delete mode 100644 kfilereplace/commandengine.cpp delete mode 100644 kfilereplace/commandengine.h delete mode 100644 kfilereplace/configurationclasses.cpp delete mode 100644 kfilereplace/configurationclasses.h delete mode 100644 kfilereplace/configure.in.in delete mode 100644 kfilereplace/hi22-app-kfilereplace.png delete mode 100644 kfilereplace/hi32-app-kfilereplace.png delete mode 100644 kfilereplace/hi48-app-kfilereplace.png delete mode 100644 kfilereplace/kaddstringdlg.cpp delete mode 100644 kfilereplace/kaddstringdlg.h delete mode 100644 kfilereplace/kaddstringdlgs.ui delete mode 100644 kfilereplace/kfilereplace.cpp delete mode 100644 kfilereplace/kfilereplace.desktop delete mode 100644 kfilereplace/kfilereplace.h delete mode 100644 kfilereplace/kfilereplace.tdevelop delete mode 100644 kfilereplace/kfilereplaceiface.h delete mode 100644 kfilereplace/kfilereplacelib.cpp delete mode 100644 kfilereplace/kfilereplacelib.h delete mode 100644 kfilereplace/kfilereplacepart.cpp delete mode 100644 kfilereplace/kfilereplacepart.desktop delete mode 100644 kfilereplace/kfilereplacepart.h delete mode 100644 kfilereplace/kfilereplacepartui.rc delete mode 100644 kfilereplace/kfilereplaceui.rc delete mode 100644 kfilereplace/kfilereplaceview.cpp delete mode 100644 kfilereplace/kfilereplaceview.h delete mode 100644 kfilereplace/kfilereplaceviewwdg.ui delete mode 100644 kfilereplace/knewprojectdlg.cpp delete mode 100644 kfilereplace/knewprojectdlg.h delete mode 100644 kfilereplace/knewprojectdlgs.ui delete mode 100644 kfilereplace/koptionsdlg.cpp delete mode 100644 kfilereplace/koptionsdlg.h delete mode 100644 kfilereplace/koptionsdlgs.ui delete mode 100644 kfilereplace/main.cpp delete mode 100644 kfilereplace/report.cpp delete mode 100644 kfilereplace/report.h delete mode 100644 kfilereplace/toolbar/CMakeLists.txt delete mode 100644 kfilereplace/toolbar/Makefile.am delete mode 100644 kfilereplace/toolbar/cr22-action-back.png delete mode 100644 kfilereplace/toolbar/cr22-action-backup_option.png delete mode 100644 kfilereplace/toolbar/cr22-action-casesensitive_option.png delete mode 100644 kfilereplace/toolbar/cr22-action-command_option.png delete mode 100644 kfilereplace/toolbar/cr22-action-editadd.png delete mode 100644 kfilereplace/toolbar/cr22-action-editremove.png delete mode 100644 kfilereplace/toolbar/cr22-action-filereplace.png delete mode 100644 kfilereplace/toolbar/cr22-action-filesearch.png delete mode 100644 kfilereplace/toolbar/cr22-action-filesimulate.png delete mode 100644 kfilereplace/toolbar/cr22-action-informations.png delete mode 100644 kfilereplace/toolbar/cr22-action-invert.png delete mode 100644 kfilereplace/toolbar/cr22-action-next.png delete mode 100644 kfilereplace/toolbar/cr22-action-projectopen.png delete mode 100644 kfilereplace/toolbar/cr22-action-recursive_option.png delete mode 100644 kfilereplace/toolbar/cr22-action-regularexpression_option.png delete mode 100644 kfilereplace/toolbar/cr22-action-unsortedList.png delete mode 100644 kfilereplace/tutorial.kwd delete mode 100644 kfilereplace/whatthis.h create mode 100644 tdefilereplace/CMakeLists.txt create mode 100644 tdefilereplace/ChangeLog create mode 100644 tdefilereplace/Makefile.am create mode 100644 tdefilereplace/commandengine.cpp create mode 100644 tdefilereplace/commandengine.h create mode 100644 tdefilereplace/configurationclasses.cpp create mode 100644 tdefilereplace/configurationclasses.h create mode 100644 tdefilereplace/configure.in.in create mode 100644 tdefilereplace/hi22-app-tdefilereplace.png create mode 100644 tdefilereplace/hi32-app-tdefilereplace.png create mode 100644 tdefilereplace/hi48-app-tdefilereplace.png create mode 100644 tdefilereplace/kaddstringdlg.cpp create mode 100644 tdefilereplace/kaddstringdlg.h create mode 100644 tdefilereplace/kaddstringdlgs.ui create mode 100644 tdefilereplace/knewprojectdlg.cpp create mode 100644 tdefilereplace/knewprojectdlg.h create mode 100644 tdefilereplace/knewprojectdlgs.ui create mode 100644 tdefilereplace/koptionsdlg.cpp create mode 100644 tdefilereplace/koptionsdlg.h create mode 100644 tdefilereplace/koptionsdlgs.ui create mode 100644 tdefilereplace/main.cpp create mode 100644 tdefilereplace/report.cpp create mode 100644 tdefilereplace/report.h create mode 100644 tdefilereplace/tdefilereplace.cpp create mode 100644 tdefilereplace/tdefilereplace.desktop create mode 100644 tdefilereplace/tdefilereplace.h create mode 100644 tdefilereplace/tdefilereplace.tdevelop create mode 100644 tdefilereplace/tdefilereplaceiface.h create mode 100644 tdefilereplace/tdefilereplacelib.cpp create mode 100644 tdefilereplace/tdefilereplacelib.h create mode 100644 tdefilereplace/tdefilereplacepart.cpp create mode 100644 tdefilereplace/tdefilereplacepart.desktop create mode 100644 tdefilereplace/tdefilereplacepart.h create mode 100644 tdefilereplace/tdefilereplacepartui.rc create mode 100644 tdefilereplace/tdefilereplaceui.rc create mode 100644 tdefilereplace/tdefilereplaceview.cpp create mode 100644 tdefilereplace/tdefilereplaceview.h create mode 100644 tdefilereplace/tdefilereplaceviewwdg.ui create mode 100644 tdefilereplace/toolbar/CMakeLists.txt create mode 100644 tdefilereplace/toolbar/Makefile.am create mode 100644 tdefilereplace/toolbar/cr22-action-back.png create mode 100644 tdefilereplace/toolbar/cr22-action-backup_option.png create mode 100644 tdefilereplace/toolbar/cr22-action-casesensitive_option.png create mode 100644 tdefilereplace/toolbar/cr22-action-command_option.png create mode 100644 tdefilereplace/toolbar/cr22-action-editadd.png create mode 100644 tdefilereplace/toolbar/cr22-action-editremove.png create mode 100644 tdefilereplace/toolbar/cr22-action-filereplace.png create mode 100644 tdefilereplace/toolbar/cr22-action-filesearch.png create mode 100644 tdefilereplace/toolbar/cr22-action-filesimulate.png create mode 100644 tdefilereplace/toolbar/cr22-action-informations.png create mode 100644 tdefilereplace/toolbar/cr22-action-invert.png create mode 100644 tdefilereplace/toolbar/cr22-action-next.png create mode 100644 tdefilereplace/toolbar/cr22-action-projectopen.png create mode 100644 tdefilereplace/toolbar/cr22-action-recursive_option.png create mode 100644 tdefilereplace/toolbar/cr22-action-regularexpression_option.png create mode 100644 tdefilereplace/toolbar/cr22-action-unsortedList.png create mode 100644 tdefilereplace/tutorial.kwd create mode 100644 tdefilereplace/whatthis.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f41314b..88808fd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ tde_setup_paths( ) ##### user requested modules #################### option( BUILD_ALL "Build all" OFF ) -option( BUILD_KFILEREPLACE "Build kfilereplace" ${BUILD_ALL} ) +option( BUILD_KFILEREPLACE "Build tdefilereplace" ${BUILD_ALL} ) option( BUILD_QUANTA "Build quanta" ${BUILD_ALL} ) @@ -78,7 +78,7 @@ if( BUILD_QUANTA ) add_subdirectory( lib ) endif( ) -tde_conditional_add_subdirectory( BUILD_KFILEREPLACE kfilereplace ) +tde_conditional_add_subdirectory( BUILD_KFILEREPLACE tdefilereplace ) tde_conditional_add_subdirectory( BUILD_QUANTA quanta ) diff --git a/doc/kfilereplace/Makefile.am b/doc/kfilereplace/Makefile.am deleted file mode 100644 index e97402c7..00000000 --- a/doc/kfilereplace/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -KDE_DOCS = AUTO -KDE_LANG = en diff --git a/doc/kfilereplace/addstringsdialog_window.png b/doc/kfilereplace/addstringsdialog_window.png deleted file mode 100644 index 7d6aeee7..00000000 Binary files a/doc/kfilereplace/addstringsdialog_window.png and /dev/null differ diff --git a/doc/kfilereplace/backup_option.png b/doc/kfilereplace/backup_option.png deleted file mode 100644 index a0e1e02f..00000000 Binary files a/doc/kfilereplace/backup_option.png and /dev/null differ diff --git a/doc/kfilereplace/casesensitive_option.png b/doc/kfilereplace/casesensitive_option.png deleted file mode 100644 index 6302c0f2..00000000 Binary files a/doc/kfilereplace/casesensitive_option.png and /dev/null differ diff --git a/doc/kfilereplace/command_option.png b/doc/kfilereplace/command_option.png deleted file mode 100644 index 1da3688b..00000000 Binary files a/doc/kfilereplace/command_option.png and /dev/null differ diff --git a/doc/kfilereplace/edit.png b/doc/kfilereplace/edit.png deleted file mode 100644 index ce8b2267..00000000 Binary files a/doc/kfilereplace/edit.png and /dev/null differ diff --git a/doc/kfilereplace/edit_add.png b/doc/kfilereplace/edit_add.png deleted file mode 100644 index c46aed2b..00000000 Binary files a/doc/kfilereplace/edit_add.png and /dev/null differ diff --git a/doc/kfilereplace/edit_remove.png b/doc/kfilereplace/edit_remove.png deleted file mode 100644 index 1a2f87c5..00000000 Binary files a/doc/kfilereplace/edit_remove.png and /dev/null differ diff --git a/doc/kfilereplace/eraser.png b/doc/kfilereplace/eraser.png deleted file mode 100644 index 33775463..00000000 Binary files a/doc/kfilereplace/eraser.png and /dev/null differ diff --git a/doc/kfilereplace/filereplace.png b/doc/kfilereplace/filereplace.png deleted file mode 100644 index c3692e11..00000000 Binary files a/doc/kfilereplace/filereplace.png and /dev/null differ diff --git a/doc/kfilereplace/filesearch.png b/doc/kfilereplace/filesearch.png deleted file mode 100644 index 1be59c49..00000000 Binary files a/doc/kfilereplace/filesearch.png and /dev/null differ diff --git a/doc/kfilereplace/filesimulate.png b/doc/kfilereplace/filesimulate.png deleted file mode 100644 index 7cc5b284..00000000 Binary files a/doc/kfilereplace/filesimulate.png and /dev/null differ diff --git a/doc/kfilereplace/index.docbook b/doc/kfilereplace/index.docbook deleted file mode 100644 index 9f769f32..00000000 --- a/doc/kfilereplace/index.docbook +++ /dev/null @@ -1,613 +0,0 @@ - -KFileReplace"> - - - - - tdewebdev"> - bc"> -]> - - - - -The &kfilereplace; Handbook - - - -Emiliano -Gulmini - -
emi_barbarossa@yahoo.it
-
-
- - - -
- - -2004 -Emiliano Gulmini - - -&FDLNotice; - -2004-08-09 -1.0.0 - - - - - -&kfilereplace; is an utility to search and replace strings. - - - - -KDE -KFileReplace -replace -search -string - - -
- - - Introduction - &kfilereplace; 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. - - - - -Using &kfilereplace; - - - - &kfilereplace; in its standalone incarnation - - - - - - &kfilereplace; in its standalone incarnation - - - - - - - -The Toolbar - -The &kfilereplace; toolbar should looks like this: - - &kfilereplace;'s toolbar - - - - - - - - - &kfilereplace;'s toolbar - - - - - -The toolbar shows you the buttons of the main functionalities. - - Toolbar Icons - - - - - - - - New session - - This button shows a session dialog in which you can set several basic options; if &kfilereplace; run as standalone application you should click this button as first step. - - - - - - - - - - Search only - - This button starts a search loop. - - - - - - - - - - Replace - - This button starts a search&replace loop. When a string has been found, &kfilereplace; replaces it with another string. - - - - - - - - - - Simulated Replace - - This button starts a simulated search&replace loop. Nothing really happens when you click this button. - - - - - - - - - - Stop - - This button stops an operation. - - - - - - - - - - Add Strings - - This button opens the Add Strings dialog in which you can edit your string list. - - - - - - - - - - Delete Strings - - This button deletes the selected (or the current if there is no selection) string from the list. - - - - - - - - - - Edit Strings - - This button edits a selected string. - - - - - - - - - - Delete List - - This button deletes all the strings in the list. - - - - - - - - - - Invert Strings - - This button swaps the search string with the replace string, so you can revert a search/replace operation. - - - - - - - - - - Load String List - - This button loads a string list saved in a xml file with a kfr extension. - - - - - - - - - - Search in Subfolders - - This button allows you to search/replace recursively in the subfolders of your base directory. - - - - - - - - - - Make Backup Files - - This button enables generation of backup files. - - - - - - - - - - Case-sensitive Search - - This button enables case-sensitive searching. - - - - - - - - - - Commands - - This button enables commands capability. Commands are special strings. See . - - - - - - - - - - Regular expressions - - This button enables Qt-like regular expressions. - - - - - - - - - - The Results List - - &kfilereplace;'s Results view - - - - - - - - - &kfilereplace;'s Results view - - - - The Results 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. - - - - - The String List - - This is the Strings view: - - &kfilereplace;'s Strings view - - - - - - &kfilereplace;'s Strings view - - - - - - The Strings view visualizes the list of strings you want search/replace. Please note that in search mode the Results view and the Strings view have a different layout. - - - - - The <guilabel>New Session</guilabel> Dialog - The New Session dialog is used to setup the basic parameters needed by &kfilereplace; to work. It consists of two tabs, General and Advanced. - - - - The <guilabel>General</guilabel> Tab - - &kfilereplace; General tab - - - - - - &kfilereplace; General tab - - - - When you want to begin a new session the first step is to click on the New Session button. Then you must enter the base path and a sequence of shell-like wildcards to use as filter. - Then you could set some useful options, like searching in all the subfolders, doing a case-sensitive search, enabling commands and/or regular expressionsPlease note that regular expressions and commands could slow down the speed performances., doing a backup copy of each file before replacing. - If you want to start searching, you can put a string in the search box and press Search Now, otherwise leave the search box empty and press Search Later. - - - - The <guilabel>Advanced</guilabel> Tab - - &kfilereplace; Advanced tab - - - - - - &kfilereplace; Advanced tab - - - - The Advanced 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 &kfilereplace; 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). - - - - - The <guilabel>Options</guilabel> Dialog - 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 SettingsConfigure KFileReplace... in the main menu. - - - General options - These options have been presented in the Toolbar section. - - The General tab of the Options window - - - - - - The General tab of the Options window - - - - - - - Advanced options - - - The Advanced tab of the Options window - - - - - - The Advanced tab of the Options window - - - - - Do not show files if no strings are found or replaced - When searching, stop on first string found - Follow symbolic links - Ignore hidden files and directories - - shows only the files that match some of your strings. This will speed up the search. - &kfilereplace; 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. - if a file is a link to another one, then search in the real file. - if hidden files or folders are encountered, ignore them. - - - - - - - The <guilabel>Add Strings</guilabel> Dialog - - &kfilereplace;'s Add Strings dialog - - - - - - &kfilereplace;'s Add Strings dialog - - - - 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 OK. - - - - - &kfilereplace; features - This chapter provides informations about some useful capabilities of &kfilereplace;. - - How to save your string list - When you want to reuse a list of strings you can save it in a xml file. To do this select from the menubar Search/ReplaceStringsSave Strings List to File. When you save a list, a simple xml file with extension kfr is created. To load a kfr file select from menubar Search/ReplaceStringsLoad Strings List from File. The actual file looks like this: - -<?xml version="1.0" ?> -<kfr> - <mode search="false"/> - <replacement> - <oldstring><![CDATA[SEARCH_STRING_1]] ></oldstring> - <newstring><![CDATA[REPLACE_STRING_1]]></newstring> - </replacement> - <replacement> - <oldstring><![CDATA[SEARCH_STRING_2]]></oldstring> - <newstring><![CDATA[REPLACE_STRING_2]]></newstring> - </replacement> - - - <replacement> - <oldstring><![CDATA[SEARCH_STRING_N]]></oldstring> - <newstring><![CDATA[REPLACE_STRING_N]]></newstring> - </replacement> - -</kfr> - - 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 &kfilereplace; in the way explained before. - - - - How to Create a Simple Report - You can create a report by choosing Search/ReplaceResultsCreate Report File from the main menu. A report is a folder containing an xml and a css file. Reports may be useful to maintain a simple log of your operations. - - &kfilereplace;'s Report feature - - - - - - - - - &kfilereplace;'s Report feature - - - - - - - - How to use Regular Expressions - - If you want search for every string that starts with x, ht or u and ends with ml, you can write a regular expression like this: (x|ht|u)ml. Insert this expression in the search editor, click OK, and enable regular expressions by toggling the Regular Expression button. 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 if you want to solve a problem with a regular expression, you have two problems. - - - - How to Protect Original Files - 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 Backup button. If you want to customize the extension of the backup files open the Options dialog. - - - - - How to Open a File - 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 &kfilereplace; embedded in &quantaplus;, you can open the file directly in it at the specified line and column. - - - - Commands - Suppose you want replace the phrase Alice's adventures in Wonderland with the entire file that contains Carroll's novel. Probably you don't want to do this by hand, what you need is a command that will do it for you. Click the Add button, select Search and Replace Mode and insert the following strings: Alice's adventure in Wonderland in the search mini-editor and the string [$loadfile:/the-path-to-my-folder/my-folder/my-file$] in the replacement mini-editor. Click OK. When you come back to the &kfilereplace; main window, toggle the Command action button that enables the commands, and start the replacement process. There are also other commands, see for a list of all of them. - - - - -Credits and License - -&kfilereplace;. Program copyright 1999 by François Dupoux dupoux@dupoux.com, 2003 Andras Mantia amantia@kde.org, 2004 Emiliano Gulmini emi_barbarossa@yahoo.it - - - - The &kfilereplace; authors and maintainers: - - François Dupoux dupoux@dupoux.com - Original author - - - Andras Mantia amantia@kde.org - Shell autor, KPart creator, co-maintainer - - - Emiliano Gulmini emi_barbarossa@yahoo.it - Current maintainer, code cleaner & rewriter - - - - -Documentation Copyright © 2004 Emiliano Gulmini emi_barbarossa@yahoo.it - - - - -&underFDL; -&underGPL; - - - - -Installation - - -How to install &kfilereplace; - -&kfilereplace; 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 &kfilereplace; 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 &tdewebdev; home site for more information. - - - - - - - Requirements - In order to use the command [$mathexp:some_math_expression$] you should install the &bc; mathematical utility (version 1.06 or newer) written by Philip A. Nelson (philnelson@acm.org). - - - - - - &kfilereplace; commands - - - [$datetime:iso$] - [$datetime:local$] - [$user:uid$] - [$user:gid$] - [$user:loginname$] - [$user:fullname$] - [$user:homedir$] - [$user:shell$] - [$loadfile:/my-path/my-directory/my-file$] - [$empty:$] - [$random:AN_INTEGER_NUMBER$] - [$random:$] - [$mathexp:bc-expression$] - - this command return the current date and time in Qt ISO format. - like above but in local format. - return the UID of the current user. - return the GID of the current user. - return the login name of the current user. - return the full name of the current user. - return the home directory of the current user. - return the shell of the current user. - return the content of the my-file file. - return the empty string. - return a random number string using AN_INTEGER_NUMBER as the initial seed. - like above, but without initial seed. - return the result of a &bc; v1.06 mathematical expression. - - - - - -&documentation.index; -
- diff --git a/doc/kfilereplace/invert.png b/doc/kfilereplace/invert.png deleted file mode 100644 index f3ab8be6..00000000 Binary files a/doc/kfilereplace/invert.png and /dev/null differ diff --git a/doc/kfilereplace/kfr_standalone_main_window_1.png b/doc/kfilereplace/kfr_standalone_main_window_1.png deleted file mode 100644 index 3e4f85db..00000000 Binary files a/doc/kfilereplace/kfr_standalone_main_window_1.png and /dev/null differ diff --git a/doc/kfilereplace/optionsdialog_main_window_1.png b/doc/kfilereplace/optionsdialog_main_window_1.png deleted file mode 100644 index 959c3977..00000000 Binary files a/doc/kfilereplace/optionsdialog_main_window_1.png and /dev/null differ diff --git a/doc/kfilereplace/optionsdialog_main_window_2.png b/doc/kfilereplace/optionsdialog_main_window_2.png deleted file mode 100644 index 3213b6ff..00000000 Binary files a/doc/kfilereplace/optionsdialog_main_window_2.png and /dev/null differ diff --git a/doc/kfilereplace/project.png b/doc/kfilereplace/project.png deleted file mode 100644 index 607e6aa8..00000000 Binary files a/doc/kfilereplace/project.png and /dev/null differ diff --git a/doc/kfilereplace/projectdialog_main_window_1.png b/doc/kfilereplace/projectdialog_main_window_1.png deleted file mode 100644 index 58c622f0..00000000 Binary files a/doc/kfilereplace/projectdialog_main_window_1.png and /dev/null differ diff --git a/doc/kfilereplace/projectdialog_main_window_2.png b/doc/kfilereplace/projectdialog_main_window_2.png deleted file mode 100644 index 6fe2cb98..00000000 Binary files a/doc/kfilereplace/projectdialog_main_window_2.png and /dev/null differ diff --git a/doc/kfilereplace/recursive_option.png b/doc/kfilereplace/recursive_option.png deleted file mode 100644 index bc98df90..00000000 Binary files a/doc/kfilereplace/recursive_option.png and /dev/null differ diff --git a/doc/kfilereplace/regularexpression_option.png b/doc/kfilereplace/regularexpression_option.png deleted file mode 100644 index f74c7b56..00000000 Binary files a/doc/kfilereplace/regularexpression_option.png and /dev/null differ diff --git a/doc/kfilereplace/report_example.png b/doc/kfilereplace/report_example.png deleted file mode 100644 index 359de5ab..00000000 Binary files a/doc/kfilereplace/report_example.png and /dev/null differ diff --git a/doc/kfilereplace/results_view.png b/doc/kfilereplace/results_view.png deleted file mode 100644 index 8f91469d..00000000 Binary files a/doc/kfilereplace/results_view.png and /dev/null differ diff --git a/doc/kfilereplace/stop.png b/doc/kfilereplace/stop.png deleted file mode 100644 index 73b27d9f..00000000 Binary files a/doc/kfilereplace/stop.png and /dev/null differ diff --git a/doc/kfilereplace/strings_view.png b/doc/kfilereplace/strings_view.png deleted file mode 100644 index 7396e53c..00000000 Binary files a/doc/kfilereplace/strings_view.png and /dev/null differ diff --git a/doc/kfilereplace/toolbar.png b/doc/kfilereplace/toolbar.png deleted file mode 100644 index 84e699eb..00000000 Binary files a/doc/kfilereplace/toolbar.png and /dev/null differ diff --git a/doc/kfilereplace/unsortedList.png b/doc/kfilereplace/unsortedList.png deleted file mode 100644 index bed281f1..00000000 Binary files a/doc/kfilereplace/unsortedList.png and /dev/null differ diff --git a/doc/quanta/adv-quanta.docbook b/doc/quanta/adv-quanta.docbook index 5aefad44..432bc81c 100644 --- a/doc/quanta/adv-quanta.docbook +++ b/doc/quanta/adv-quanta.docbook @@ -210,7 +210,7 @@ This application lacks flexibility. Sorry, we will do better next time. - + + + + +2004 +Emiliano Gulmini + + +&FDLNotice; + +2004-08-09 +1.0.0 + + + + + +&tdefilereplace; is an utility to search and replace strings. + + + + +KDE +KFileReplace +replace +search +string + + + + + + Introduction + &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. + + + + +Using &tdefilereplace; + + + + &tdefilereplace; in its standalone incarnation + + + + + + &tdefilereplace; in its standalone incarnation + + + + + + + +The Toolbar + +The &tdefilereplace; toolbar should looks like this: + + &tdefilereplace;'s toolbar + + + + + + + + + &tdefilereplace;'s toolbar + + + + + +The toolbar shows you the buttons of the main functionalities. + + Toolbar Icons + + + + + + + + New session + + This button shows a session dialog in which you can set several basic options; if &tdefilereplace; run as standalone application you should click this button as first step. + + + + + + + + + + Search only + + This button starts a search loop. + + + + + + + + + + Replace + + This button starts a search&replace loop. When a string has been found, &tdefilereplace; replaces it with another string. + + + + + + + + + + Simulated Replace + + This button starts a simulated search&replace loop. Nothing really happens when you click this button. + + + + + + + + + + Stop + + This button stops an operation. + + + + + + + + + + Add Strings + + This button opens the Add Strings dialog in which you can edit your string list. + + + + + + + + + + Delete Strings + + This button deletes the selected (or the current if there is no selection) string from the list. + + + + + + + + + + Edit Strings + + This button edits a selected string. + + + + + + + + + + Delete List + + This button deletes all the strings in the list. + + + + + + + + + + Invert Strings + + This button swaps the search string with the replace string, so you can revert a search/replace operation. + + + + + + + + + + Load String List + + This button loads a string list saved in a xml file with a kfr extension. + + + + + + + + + + Search in Subfolders + + This button allows you to search/replace recursively in the subfolders of your base directory. + + + + + + + + + + Make Backup Files + + This button enables generation of backup files. + + + + + + + + + + Case-sensitive Search + + This button enables case-sensitive searching. + + + + + + + + + + Commands + + This button enables commands capability. Commands are special strings. See . + + + + + + + + + + Regular expressions + + This button enables Qt-like regular expressions. + + + + + + + + + + The Results List + + &tdefilereplace;'s Results view + + + + + + + + + &tdefilereplace;'s Results view + + + + The Results 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. + + + + + The String List + + This is the Strings view: + + &tdefilereplace;'s Strings view + + + + + + &tdefilereplace;'s Strings view + + + + + + The Strings view visualizes the list of strings you want search/replace. Please note that in search mode the Results view and the Strings view have a different layout. + + + + + The <guilabel>New Session</guilabel> Dialog + The New Session dialog is used to setup the basic parameters needed by &tdefilereplace; to work. It consists of two tabs, General and Advanced. + + + + The <guilabel>General</guilabel> Tab + + &tdefilereplace; General tab + + + + + + &tdefilereplace; General tab + + + + When you want to begin a new session the first step is to click on the New Session button. Then you must enter the base path and a sequence of shell-like wildcards to use as filter. + Then you could set some useful options, like searching in all the subfolders, doing a case-sensitive search, enabling commands and/or regular expressionsPlease note that regular expressions and commands could slow down the speed performances., doing a backup copy of each file before replacing. + If you want to start searching, you can put a string in the search box and press Search Now, otherwise leave the search box empty and press Search Later. + + + + The <guilabel>Advanced</guilabel> Tab + + &tdefilereplace; Advanced tab + + + + + + &tdefilereplace; Advanced tab + + + + The Advanced 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). + + + + + The <guilabel>Options</guilabel> Dialog + 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 SettingsConfigure KFileReplace... in the main menu. + + + General options + These options have been presented in the Toolbar section. + + The General tab of the Options window + + + + + + The General tab of the Options window + + + + + + + Advanced options + + + The Advanced tab of the Options window + + + + + + The Advanced tab of the Options window + + + + + Do not show files if no strings are found or replaced + When searching, stop on first string found + Follow symbolic links + Ignore hidden files and directories + + shows only the files that match some of your strings. This will speed up the search. + &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. + if a file is a link to another one, then search in the real file. + if hidden files or folders are encountered, ignore them. + + + + + + + The <guilabel>Add Strings</guilabel> Dialog + + &tdefilereplace;'s Add Strings dialog + + + + + + &tdefilereplace;'s Add Strings dialog + + + + 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 OK. + + + + + &tdefilereplace; features + This chapter provides informations about some useful capabilities of &tdefilereplace;. + + How to save your string list + When you want to reuse a list of strings you can save it in a xml file. To do this select from the menubar Search/ReplaceStringsSave Strings List to File. When you save a list, a simple xml file with extension kfr is created. To load a kfr file select from menubar Search/ReplaceStringsLoad Strings List from File. The actual file looks like this: + +<?xml version="1.0" ?> +<kfr> + <mode search="false"/> + <replacement> + <oldstring><![CDATA[SEARCH_STRING_1]] ></oldstring> + <newstring><![CDATA[REPLACE_STRING_1]]></newstring> + </replacement> + <replacement> + <oldstring><![CDATA[SEARCH_STRING_2]]></oldstring> + <newstring><![CDATA[REPLACE_STRING_2]]></newstring> + </replacement> + + + <replacement> + <oldstring><![CDATA[SEARCH_STRING_N]]></oldstring> + <newstring><![CDATA[REPLACE_STRING_N]]></newstring> + </replacement> + +</kfr> + + 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. + + + + How to Create a Simple Report + You can create a report by choosing Search/ReplaceResultsCreate Report File from the main menu. A report is a folder containing an xml and a css file. Reports may be useful to maintain a simple log of your operations. + + &tdefilereplace;'s Report feature + + + + + + + + + &tdefilereplace;'s Report feature + + + + + + + + How to use Regular Expressions + + If you want search for every string that starts with x, ht or u and ends with ml, you can write a regular expression like this: (x|ht|u)ml. Insert this expression in the search editor, click OK, and enable regular expressions by toggling the Regular Expression button. 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 if you want to solve a problem with a regular expression, you have two problems. + + + + How to Protect Original Files + 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 Backup button. If you want to customize the extension of the backup files open the Options dialog. + + + + + How to Open a File + 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. + + + + Commands + Suppose you want replace the phrase Alice's adventures in Wonderland with the entire file that contains Carroll's novel. Probably you don't want to do this by hand, what you need is a command that will do it for you. Click the Add button, select Search and Replace Mode and insert the following strings: Alice's adventure in Wonderland in the search mini-editor and the string [$loadfile:/the-path-to-my-folder/my-folder/my-file$] in the replacement mini-editor. Click OK. When you come back to the &tdefilereplace; main window, toggle the Command action button that enables the commands, and start the replacement process. There are also other commands, see for a list of all of them. + + + + +Credits and License + +&tdefilereplace;. Program copyright 1999 by François Dupoux dupoux@dupoux.com, 2003 Andras Mantia amantia@kde.org, 2004 Emiliano Gulmini emi_barbarossa@yahoo.it + + + + The &tdefilereplace; authors and maintainers: + + François Dupoux dupoux@dupoux.com + Original author + + + Andras Mantia amantia@kde.org + Shell autor, KPart creator, co-maintainer + + + Emiliano Gulmini emi_barbarossa@yahoo.it + Current maintainer, code cleaner & rewriter + + + + +Documentation Copyright © 2004 Emiliano Gulmini emi_barbarossa@yahoo.it + + + + +&underFDL; +&underGPL; + + + + +Installation + + +How to install &tdefilereplace; + +&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 &tdewebdev; home site for more information. + + + + + + + Requirements + In order to use the command [$mathexp:some_math_expression$] you should install the &bc; mathematical utility (version 1.06 or newer) written by Philip A. Nelson (philnelson@acm.org). + + + + + + &tdefilereplace; commands + + + [$datetime:iso$] + [$datetime:local$] + [$user:uid$] + [$user:gid$] + [$user:loginname$] + [$user:fullname$] + [$user:homedir$] + [$user:shell$] + [$loadfile:/my-path/my-directory/my-file$] + [$empty:$] + [$random:AN_INTEGER_NUMBER$] + [$random:$] + [$mathexp:bc-expression$] + + this command return the current date and time in Qt ISO format. + like above but in local format. + return the UID of the current user. + return the GID of the current user. + return the login name of the current user. + return the full name of the current user. + return the home directory of the current user. + return the shell of the current user. + return the content of the my-file file. + return the empty string. + return a random number string using AN_INTEGER_NUMBER as the initial seed. + like above, but without initial seed. + return the result of a &bc; v1.06 mathematical expression. + + + + + +&documentation.index; + + diff --git a/doc/tdefilereplace/invert.png b/doc/tdefilereplace/invert.png new file mode 100644 index 00000000..f3ab8be6 Binary files /dev/null and b/doc/tdefilereplace/invert.png differ diff --git a/doc/tdefilereplace/kfr_standalone_main_window_1.png b/doc/tdefilereplace/kfr_standalone_main_window_1.png new file mode 100644 index 00000000..3e4f85db Binary files /dev/null and b/doc/tdefilereplace/kfr_standalone_main_window_1.png differ diff --git a/doc/tdefilereplace/optionsdialog_main_window_1.png b/doc/tdefilereplace/optionsdialog_main_window_1.png new file mode 100644 index 00000000..959c3977 Binary files /dev/null and b/doc/tdefilereplace/optionsdialog_main_window_1.png differ diff --git a/doc/tdefilereplace/optionsdialog_main_window_2.png b/doc/tdefilereplace/optionsdialog_main_window_2.png new file mode 100644 index 00000000..3213b6ff Binary files /dev/null and b/doc/tdefilereplace/optionsdialog_main_window_2.png differ diff --git a/doc/tdefilereplace/project.png b/doc/tdefilereplace/project.png new file mode 100644 index 00000000..607e6aa8 Binary files /dev/null and b/doc/tdefilereplace/project.png differ diff --git a/doc/tdefilereplace/projectdialog_main_window_1.png b/doc/tdefilereplace/projectdialog_main_window_1.png new file mode 100644 index 00000000..58c622f0 Binary files /dev/null and b/doc/tdefilereplace/projectdialog_main_window_1.png differ diff --git a/doc/tdefilereplace/projectdialog_main_window_2.png b/doc/tdefilereplace/projectdialog_main_window_2.png new file mode 100644 index 00000000..6fe2cb98 Binary files /dev/null and b/doc/tdefilereplace/projectdialog_main_window_2.png differ diff --git a/doc/tdefilereplace/recursive_option.png b/doc/tdefilereplace/recursive_option.png new file mode 100644 index 00000000..bc98df90 Binary files /dev/null and b/doc/tdefilereplace/recursive_option.png differ diff --git a/doc/tdefilereplace/regularexpression_option.png b/doc/tdefilereplace/regularexpression_option.png new file mode 100644 index 00000000..f74c7b56 Binary files /dev/null and b/doc/tdefilereplace/regularexpression_option.png differ diff --git a/doc/tdefilereplace/report_example.png b/doc/tdefilereplace/report_example.png new file mode 100644 index 00000000..359de5ab Binary files /dev/null and b/doc/tdefilereplace/report_example.png differ diff --git a/doc/tdefilereplace/results_view.png b/doc/tdefilereplace/results_view.png new file mode 100644 index 00000000..8f91469d Binary files /dev/null and b/doc/tdefilereplace/results_view.png differ diff --git a/doc/tdefilereplace/stop.png b/doc/tdefilereplace/stop.png new file mode 100644 index 00000000..73b27d9f Binary files /dev/null and b/doc/tdefilereplace/stop.png differ diff --git a/doc/tdefilereplace/strings_view.png b/doc/tdefilereplace/strings_view.png new file mode 100644 index 00000000..7396e53c Binary files /dev/null and b/doc/tdefilereplace/strings_view.png differ diff --git a/doc/tdefilereplace/toolbar.png b/doc/tdefilereplace/toolbar.png new file mode 100644 index 00000000..84e699eb Binary files /dev/null and b/doc/tdefilereplace/toolbar.png differ diff --git a/doc/tdefilereplace/unsortedList.png b/doc/tdefilereplace/unsortedList.png new file mode 100644 index 00000000..bed281f1 Binary files /dev/null and b/doc/tdefilereplace/unsortedList.png differ diff --git a/kfilereplace/CMakeLists.txt b/kfilereplace/CMakeLists.txt deleted file mode 100644 index 2ca35794..00000000 --- a/kfilereplace/CMakeLists.txt +++ /dev/null @@ -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 kfilereplace.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install( FILES kfilereplacepart.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -install( FILES kfilereplacepartui.rc DESTINATION ${DATA_INSTALL_DIR}/kfilereplacepart ) -install( FILES kfilereplaceui.rc DESTINATION ${DATA_INSTALL_DIR}/kfilereplace ) - - -##### libkfilereplacepart (module) ############## - -tde_add_kpart( libkfilereplacepart AUTOMOC - SOURCES - commandengine.cpp configurationclasses.cpp - kfilereplacepart.cpp kfilereplaceview.cpp - kfilereplaceviewwdg.ui kaddstringdlg.cpp kaddstringdlgs.ui - knewprojectdlg.cpp knewprojectdlgs.ui koptionsdlg.cpp - koptionsdlgs.ui kfilereplacelib.cpp report.cpp - LINK kio-shared tdeparts-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### kfilereplace (executable) ################# - -tde_add_executable( kfilereplace AUTOMOC - SOURCES - kfilereplace.cpp main.cpp - LINK kio-shared tdeparts-shared - DESTINATION ${BIN_INSTALL_DIR} -) diff --git a/kfilereplace/ChangeLog b/kfilereplace/ChangeLog deleted file mode 100644 index 9a9c507e..00000000 --- a/kfilereplace/ChangeLog +++ /dev/null @@ -1,211 +0,0 @@ -2005-02-20: Andras Mantia - * 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 - * Accept paths as command line arguments - -2005-01-29 Emiliano Gulmini - * Cleaning up. - -2005-01-23 Emiliano Gulmini - * 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 - * 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 - * 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 - * 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 - * 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 '' just after the root to allows - kfilereplace 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 - * The KFilereplaceView widget has been modified. Now it change the layout of kfilereplace depending of the - value of m_option->m_searchOnlyMode. - * I fixed a bug in the backup file option. - -2004-12-13 Emiliano Gulmini - * 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 - * 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 - * 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 - * I did some cleanup. - -2004-09-11 Emiliano Gulmini - * 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 - * 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 - * I fixed a bug that affected the method "void KFileReplaceView::slotStringsClear()" in kfilereplaceview.cpp file. - This bug caused the list of strings not to be correctly erased. - -2004-08-07 Emiliano Gulmini - * 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 - * 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 kfilereplacepart.cpp - -2004-07-30 Emiliano Gulmini - * The icons have been fixed!!! What a miracle!!! - -2004-07-24 Emiliano Gulmini - * 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 - * I fixed a bug that affects the generation of extension of - the backup files. - -2004-07-17 Emiliano Gulmini - * 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 - * 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 - * Well, KFR has been entirely (more or less :-)) rewrote. - the files: - apistruct.h - kernel.(cpp,h) - kexpression.(cpp,h) - kfilereplacedoc.(cpp,h) - kfilereplacepref.(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 - * Added a feature. Now we can open a file from the result view of KFR in Quanta(thanks Andras). - -2004-03-14 Emiliano Gulmini - * 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 - * Removed KresultView(.h,.cpp). Now KFileReplaceView 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 - * Added kconfirmdlgs.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 - * 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 - * kfilereplacepref.(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 kfilereplace logo and icons in the result view appear. - -2004-02-18 Emiliano Gulmini - * 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 klistviewstring.(h,cpp) were removed. - * A lot of clean up has been made in all files. diff --git a/kfilereplace/Makefile.am b/kfilereplace/Makefile.am deleted file mode 100644 index 4e0d8ed1..00000000 --- a/kfilereplace/Makefile.am +++ /dev/null @@ -1,43 +0,0 @@ -## Makefile.am for kfilereplace - -# 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 kfilereplaceiface.h kfilereplacelib.h \ - knewprojectdlg.h kfilereplaceview.h koptionsdlg.h report.h commandengine.h \ - configurationclasses.h kfilereplace.h - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -kde_module_LTLIBRARIES = libkfilereplacepart.la -libkfilereplacepart_la_SOURCES = kfilereplacepart.cpp kfilereplaceview.cpp \ - kfilereplaceviewwdg.ui kaddstringdlg.cpp kaddstringdlgs.ui knewprojectdlg.cpp \ - knewprojectdlgs.ui koptionsdlg.cpp koptionsdlgs.ui kfilereplacelib.cpp report.cpp \ - commandengine.cpp configurationclasses.cpp - -libkfilereplacepart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -lDCOP -libkfilereplacepart_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) $(LIB_KHTML) - -messages: rc.cpp - $(XGETTEXT) *.cpp *.h -o $(podir)/kfilereplace.pot - -KDE_ICON = AUTO -kde_services_DATA = kfilereplacepart.desktop -xdg_apps_DATA = kfilereplace.desktop - -# this is where the XML-GUI resource file goes -partrcdir = $(kde_datadir)/kfilereplacepart -partrc_DATA = kfilereplacepartui.rc - -shellrcdir = $(kde_datadir)/kfilereplace -shellrc_DATA = kfilereplaceui.rc -bin_PROGRAMS = kfilereplace -kfilereplace_LDFLAGS = $(KDE_RPATH) $(all_libraries) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -lDCOP -kfilereplace_LDADD = $(LIB_KPARTS) -kfilereplace_SOURCES = kfilereplace.cpp main.cpp diff --git a/kfilereplace/commandengine.cpp b/kfilereplace/commandengine.cpp deleted file mode 100644 index 5184773c..00000000 --- a/kfilereplace/commandengine.cpp +++ /dev/null @@ -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 -#include -#include -#include - -// KDE -#include -#include -#include - -// 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 */ - //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" diff --git a/kfilereplace/commandengine.h b/kfilereplace/commandengine.h deleted file mode 100644 index 36bcfcb8..00000000 --- a/kfilereplace/commandengine.h +++ /dev/null @@ -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 - -//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 diff --git a/kfilereplace/configurationclasses.cpp b/kfilereplace/configurationclasses.cpp deleted file mode 100644 index f0c6bcc4..00000000 --- a/kfilereplace/configurationclasses.cpp +++ /dev/null @@ -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()); -} diff --git a/kfilereplace/configurationclasses.h b/kfilereplace/configurationclasses.h deleted file mode 100644 index 0d36261b..00000000 --- a/kfilereplace/configurationclasses.h +++ /dev/null @@ -1,165 +0,0 @@ -/*************************************************************************** - configurationclasses.h - description - ------------------- - begin : Sat Apr 17 2004 - copyright : (C) 2004 Emiliano Gulmini - email : - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 -#include -#include -#include -#include - -typedef TQMap KeyValueMap; -// entry strings in the kfilereplacerc 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 diff --git a/kfilereplace/configure.in.in b/kfilereplace/configure.in.in deleted file mode 100644 index a7f9ec22..00000000 --- a/kfilereplace/configure.in.in +++ /dev/null @@ -1,12 +0,0 @@ -#MIN_CONFIG - -AM_INIT_AUTOMAKE(kfilereplace, 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) diff --git a/kfilereplace/hi22-app-kfilereplace.png b/kfilereplace/hi22-app-kfilereplace.png deleted file mode 100644 index 429a3984..00000000 Binary files a/kfilereplace/hi22-app-kfilereplace.png and /dev/null differ diff --git a/kfilereplace/hi32-app-kfilereplace.png b/kfilereplace/hi32-app-kfilereplace.png deleted file mode 100644 index 8dff2abb..00000000 Binary files a/kfilereplace/hi32-app-kfilereplace.png and /dev/null differ diff --git a/kfilereplace/hi48-app-kfilereplace.png b/kfilereplace/hi48-app-kfilereplace.png deleted file mode 100644 index c11f34ba..00000000 Binary files a/kfilereplace/hi48-app-kfilereplace.png and /dev/null differ diff --git a/kfilereplace/kaddstringdlg.cpp b/kfilereplace/kaddstringdlg.cpp deleted file mode 100644 index 1ec33552..00000000 --- a/kfilereplace/kaddstringdlg.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/*************************************************************************** - KAddStringDlg.cpp - description - ------------------- - begin : Sat Oct 16 1999 - copyright : (C) 1999 by Fran�ois Dupoux - (C) 2004 Emiliano Gulmini - 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 -#include -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include - -// 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(); - - // Do nothing if list is empty - if(currentItem == 0) - return; - - m_currentMap.remove(currentItem->text(0)); - - if(m_option->m_searchingOnlyMode) - { - m_edSearch->setText(currentItem->text(0)); - m_edReplace->clear(); - //currentItem->setText(1,m_edReplace->text()); - } - else - { - m_edSearch->setText(currentItem->text(0)); - m_edReplace->setText(currentItem->text(1)); - } - - delete currentItem; - - currentItem = 0; -} - -void KAddStringDlg::slotHelp() -{ - kapp->invokeHelp(TQString(), "kfilereplace"); -} - -#include "kaddstringdlg.moc" - diff --git a/kfilereplace/kaddstringdlg.h b/kfilereplace/kaddstringdlg.h deleted file mode 100644 index f39c2961..00000000 --- a/kfilereplace/kaddstringdlg.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - KAddStringDlg.h - description - ------------------- - begin : Sat Oct 16 1999 - copyright : (C) 1999 by Franois Dupoux - (C) 2004 Emiliano Gulmini - 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. * - * * - ***************************************************************************/ - -#ifndef KADDSTRINGDLG_H -#define KADDSTRINGDLG_H - -// local -#include "kaddstringdlgs.h" -#include "configurationclasses.h" -/** - * This is the dialog used to add a list of searching/replacing strings - */ -class KAddStringDlg : public KAddStringDlgS -{ - Q_OBJECT - - private: - RCOptions* m_option; - TQListView* m_sv; - KeyValueMap m_currentMap; - bool m_wantEdit; - - public: //Constructors - KAddStringDlg(RCOptions* info, bool wantEdit, TQWidget *parent=0, const char *name=0); - - private slots: - void slotOK(); - void slotSearchOnly(); - void slotSearchReplace(); - void slotAddStringToView(); - void slotDeleteStringFromView(); - void slotHelp(); - - private: - /** - * inits... the GUI :-) - */ - void initGUI(); - /** - * Deletes all the items of the view - */ - void eraseViewItems(); - /** - * Deletes all the items of the map - */ - void clearMap() { KeyValueMap m; m_option->m_mapStringsView = m; } - /** - * The view is actually a stack widget that contains two different views widget - */ - void raiseView(); - /** - * Verifies whether 'lv' contains 's' - */ - bool columnContains(TQListView* lv,const TQString& s, int column); - void saveViewContentIntoMap(); - void loadMapIntoView(); - void whatsThis(); -}; - -#endif // KADDSTRINGDLG_H - diff --git a/kfilereplace/kaddstringdlgs.ui b/kfilereplace/kaddstringdlgs.ui deleted file mode 100644 index 563aa33f..00000000 --- a/kfilereplace/kaddstringdlgs.ui +++ /dev/null @@ -1,426 +0,0 @@ - -KAddStringDlgS - - - KAddStringDlgS - - - - 0 - 0 - 586 - 347 - - - - Insert Searching/Replacing Strings - - - true - - - - unnamed - - - - layout14 - - - - unnamed - - - - bgChoose - - - Choose String Adding Mode - - - true - - - - unnamed - - - - m_rbSearchReplace - - - Search and replace mode - - - - - - - - m_rbSearchOnly - - - Search only mode - - - true - - - - - - - frame4 - - - StyledPanel - - - Raised - - - - unnamed - - - - layout11 - - - - unnamed - - - - layout13 - - - - unnamed - - - - m_tlSearch - - - Search for: - - - - - m_edSearch - - - PlainText - - - - - - - layout14 - - - - unnamed - - - - m_tlReplace - - - false - - - Replace with: - - - - - m_edReplace - - - false - - - PlainText - - - AutoAll - - - - - - - - - layout16 - - - - unnamed - - - - spacer8 - - - Vertical - - - Expanding - - - - 20 - 90 - - - - - - layout15 - - - - unnamed - - - - m_pbDel - - - - 30 - 32767 - - - - - - - - - m_pbAdd - - - - 30 - 32767 - - - - - - - false - - - - - - - spacer9 - - - Vertical - - - Expanding - - - - 20 - 90 - - - - - - - - m_stack - - - - 7 - 7 - 0 - 0 - - - - - WStackPage - - - 0 - - - - unnamed - - - 0 - - - - - Search For - - - true - - - true - - - - m_stringView_2 - - - true - - - false - - - AllColumns - - - - - - - WStackPage - - - 1 - - - - unnamed - - - 0 - - - - - Search For - - - true - - - true - - - - - Replace With - - - true - - - true - - - - m_stringView - - - true - - - false - - - AllColumns - - - - - - - - - - layout2 - - - - unnamed - - - - m_pbHelp - - - true - - - &Help - - - - - spacer1 - - - Horizontal - - - Expanding - - - - 90 - 20 - - - - - - layout1 - - - - unnamed - - - - m_pbOK - - - &OK - - - - - m_pbCancel - - - &Cancel - - - - - - - - - - - - - m_pbCancel - clicked() - KAddStringDlgS - reject() - - - - diff --git a/kfilereplace/kfilereplace.cpp b/kfilereplace/kfilereplace.cpp deleted file mode 100644 index a0976658..00000000 --- a/kfilereplace/kfilereplace.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - kfilereplace.cpp - KFileReplace shell implementation - ------------------- - begin : Thu Sep 16 14:14:09 2004 - copyright : (C) 2004 by Andras Mantia - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -//kde includes -#include -#include -#include -#include -#include - -//app includes -#include "kfilereplace.h" - -KFileReplace::KFileReplace() - : KParts::MainWindow(0L, "KFileReplace") -{ - KLibFactory *factory = KLibLoader::self()->factory("libkfilereplacepart"); - if (factory) - { - m_part = static_cast(factory->create(TQT_TQOBJECT(this), - "kfilereplace_part", "KParts::ReadOnlyPart" )); - - if (m_part) - { - setCentralWidget(m_part->widget()); - KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); - KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureKeys()), actionCollection()); - KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureToolbars()), actionCollection()); - setStandardToolBarMenuEnabled(true); - createGUI(m_part); - removeDuplicatedActions(); - } - } - else - { - KMessageBox::error(this, i18n("Could not find the KFileReplace part.")); - close(); - return; - } -} - - -KFileReplace::~KFileReplace() -{ -} - -void KFileReplace::openURL(const KURL &url) -{ - m_part->openURL(url); -} - -void KFileReplace::slotConfigureKeys() -{ - KKeyDialog dlg( false, this ); - TQPtrList clients = guiFactory()->clients(); - for( TQPtrListIterator it( clients ); - it.current(); ++it ) - { - dlg.insert( (*it)->actionCollection() ); - } - dlg.configure(); -} - -void KFileReplace::slotConfigureToolbars() -{ - saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); - KEditToolbar dlg(factory()); - connect(&dlg, TQT_SIGNAL(newToolbarConfig()), - this, TQT_SLOT(applyNewToolbarConfig())); - dlg.exec(); -} - -void KFileReplace::applyNewToolbarConfig() -{ - applyMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); -} - - -void KFileReplace::removeDuplicatedActions() -{ - KActionCollection* part_action_collection = m_part->actionCollection(); - KAction* part_about_action = part_action_collection->action("help_about_kfilereplace"); - KAction* part_report_action = part_action_collection->action("report_bug"); - KAction* part_help_action= part_action_collection->action("help_kfilereplace"); - - if (!part_about_action || !part_report_action || !part_help_action || !part_action_collection) - return; - - TQWidget* container = part_about_action->container(0); - part_about_action->unplug(container); - part_report_action->unplug(container); - part_help_action->unplug(container); - part_action_collection->remove(part_about_action); - part_action_collection->remove(part_report_action); - part_action_collection->remove(part_help_action); -} - -#include "kfilereplace.moc" diff --git a/kfilereplace/kfilereplace.desktop b/kfilereplace/kfilereplace.desktop deleted file mode 100644 index e656566f..00000000 --- a/kfilereplace/kfilereplace.desktop +++ /dev/null @@ -1,55 +0,0 @@ -[Desktop Entry] -Name=KFileReplace -Name[hi]=के-फ़ाइल-रिप्लेस -Name[ne]=बदल्ने केडीई फाइल -Name[pa]=ਕੇ-ਫਾਇਲ-ਬਦਲੋ -Name[sk]=KFile zameniť -Name[sv]=Kfilereplace -Name[ta]=Kகோப்பு இடமாற்று -Name[tg]=KФайлро ҷойгузор кардан -Name[tr]=K Dosya Değiştirme -Exec=kfilereplace %i %m -caption "%c" -Icon=kfilereplace -Type=Application -DocPath=kfilereplace/index.html -Terminal=false -GenericName=Search & Replace Tool -GenericName[bg]=Търсене и замяна -GenericName[br]=Ostilh klask hag erlec'hiañ -GenericName[ca]=Eina cerca i substitueix -GenericName[cs]=Nástroj pro vyhledání a nahrazení -GenericName[da]=Søg og erstat-værktøj -GenericName[de]=Suchen & Ersetzen Werkzeug -GenericName[el]=Εργαλείο αναζήτησης & αντικατάστασης -GenericName[es]=Herramienta de búsqueda y reemplazo -GenericName[et]=Otsimise ja asendamise tööriist -GenericName[eu]=Bilaketa eta ordezkapen tresna -GenericName[fa]=ابزار جستجو و جایگزینی -GenericName[fi]=Etsi & korvaa työkalu -GenericName[fr]=Outil de recherche et de remplacement -GenericName[gl]=Ferramenta de busca e reemprazo -GenericName[hu]=Fájlkereső -GenericName[is]=Tól til að leita að texta og skipta út -GenericName[it]=Strumento di ricerca e sostituzione -GenericName[ja]=検索および置換ツール -GenericName[ka]=ძიების და ჩანაცვლების ხელსაწყო -GenericName[lt]=Paieškos ir keitimo įrankis -GenericName[ms]=Alatan Cari & Ganti -GenericName[nds]=Söök- un Utwesselwarktüüch -GenericName[ne]=खोजी गर्ने र बदल्ने उपरकरण -GenericName[nl]=Gereedschap voor zoeken en vervangen -GenericName[pa]=ਖੋਜ ਅਤੇ ਤਬਦੀਲ ਸੰਦ -GenericName[pl]=Narzędzie do wyszukiwania i zamiany -GenericName[pt]=Ferramenta de Procura e Substituição -GenericName[pt_BR]=Ferramenta de Procura & Substituição -GenericName[ru]=Поиск и замена -GenericName[sk]=Nájsť a zameniť -GenericName[sl]=Orodje za iskanje in zamenjavo -GenericName[sr]=Алат за претрагу и замену -GenericName[sr@Latn]=Alat za pretragu i zamenu -GenericName[sv]=Sök- och ersättningsverktyg -GenericName[uk]=Засіб пошуку та заміни -GenericName[zh_CN]=搜索替换工具 -GenericName[zh_HK]=搜尋及取代工具 -GenericName[zh_TW]=搜尋及取代工具 -Categories=Qt;TDE;Utility;X-TDE-Utilities-File; diff --git a/kfilereplace/kfilereplace.h b/kfilereplace/kfilereplace.h deleted file mode 100644 index 5623d3bf..00000000 --- a/kfilereplace/kfilereplace.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - kfilereplace.h - KFileReplace header - ------------------- - begin : Thu Sep 16 14:14:09 2004 - copyright : (C) 2004 by Andras Mantia - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 KFILEREPLACE_H -#define KFILEREPLACE_H - -#include - -/** -Shell application for the KFileReplace part. - -@author Andras Mantia -*/ -class KFileReplace : public KParts::MainWindow -{ - Q_OBJECT - -public: - KFileReplace(); - ~KFileReplace(); - void openURL(const KURL &url); - -private slots: - void slotConfigureKeys(); - void slotConfigureToolbars(); - void applyNewToolbarConfig(); - -private: - void removeDuplicatedActions(); - - KParts::ReadOnlyPart *m_part; -}; - -#endif diff --git a/kfilereplace/kfilereplace.tdevelop b/kfilereplace/kfilereplace.tdevelop deleted file mode 100644 index fcba4350..00000000 --- a/kfilereplace/kfilereplace.tdevelop +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - $VERSION$ - KDevKDEAutoProject - C++ - - Qt - KDE - - . - false - - - - kdevcvsservice - - - - - - - - - false - false - - - false - false - *.o,*.lo,CVS - - - - - ada - ada_bugs_gcc - bash - bash_bugs - clanlib - fortran_bugs_gcc - gnome1 - gnustep - gtk - gtk_bugs - haskell - haskell_bugs_ghc - java_bugs_gcc - java_bugs_sun - opengl - pascal_bugs_fp - php - php_bugs - perl - perl_bugs - python - python_bugs - ruby - ruby_bugs - sdl - stl - sw - w3c-dom-level2-html - w3c-svg - w3c-uaag10 - wxwidgets_bugs - - - qmake User Guide - - - - - libtool - - - - - - true - false - false - - - false - true - 10 - - - - - - - - - - - - - - - - - true - 1 - false - - 0 - - - build - / - kfilereplace/kfilereplace - - false - true - - - - default - kfilereplace - - - - - - - --enable-debug=full --prefix=/opt/trinity --enable-editors - /home/andris/development/build/kde-head/tdewebdev - /home/andris/development/sources/kde-head/tdewebdev - -DKDE_NO_COMPAT -DQT_NO_COMPAT -DDEBUG_PARSER - - kdevgccoptions - kdevgppoptions - kdevpgf77options - - - - - - - - - - - - .h - .cpp - - - - - true - true - true - false - true - true - true - 250 - 400 - 250 - - - - - set - m_,_ - theValue - true - true - - - - - - - - - - - true - true - true - true - -C - - diff --git a/kfilereplace/kfilereplaceiface.h b/kfilereplace/kfilereplaceiface.h deleted file mode 100644 index 3c62ae99..00000000 --- a/kfilereplace/kfilereplaceiface.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - kfilereplaceif.h - description - ------------------- - copyright : (C) 1999 by Franois Dupoux - (C) 2003 Andras Mantia - email : dupoux@dupoux.com, amantia@kde.org - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 KFILEREPLACEIFACE_H -#define KFILEREPLACEIFACE_H - -#include - -class KFileReplaceIface : virtual public DCOPObject -{ - K_DCOP - -k_dcop: - virtual void openURL(const TQString& url) = 0; -}; - -#endif // KFILEREPLACEIFACE_H diff --git a/kfilereplace/kfilereplacelib.cpp b/kfilereplace/kfilereplacelib.cpp deleted file mode 100644 index 6e0d8323..00000000 --- a/kfilereplace/kfilereplacelib.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/*************************************************************************** - kfilereplacelib.cpp - File library - ------------------- - begin : lun mai 3 20:19:52 CEST 1999 - - copyright : (C) 1999 by Franois Dupoux - (C) 2003 Andras Mantia - (C) 2004 Emiliano Gulmini - 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 -#include -#include -#include - -//KDE -#include -#include -#include -#include - -//needed for malloc/free -#include - -// local -#include "kfilereplacelib.h" - -const double kilo = 1024.0; -const double mega = 1048576.0;//1024^2 -const double giga = 1073741824.0;//1024^3 -const double tera = 1099511627776.0;//1024^4 - -/** - Format a path, from a path and a filename, or another sub-path (avoid double '/' risks) - Parameters::.....* basePath: fist path (can be "/" if root, or "/usr/bin/" or "/usr/bin" for example) - .................* fileName: second path (can be "/doc/html/", or "doc/html/" or "doc/html/index.html" for example) - Return values:...* Full valid path (without double "/") -*/ -TQString KFileReplaceLib::formatFullPath(const TQString& basePath, const TQString &fileName) -{ - TQString fullPath = basePath; - TQString fname = fileName; - - if (fname.startsWith("/")) // skip beginning '/' - fname = fname.remove(0,1); - - if (fullPath.endsWith("/")) - fullPath.append(fname); - else - fullPath.append("/"+fname); - - return fullPath; -} - -/** - Add an extension to a filename, or a filepath - Parameters::.....* fileName: filename or filepath (it can have already the extension) - .................* extension: extension to add without "." (ex: "html", "kfr") - Return values:...* Filename / Filepath with the extension -*/ -TQString KFileReplaceLib::addExtension(const TQString& fileName, const TQString& extension) -{ - TQString fullExtension = "."; - TQString fname = fileName; - - fullExtension.append(extension); - - // filename cannot contain ".ext" ==> Add it - if(fname.length() <= fullExtension.length()) - fname.append(fullExtension); - else // filename can contain ".ext" - { - if (fname.right(fullExtension.length()) != fullExtension) - fname.append(fullExtension); - } - - return fname; -} - -TQString KFileReplaceLib::formatFileSize(double size) -{ - TQString stringSize; - - if(size < kilo) - { - const int asInt = (int) size; - stringSize = i18n("1 byte", "%n bytes", asInt); - } - else - if(size >= kilo && size < mega) - { - double d = size / kilo; - stringSize = i18n("%1 KB").arg(TQString::number(d,'f',2)); - } - else - if(size >= mega && size < giga) - { - double d = size / mega; - stringSize = i18n("%1 MB").arg(TQString::number(d,'f',2)); - } - else - if(size >= giga) - { - double d = size / giga; - stringSize = i18n("%1 GB").arg(TQString::number(d,'f',2)); - } - return stringSize; -} - -void KFileReplaceLib::convertOldToNewKFRFormat(const TQString& fileName, KListView* stringView) -{ - //this method convert old format in new XML-based format - typedef struct - { - char pgm[13]; // Must be "KFileReplace" : 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 != "KFileReplace")) - { - KMessageBox::error(0, i18n("Cannot open the file %1 and load the string list. This file seems not to be a valid old kfr file or it is broken.").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 KFileReplaceLib::isAnAccessibleFile(const TQString& filePath, const TQString& fileName, RCOptions* info) -{ - TQString bkExt = info->m_backupExtension; - if(fileName == ".." || fileName == "." || (!bkExt.isEmpty() && fileName.right(bkExt.length()) == bkExt)) - return false; - - TQFileInfo fi; - if(filePath.isEmpty()) - fi.setFile(fileName); - else - fi.setFile(filePath+"/"+fileName); - - if(fi.isDir()) - return true; - - int minSize = info->m_minSize, - maxSize = info->m_maxSize; - TQString minDate = info->m_minDate, - maxDate = info->m_maxDate, - dateAccess = info->m_dateAccess; - - // Avoid files that not match access date requirements - TQString last = "unknown"; - if(dateAccess == "Last Writing Access") - last = fi.lastModified().toString(Qt::ISODate); - if(dateAccess == "Last Reading Access") - last = fi.lastRead().toString(Qt::ISODate); - - if(last != "unknown") - { - if(minDate != "unknown" && maxDate != "unknown") - { //If out of range then exit - if((minDate > last) || (maxDate < last)) - return false; - } - else - { - if(minDate != "unknown") - { //If out of range then exit - if(minDate > last) - return false; - } - else - { - if(maxDate != "unknown") - //If out of range then exit - if(maxDate < last) - return false; - } - } - } - // Avoid files that not match size requirements - int size = fi.size(); - if(maxSize != FileSizeOption && minSize != FileSizeOption) - if(size > (maxSize*1024) || size < (minSize*1024)) - return false; - - // Avoid files that not match ownership requirements - if(info->m_ownerUserIsChecked) - { - TQString fileOwnerUser; - if(info->m_ownerUserType == "Name") - fileOwnerUser = fi.owner(); - else - fileOwnerUser = TQString::number(fi.ownerId(),10); - - if(info->m_ownerUserBool == "Equals To") - { - if(info->m_ownerUserValue != fileOwnerUser) - return false; - } - else - { - if(info->m_ownerUserValue == fileOwnerUser) - return false; - } - } - - if(info->m_ownerGroupIsChecked) - { - TQString fileOwnerGroup; - if(info->m_ownerGroupType == "Name") - fileOwnerGroup = fi.group(); - else - fileOwnerGroup = TQString::number(fi.groupId(),10); - if(info->m_ownerGroupBool == "Equals To") - { - if(info->m_ownerGroupValue != fileOwnerGroup) - return false; - } - else - { - if(info->m_ownerGroupValue == fileOwnerGroup) - return false; - } - } - - //If we are here then all requirements have been verified - return true; -} - -void KFileReplaceLib::setIconForFileEntry(TQListViewItem* item, TQString path) -{ - TQFileInfo fi(path); - TQString extension = fi.extension(), - baseName = fi.baseName(); - - KeyValueMap extensionMap; - - extensionMap["a"] = "binary"; - extensionMap["am"] = "shellscript"; - extensionMap["bz"] = "zip"; - extensionMap["bz2"] = "zip"; - extensionMap["c"] = "source_c"; - extensionMap["cc"] = "source_cpp"; - extensionMap["cpp"] = "source_cpp"; - extensionMap["eml"] = "message"; - extensionMap["exe"] = "exec_wine"; - extensionMap["gz"] = "zip"; - extensionMap["h"] = "source_h"; - extensionMap["htm"] = "html"; - extensionMap["html"] = "html"; - extensionMap["in"] = "shellscript"; - extensionMap["java"] = "source_java"; - extensionMap["jpg"] = "image"; - extensionMap["kfr"] = "html"; - extensionMap["kmdr"] = "widget_doc"; - extensionMap["kwd"] = "kword_kwd"; - extensionMap["log"] = "log"; - extensionMap["moc"] = "source_moc"; - extensionMap["mp3"] = "sound"; - extensionMap["o"] = "source_o"; - extensionMap["pdf"] = "pdf"; - extensionMap["php"] = "source_php"; - extensionMap["py"] = "source_py"; - extensionMap["pl"] = "source_pl"; - extensionMap["p"] = "source_p"; - extensionMap["ps"] = "postscript"; - extensionMap["png"] = "image"; - extensionMap["sa"] = "binary"; - extensionMap["sh"] = "shellscript"; - extensionMap["so"] = "binary"; - extensionMap["tar"] = "tar"; - extensionMap["tex"] = "tex"; - extensionMap["tgz"] = "tgz"; - extensionMap["txt"] = "txt"; - extensionMap["ui"] = "widget_doc"; - extensionMap["uml"] = "umbrellofile"; - extensionMap["wav"] = "sound"; - extensionMap["xml"] = "html"; - extensionMap["xpm"] = "image"; - - KeyValueMap::Iterator itExtensionMap; - - for(itExtensionMap = extensionMap.begin(); itExtensionMap != extensionMap.end(); ++itExtensionMap) - { - if(extension == itExtensionMap.key()) - { - item->setPixmap(0,SmallIcon(itExtensionMap.data())); - return; - } - } - - KeyValueMap baseNameMap; - - baseNameMap["configure"] = "shellscript"; - baseNameMap["core"] = "core"; - baseNameMap["makefile"] = "make"; - baseNameMap["readme"] = "readme"; - baseNameMap["README"] = "readme"; - baseNameMap["Readme"] = "readme"; - baseNameMap["TODO"] = "txt"; - - KeyValueMap::Iterator itBaseNameMap; - - for(itBaseNameMap = baseNameMap.begin(); itBaseNameMap != baseNameMap.end(); ++itBaseNameMap) - { - if(baseName == itBaseNameMap.key()) - { - item->setPixmap(0,SmallIcon(itBaseNameMap.data())); - return; - } - } -} diff --git a/kfilereplace/kfilereplacelib.h b/kfilereplace/kfilereplacelib.h deleted file mode 100644 index de80d17d..00000000 --- a/kfilereplace/kfilereplacelib.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - kfilereplacelib.h - File library, derived from filelib.h - ------------------- - begin : lun mai 3 20:19:52 CEST 1999 - - copyright : (C) 1999 by Franois Dupoux - (C) 2003 Andras Mantia - (C) 2004 Emiliano Gulmini - 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. * - * * - ***************************************************************************/ - -#ifndef KFILEREPLACELIB_H -#define KFILEREPLACELIB_H - -// KDE -#include -class KlistView; - -// local -#include "configurationclasses.h" - -class KFileReplaceLib -{ - public: - - /** - Format a path, from a path and a filename, or another sub-path (avoid double '/' risks) - Parameters::.....* basePath: fist path (can be "/" if root, or "/usr/bin/" or "/usr/bin" for example) - .................* filename: second path (can be "/doc/html/", or "doc/html/" or "doc/html/index.html" for example) - Return values:...* Full valid path (without double "/") - */ - static TQString formatFullPath(const TQString& basePath, const TQString& fileName); - - /** - Add an extension to a filename, or a filepath - Parameters::.....* filename: filename or filepath (it can have already the extension) - .................* extension: extension to add without "." (ex: "html", "kfr") - Return values:...* Filename / Filepath with the extension - */ - static TQString addExtension(const TQString& fileName, const TQString& extension); - - static TQString formatFileSize(double size); - - /** - converts the old kfr format file in the new xml-based format. - */ - static void convertOldToNewKFRFormat(const TQString& fileName, KListView* stringView); - /** - Verifies that files, which we are scanning, respect some - conditions - */ - static bool isAnAccessibleFile(const TQString& filePath, const TQString& fileName, RCOptions* info); - - static void setIconForFileEntry(TQListViewItem* item, TQString path); -}; -#endif // KFILEREPLACEFILELIB_H diff --git a/kfilereplace/kfilereplacepart.cpp b/kfilereplace/kfilereplacepart.cpp deleted file mode 100644 index ed01399a..00000000 --- a/kfilereplace/kfilereplacepart.cpp +++ /dev/null @@ -1,1679 +0,0 @@ -// -// -// C++ Implementation: kfilereplacepart -// -// Description: -// -// -// Author: Andras Mantia , (C) 2003 -// Maintainer: Emiliano Gulmini , (C) 2004 -// -// Copyright: GPL v2. See COPYING file that comes with this distribution -// -// - -// QT -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// local -#include "kfilereplacelib.h" -#include "kfilereplacepart.h" -#include "kfilereplaceview.h" -#include "koptionsdlg.h" -#include "knewprojectdlg.h" -#include "report.h" -#include "commandengine.h" -#include "whatthis.h" - -using namespace whatthisNameSpace; - -//PUBLIC CONSTRUCTORS -// Factory code for KDE 3 -typedef KParts::GenericFactory FileReplaceFactory; - -K_EXPORT_COMPONENT_FACTORY( libkfilereplacepart, FileReplaceFactory ) - -KFileReplacePart::KFileReplacePart(TQWidget* parentWidget, const char* , TQObject* parent, const char* name, const TQStringList & ) : KParts::ReadOnlyPart(parent,name) -{ - setInstance(FileReplaceFactory::instance()); - TDEGlobal::locale()->insertCatalogue("kfilereplace"); - m_parentWidget = parentWidget; - m_config = new TDEConfig("kfilereplacerc"); - m_aboutDlg = 0; - m_stop = false; - m_optionMask = TQDir::Files; - m_w = widget(); - m_option = 0; - - loadOptionsFromRC(); - initView(); - initGUI(); - - whatsThis(); -} - -KFileReplacePart::~KFileReplacePart() -{ - m_view = 0; //it's already deleted, so set it to NULL - - saveOptionsToRC(); - - delete m_aboutDlg; - m_aboutDlg = 0; - delete m_config; - m_config = 0; - delete m_w; - m_w = 0; - delete m_option; -} - -//PRIVATE SLOTS -void KFileReplacePart::slotSetNewParameters() -{ - launchNewProjectDialog(KURL()); - m_view->changeView(m_option->m_searchingOnlyMode); - emit setStatusBarText(i18n("Ready.")); -} - -void KFileReplacePart::slotSearchingOperation() -{ - if(!checkBeforeOperation()) - return; - - KListView* rv = m_view->getResultsView(); - - rv->clear(); - - rv->setSorting(-1); - - // show wait cursor - TQApplication::setOverrideCursor( TQt::waitCursor ); - - freezeActions(); - - setOptionMask(); - - TQString currentDirectory = m_option->m_directories[0], - currentFilter = m_option->m_filters[0]; - - //m_currentDir = currentDirectory; - - m_view->showSemaphore("red"); - - uint filesNumber = 0; - - if(m_option->m_recursive) - recursiveFileSearch(currentDirectory, currentFilter, filesNumber); - else - fileSearch(currentDirectory, currentFilter); - - m_view->showSemaphore("yellow"); - - kapp->processEvents(); - - //disabling and enabling sorting... don't ask me why, but it works! - rv->setSorting(0); - rv->sort(); - rv->setSorting(-1); - - // restore false status for stop button - m_stop = false; - - TQApplication::restoreOverrideCursor(); - - emit setStatusBarText(i18n("Search completed.")); - - m_option->m_searchingOnlyMode = true; - - resetActions(); - - m_searchingOperation = true; - - m_view->showSemaphore("green"); -} - -void KFileReplacePart::slotReplacingOperation() -{ - if (KMessageBox::warningContinueCancel(m_w, i18n("You have selected %1 as the encoding of the files.
Selecting the correct encoding is very important as if you have files that have some other encoding than the selected one, after a replace you may damage those files.

In case you do not know the encoding of your files, select utf8 and enable the creation of backup files. This setting will autodetect utf8 and utf16 files, but the changed files will be converted to utf8.
").arg(m_option->m_encoding), i18n("File Encoding Warning"), KStdGuiItem::cont(), "ShowEncodingWarning") == KMessageBox::Cancel) - return; - if(!checkBeforeOperation()) - return; - - KListView* rv = m_view->getResultsView(); - - if(m_option->m_simulation) - { - emit setStatusBarText(i18n("Replacing files (simulation)...")); - rv->setColumnText(4,i18n("Replaced strings (simulation)")); - } - else - { - emit setStatusBarText(i18n("Replacing files...")); - rv->setColumnText(4,i18n("Replaced strings")); - } - // show wait cursor - TQApplication::setOverrideCursor( TQt::waitCursor ); - - freezeActions(); - - setOptionMask(); - - rv->setSorting(-1); - - m_view->showSemaphore("green"); - - TQString currentDirectory = m_option->m_directories[0]; - - m_view->showSemaphore("red"); - - if(m_option->m_recursive) - { - int filesNumber = 0; - recursiveFileReplace(currentDirectory, filesNumber); - } - else - { - fileReplace(); - } - - rv->setSorting(0); - rv->sort(); - rv->setSorting(-1); - - // restore false status for stop button - m_stop = false; - - TQApplication::restoreOverrideCursor(); - - m_option->m_searchingOnlyMode = false; - - resetActions(); - - m_searchingOperation = false; - - m_view->showSemaphore("green"); -} - -void KFileReplacePart::slotSimulatingOperation() -{ - m_option->m_simulation = true; - slotReplacingOperation(); - m_option->m_simulation = false; -} - -void KFileReplacePart::slotStop() -{ - emit setStatusBarText(i18n("Stopping...")); - m_stop = true; - TQApplication::restoreOverrideCursor(); - resetActions(); -} - -void KFileReplacePart::slotCreateReport() -{ - // Check there are results - KListView* rv = m_view->getResultsView(), - * sv = m_view->getStringsView(); - - if(rv->firstChild() == 0) - { - KMessageBox::error(m_w, i18n("There are no results to save: the result list is empty.")); - return ; - } - // Select the file where results will be saved - TQString documentName = KFileDialog::getSaveFileName(TQString(), "*.xml|XML " + i18n("Files") + " (*.xml)", m_w, i18n("Save Report")); - if (documentName.isEmpty()) - return ; - - // delete a spourious extension - documentName.truncate(documentName.length()-4); - - TQFileInfo fileInfo(documentName); - if(fileInfo.exists()) - { - KMessageBox::error(m_w, i18n("A folder or a file named %1 already exists.").arg(documentName)); - return ; - } - - TQDir directoryName; - - if(!directoryName.mkdir(documentName, true)) - { - KMessageBox::error(m_w, i18n("Cannot create the %1 folder.").arg(documentName)); - return ; - } - - directoryName.cd(documentName); - - TQString documentPath = documentName+"/"+directoryName.dirName(); - - Report report(m_option, rv, sv); - report.createDocument(documentPath); - - //resetActions(); -} - -void KFileReplacePart::slotStringsAdd() -{ - m_view->slotStringsAdd(); - resetActions(); -} - -void KFileReplacePart::slotQuickStringsAdd() -{ - //this slot handles a pair of strings that come from project dialog, - //if the control character 'N' is found at the position 0 of the two strings, - //then we start the search now. - TQString qs = m_option->m_quickSearchString; - TQStringList map; - - map.append(qs.left(1)); - map.append(qs.right(qs.length()-1)); - //in this case there is no string to search for, so return - if(map[1].isEmpty()) - return; - - //in this one instead, we must search for a string - qs = m_option->m_quickReplaceString; - map.append(qs.left(1)); - map.append(qs.right(qs.length()-1)); - - m_view->updateOptions(m_option); - - m_view->slotQuickStringsAdd(map[1],map[3]); - - //if search-only mode == true and search-now mode == true then - //search string - if(map[0] == "N") - if(m_option->m_searchingOnlyMode) - slotSearchingOperation(); - else - slotReplacingOperation(); -} - -void KFileReplacePart::slotStringsDeleteItem() -{ - m_view->slotStringsDeleteItem(); - resetActions(); -} - -void KFileReplacePart::slotStringsEmpty() -{ - m_view->slotStringsEmpty(); - resetActions(); -} - -void KFileReplacePart::slotStringsEdit() -{ - m_view->slotStringsEdit(); - resetActions(); -} - -void KFileReplacePart::slotStringsSave() -{ - m_view->slotStringsSave(); -} - -void KFileReplacePart::slotStringsLoad() -{ - // Selects the file to load from - TQString menu = "*.kfr|" + i18n("KFileReplace strings") + " (*.kfr)\n*|"+i18n("All Files") + " (*)"; - TQString fileName = KFileDialog::getOpenFileName(TQString(), menu, m_w, i18n("Load Strings From File")); - - if(!fileName.isEmpty()) - loadRulesFile(fileName); - - resetActions(); -} - -void KFileReplacePart::slotStringsInvertCur() -{ - m_view->stringsInvert(false); - resetActions(); -} - -void KFileReplacePart::slotStringsInvertAll() -{ - m_view->stringsInvert(true); - resetActions(); -} - -void KFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile) -{ - TQString fileName; - - // Downloads file if need (if url is "http://...") - if (!(TDEIO::NetAccess::download(urlFile, fileName, 0))) - return; - - // Checks it's not a directory - TQFileInfo fileInfo; - fileInfo.setFile(fileName); - if(fileInfo.isDir()) - { - KMessageBox::error(m_w, i18n("Cannot open folders.")); - return; - } - - loadRulesFile(fileName); - resetActions(); -} - -void KFileReplacePart::slotOptionRecursive() -{ - m_option->m_recursive = !m_option->m_recursive; - resetActions(); -} - -void KFileReplacePart::slotOptionBackup() -{ - m_option->m_backup = !m_option->m_backup; - resetActions(); -} - -void KFileReplacePart::slotOptionCaseSensitive() -{ - m_option->m_caseSensitive = !m_option->m_caseSensitive; - resetActions(); -} - -void KFileReplacePart::slotOptionVariables() -{ - m_option->m_variables = !m_option->m_variables; - resetActions(); -} - -void KFileReplacePart::slotOptionRegularExpressions() -{ - m_option->m_regularExpressions = !m_option->m_regularExpressions; - resetActions(); -} - -void KFileReplacePart::slotOptionPreferences() -{ - KOptionsDlg dlg(m_option, m_w, 0); - - if(!dlg.exec()) - return; - - //updating m_view - m_view->updateOptions(m_option); - - resetActions(); -} - -void KFileReplacePart::showAboutApplication() -{ - m_aboutDlg = new KAboutApplication(createAboutData(), (TQWidget *)0, (const char *)0, false); - if(m_aboutDlg == 0) - return; - - if(!m_aboutDlg->isVisible()) - m_aboutDlg->show(); - else - m_aboutDlg->raise(); -} - -void KFileReplacePart::appHelpActivated() -{ - kapp->invokeHelp(TQString(), "kfilereplace"); -} - -void KFileReplacePart::reportBug() -{ - KBugReport dlg(m_w, true, createAboutData()); - dlg.exec(); -} - -void KFileReplacePart::resetActions() -{ - KListView* rv = m_view->getResultsView(), - * sv = m_view->getStringsView(); - - bool hasItems = (sv->firstChild() != 0), - searchOnlyMode = m_option->m_searchingOnlyMode; - - // File - actionCollection()->action("new_project")->setEnabled(true); - actionCollection()->action("search")->setEnabled(hasItems && searchOnlyMode); - actionCollection()->action("file_simulate")->setEnabled(hasItems && !searchOnlyMode); - actionCollection()->action("replace")->setEnabled(hasItems && !searchOnlyMode); - actionCollection()->action("save_results")->setEnabled(hasItems); - actionCollection()->action("stop")->setEnabled(false); - - // Strings - actionCollection()->action("strings_add")->setEnabled(true); - actionCollection()->action("strings_del")->setEnabled(hasItems); - actionCollection()->action("strings_empty")->setEnabled(hasItems); - actionCollection()->action("strings_edit")->setEnabled(hasItems); - actionCollection()->action("strings_save")->setEnabled(hasItems); - actionCollection()->action("strings_load")->setEnabled(true); - actionCollection()->action("strings_invert")->setEnabled(hasItems && !searchOnlyMode); - actionCollection()->action("strings_invert_all")->setEnabled(hasItems && !searchOnlyMode); - - // Options - actionCollection()->action("options_recursive")->setEnabled(true); - actionCollection()->action("options_backup")->setEnabled(!searchOnlyMode); - actionCollection()->action("options_case")->setEnabled(true); - actionCollection()->action("options_var")->setEnabled(!searchOnlyMode); - actionCollection()->action("options_regularexpressions")->setEnabled(true); - actionCollection()->action("configure_kfilereplace")->setEnabled(true); - - hasItems = (rv->firstChild() != 0); - - // Results - actionCollection()->action("results_infos")->setEnabled(hasItems); - actionCollection()->action("results_openfile")->setEnabled(hasItems); - if (actionCollection()->action("results_editfile")) - actionCollection()->action("results_editfile")->setEnabled(hasItems); - actionCollection()->action("results_opendir")->setEnabled(hasItems); - actionCollection()->action("results_delete")->setEnabled(hasItems); - actionCollection()->action("results_treeexpand")->setEnabled(hasItems); - actionCollection()->action("results_treereduce")->setEnabled(hasItems); - - // Updates menus and toolbar - ((KToggleAction* ) actionCollection()->action("options_recursive"))->setChecked(m_option->m_recursive); - ((KToggleAction* ) actionCollection()->action("options_backup"))->setChecked(m_option->m_backup && !searchOnlyMode); - ((KToggleAction* ) actionCollection()->action("options_case"))->setChecked(m_option->m_caseSensitive); - ((KToggleAction* ) actionCollection()->action("options_var"))->setChecked(m_option->m_variables && !searchOnlyMode); - ((KToggleAction* ) actionCollection()->action("options_regularexpressions"))->setChecked(m_option->m_regularExpressions); -} - -//PUBLIC METHODS -TDEAboutData* KFileReplacePart::createAboutData() -{ - TDEAboutData * aboutData = new TDEAboutData("kfilereplacepart", - I18N_NOOP("KFileReplacePart"), - KFR_VERSION, - I18N_NOOP( "Batch search and replace tool."), - TDEAboutData::License_GPL_V2, - "(C) 1999-2002 Fran�is Dupoux\n(C) 2003-2004 Andras Mantia\n(C) 2004 Emiliano Gulmini", I18N_NOOP("Part of the KDEWebDev module."), "http://www.tdewebdev.org"); - aboutData->addAuthor("Fran�is Dupoux", - I18N_NOOP("Original author of the KFileReplace tool"), - "dupoux@dupoux.com"); - aboutData->addAuthor("Emiliano Gulmini", - I18N_NOOP("Current maintainer, code cleaner and rewriter"), - "emi_barbarossa@yahoo.it"); - aboutData->addAuthor("Andras Mantia", - I18N_NOOP("Co-maintainer, KPart creator"), - "amantia@kde.org"); - aboutData->addCredit("Heiko Goller", - I18N_NOOP("Original german translator"), - "heiko.goller@tuebingen.mpg.de"); - return aboutData; -} - -//PROTECTED METHODS -bool KFileReplacePart::openURL(const KURL &url) -{ - if(!url.isEmpty() && (url.protocol() != "file")) - { - KMessageBox::sorry(m_w, i18n("Sorry, currently the KFileReplace part works only for local files."), i18n("Non Local File")); - emit canceled(""); - return false; - } - if(!url.isEmpty()) - return launchNewProjectDialog(url); - else - { - resetActions(); - return true; - } -} - -//PRIVATE METHODS -void KFileReplacePart::initGUI() -{ - setXMLFile("kfilereplacepartui.rc"); - - actionCollection()->setHighlightingEnabled(true); - - DCOPClient *client = kapp->dcopClient(); - QCStringList appList = client->registeredApplications(); - bool quantaFound = false; - for(QCStringList::Iterator it = appList.begin(); it != appList.end(); ++it) - { - if((*it).left(6) == "quanta") - { - quantaFound = true; - break; - } - } - // File - (void)new KAction(i18n("Customize Search/Replace Session..."), "projectopen", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSetNewParameters()), actionCollection(), "new_project"); - (void)new KAction(i18n("&Search"), "filesearch", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSearchingOperation()), actionCollection(), "search"); - (void)new KAction(i18n("S&imulate"), "filesimulate", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSimulatingOperation()), actionCollection(), "file_simulate"); - (void)new KAction(i18n("&Replace"), "filereplace", 0, TQT_TQOBJECT(this), TQT_SLOT(slotReplacingOperation()), actionCollection(), "replace"); - (void)new KAction(i18n("Sto&p"), "stop", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStop()), actionCollection(), "stop"); - (void)new KAction(i18n("Cre&ate Report File..."), "filesaveas", 0, TQT_TQOBJECT(this), TQT_SLOT(slotCreateReport()), actionCollection(), "save_results"); - - // Strings - (void)new KAction(i18n("&Add String..."), "editadd", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsAdd()), actionCollection(), "strings_add"); - - (void)new KAction(i18n("&Delete String"), "editremove", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del"); - (void)new KAction(i18n("&Empty Strings List"), "editdelete", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEmpty()), actionCollection(), "strings_empty"); - (void)new KAction(i18n("Edit Selected String..."), "edit", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEdit()), actionCollection(), "strings_edit"); - (void)new KAction(i18n("&Save Strings List to File..."), "filesaveas", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsSave()), actionCollection(), "strings_save"); - (void)new KAction(i18n("&Load Strings List From File..."), "unsortedList", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsLoad()), actionCollection(), "strings_load"); - (void)new KRecentFilesAction(i18n("&Load Recent Strings Files"), "fileopen", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOpenRecentStringFile(const KURL&)), actionCollection(),"strings_load_recent"); - (void)new KAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert"); - (void)new KAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all"); - - // Options - (void)new KToggleAction(i18n("&Include Sub-Folders"), "recursive_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionRecursive()), actionCollection(), "options_recursive"); - (void)new KToggleAction(i18n("Create &Backup Files"), "backup_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionBackup()), actionCollection(), "options_backup"); - (void)new KToggleAction(i18n("Case &Sensitive"), "casesensitive_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionCaseSensitive()), actionCollection(), "options_case"); - (void)new KToggleAction(i18n("Enable Commands &in Replace String: [$command:option$]"), "command_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionVariables()), actionCollection(), "options_var"); - (void)new KToggleAction(i18n("Enable &Regular Expressions"), "regularexpression_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionRegularExpressions()), actionCollection(), "options_regularexpressions"); - (void)new KAction(i18n("Configure &KFileReplace..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionPreferences()), actionCollection(), "configure_kfilereplace"); - - // Results - (void)new KAction(i18n("&Properties"), "informations", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultProperties()), actionCollection(), "results_infos"); - (void)new KAction(i18n("&Open"), "filenew", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile"); - - if(quantaFound) - { - (void)new KAction(i18n("&Edit in Quanta"), "quanta", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile"); - } - (void)new KAction(i18n("Open Parent &Folder"), "fileopen", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir"); - (void)new KAction(i18n("&Delete"), "editdelete", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDelete()), actionCollection(), "results_delete"); - (void)new KAction(i18n("E&xpand Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand"); - (void)new KAction(i18n("&Reduce Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce"); - (void)new KAction(i18n("&About KFileReplace"), "kfilereplace", 0, TQT_TQOBJECT(this), TQT_SLOT(showAboutApplication()), actionCollection(), "help_about_kfilereplace"); - (void)new KAction(i18n("KFileReplace &Handbook"), "help", 0, TQT_TQOBJECT(this), TQT_SLOT(appHelpActivated()), actionCollection(), "help_kfilereplace"); - (void)new KAction(i18n("&Report Bug"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(reportBug()), actionCollection(), "report_bug"); - -} - -void KFileReplacePart::initView() -{ - m_view = new KFileReplaceView(m_option, m_parentWidget, "view"); - - setWidget(m_view); - - m_view->setAcceptDrops(false); - - m_view->showSemaphore("green"); -} - -void KFileReplacePart::freezeActions() -{ - //Disables actions during search/replace operation - actionCollection()->action("new_project")->setEnabled(false); - actionCollection()->action("stop")->setEnabled(true); - - actionCollection()->action("file_simulate")->setEnabled(false); - actionCollection()->action("replace")->setEnabled(false); - actionCollection()->action("search")->setEnabled(false); - actionCollection()->action("strings_add")->setEnabled(false); - actionCollection()->action("strings_del")->setEnabled(false); - actionCollection()->action("strings_empty")->setEnabled(false); - actionCollection()->action("strings_edit")->setEnabled(false); - actionCollection()->action("strings_save")->setEnabled(false); - actionCollection()->action("strings_load")->setEnabled(false); - actionCollection()->action("strings_invert")->setEnabled(false); - actionCollection()->action("strings_invert_all")->setEnabled(false); - actionCollection()->action("options_recursive")->setEnabled(false); - actionCollection()->action("options_backup")->setEnabled(false); - actionCollection()->action("options_case")->setEnabled(false); - actionCollection()->action("options_var")->setEnabled(false); - actionCollection()->action("options_regularexpressions")->setEnabled(false); - actionCollection()->action("configure_kfilereplace")->setEnabled(false); - actionCollection()->action("results_infos")->setEnabled(false); - actionCollection()->action("results_openfile")->setEnabled(false); - if (actionCollection()->action("results_editfile")) - actionCollection()->action("results_editfile")->setEnabled(false); - actionCollection()->action("results_opendir")->setEnabled(false); - actionCollection()->action("results_delete")->setEnabled(false); - actionCollection()->action("results_treeexpand")->setEnabled(false); - actionCollection()->action("results_treereduce")->setEnabled(false); - ((KToggleAction* ) actionCollection()->action("options_recursive"))->setChecked(false); - ((KToggleAction* ) actionCollection()->action("options_backup"))->setChecked(false); - ((KToggleAction* ) actionCollection()->action("options_case"))->setChecked(false); - ((KToggleAction* ) actionCollection()->action("options_var"))->setChecked(false); - ((KToggleAction* ) actionCollection()->action("options_regularexpressions"))->setChecked(false); -} - -void KFileReplacePart::loadOptionsFromRC() -{ - m_option = new RCOptions(); - - loadOptions(); - loadFileSizeOptions(); - loadDateAccessOptions(); - loadOwnerOptions(); - loadLocationsList(); - loadFiltersList(); - loadBackupExtensionOptions(); -} - -void KFileReplacePart::loadOptions() -{ - m_config->setGroup("General Options"); - - m_option->m_recentStringFileList = m_config->readListEntry(rcRecentFiles); - - m_option->m_searchingOnlyMode = m_config->readBoolEntry(rcSearchMode,SearchModeOption); - - m_config->setGroup("Options"); - - m_option->m_encoding = m_config->readEntry(rcEncoding, EncodingOption); - m_option->m_recursive = m_config->readBoolEntry(rcRecursive, RecursiveOption); - - m_option->m_caseSensitive = m_config->readBoolEntry(rcCaseSensitive, CaseSensitiveOption); - m_option->m_variables = m_config->readBoolEntry(rcVariables, VariablesOption); - m_option->m_regularExpressions = m_config->readBoolEntry(rcRegularExpressions, RegularExpressionsOption); - m_option->m_followSymLinks = m_config->readBoolEntry(rcFollowSymLinks, FollowSymbolicLinksOption); - - m_option->m_haltOnFirstOccur = m_config->readBoolEntry(rcHaltOnFirstOccur, StopWhenFirstOccurenceOption); - - m_option->m_ignoreHidden = m_config->readBoolEntry(rcIgnoreHidden, IgnoreHiddenOption); - m_option->m_ignoreFiles = m_config->readBoolEntry(rcIgnoreFiles, IgnoreFilesOption); - - m_config->setGroup("Notification Messages"); - - m_option->m_notifyOnErrors = m_config->readBoolEntry(rcNotifyOnErrors, true); - - m_option->m_askConfirmReplace = m_config->readBoolEntry(rcAskConfirmReplace, AskConfirmReplaceOption); - - TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); - - if(dontAskAgain == "yes") - m_option->m_askConfirmReplace = false; -} - -void KFileReplacePart::loadFileSizeOptions() -{ - m_config->setGroup("Size options"); - - m_option->m_minSize = m_config->readNumEntry(rcMinFileSize, FileSizeOption); - m_option->m_maxSize = m_config->readNumEntry(rcMaxFileSize, FileSizeOption); -} - -void KFileReplacePart::loadDateAccessOptions() -{ - m_config->setGroup("Access options"); - - m_option->m_dateAccess = m_config->readEntry(rcValidAccessDate, ValidAccessDateOption); - m_option->m_minDate = m_config->readEntry(rcMinDate, AccessDateOption); - m_option->m_maxDate = m_config->readEntry(rcMaxDate, AccessDateOption); -} - -void KFileReplacePart::loadOwnerOptions() -{ - m_config->setGroup("Owner options"); - - TQStringList ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerUser, OwnerOption),true); - if(ownerList[0] == "true") - m_option->m_ownerUserIsChecked = true; - else - m_option->m_ownerUserIsChecked = false; - - m_option->m_ownerUserType = ownerList[1]; - m_option->m_ownerUserBool = ownerList[2]; - m_option->m_ownerUserValue = ownerList[3]; - - ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerGroup, OwnerOption),true); - - if(ownerList[0] == "true") - m_option->m_ownerGroupIsChecked = true; - else - m_option->m_ownerGroupIsChecked = false; - - m_option->m_ownerGroupType = ownerList[1]; - m_option->m_ownerGroupBool = ownerList[2]; - m_option->m_ownerGroupValue = ownerList[3]; -} - -void KFileReplacePart::loadLocationsList() -{ - m_config->setGroup("Directories"); - TQStringList locationsEntryList; - #if KDE_IS_VERSION(3,1,3) - locationsEntryList = m_config->readPathListEntry(rcDirectoriesList); - #else - locationsEntryList = m_config->readListEntry(rcDirectoriesList); - #endif - - if(locationsEntryList.isEmpty()) - locationsEntryList.append(TQDir::current().path()); - - m_option->m_directories = locationsEntryList; -} - -void KFileReplacePart::loadFiltersList() -{ - TQStringList filtersEntryList; - - m_config->setGroup("Filters"); - #if KDE_IS_VERSION(3,1,3) - filtersEntryList = m_config->readPathListEntry(rcFiltersList); - #else - filtersEntryList = m_config->readListEntry(rcFiltersList); - #endif - - if(filtersEntryList.isEmpty()) - filtersEntryList.append("*.htm;*.html;*.xml;*.xhtml;*.css;*.js;*.php"); - - m_option->m_filters = filtersEntryList; -} - -void KFileReplacePart::loadBackupExtensionOptions() -{ - m_config->setGroup("Options"); - TQStringList bkList = TQStringList::split(',', - m_config->readEntry(rcBackupExtension, BackupExtensionOption), - true); - if(bkList[0] == "true") - m_option->m_backup = true; - else - m_option->m_backup = false; - - m_option->m_backupExtension = bkList[1]; -} - -void KFileReplacePart::saveOptionsToRC() -{ - saveOptions(); - saveFileSizeOptions(); - saveDateAccessOptions(); - saveOwnerOptions(); - saveLocationsList(); - saveFiltersList(); - saveBackupExtensionOptions(); -} - -void KFileReplacePart::saveOptions() -{ - m_config->setGroup("General Options"); - - m_config->writeEntry(rcRecentFiles, m_option->m_recentStringFileList); - m_config->writeEntry(rcSearchMode,m_option->m_searchingOnlyMode); - - m_config->setGroup("Options"); - - m_config->writeEntry(rcEncoding, m_option->m_encoding); - m_config->writeEntry(rcRecursive, m_option->m_recursive); - m_config->writeEntry(rcCaseSensitive, m_option->m_caseSensitive); - m_config->writeEntry(rcVariables, m_option->m_variables); - m_config->writeEntry(rcRegularExpressions, m_option->m_regularExpressions); - - m_config->writeEntry(rcFollowSymLinks, m_option->m_followSymLinks); - m_config->writeEntry(rcHaltOnFirstOccur, m_option->m_haltOnFirstOccur); - - m_config->writeEntry(rcIgnoreHidden, m_option->m_ignoreHidden); - m_config->writeEntry(rcIgnoreFiles, m_option->m_ignoreFiles); - - m_config->setGroup("Notification Messages"); - m_config->writeEntry(rcNotifyOnErrors, m_option->m_notifyOnErrors); - if(m_config->readEntry(rcDontAskAgain,"no") == "yes") - m_config->writeEntry(rcAskConfirmReplace, false); - else - m_config->writeEntry(rcAskConfirmReplace, m_option->m_askConfirmReplace); - - m_config->sync(); -} - -void KFileReplacePart::saveFileSizeOptions() -{ - m_config->setGroup("Size options"); - - m_config->writeEntry(rcMaxFileSize, m_option->m_maxSize); - m_config->writeEntry(rcMinFileSize, m_option->m_minSize); - - m_config->sync(); -} - -void KFileReplacePart::saveDateAccessOptions() -{ - m_config->setGroup("Access options"); - - m_config->writeEntry(rcValidAccessDate, m_option->m_dateAccess); - m_config->writeEntry(rcMinDate, m_option->m_minDate); - m_config->writeEntry(rcMaxDate, m_option->m_maxDate); - - m_config->sync(); -} - -void KFileReplacePart::saveOwnerOptions() -{ - m_config->setGroup("Owner options"); - - TQString list; - if(m_option->m_ownerUserIsChecked) - list = "true,"; - else - list = "false,"; - - list += m_option->m_ownerUserType + - "," + - m_option->m_ownerUserBool; - if(!m_option->m_ownerUserValue.isEmpty()) - list += "," + m_option->m_ownerUserValue; - - m_config->writeEntry(rcOwnerUser,list); - - if(m_option->m_ownerGroupIsChecked) - list = "true,"; - else - list = "false,"; - - list += m_option->m_ownerGroupType + - "," + - m_option->m_ownerGroupBool; - if(!m_option->m_ownerGroupValue.isEmpty()) - list += "," + m_option->m_ownerGroupValue; - - m_config->writeEntry(rcOwnerGroup,list); - m_config->sync(); -} - -void KFileReplacePart::saveLocationsList() -{ - m_config->setGroup("Directories"); - #if KDE_IS_VERSION(3,1,3) - m_config->writePathEntry(rcDirectoriesList, m_option->m_directories); - #else - m_config->writeEntry(rcDirectoriesList, m_option->m_directories); - #endif - m_config->sync(); -} - -void KFileReplacePart::saveFiltersList() -{ - m_config->setGroup("Filters"); - m_config->writeEntry(rcFiltersList, m_option->m_filters); - m_config->sync(); -} - -void KFileReplacePart::saveBackupExtensionOptions() -{ - m_config->setGroup("Options"); - TQString bkOptions; - if(m_option->m_backup) - bkOptions = "true," + m_option->m_backupExtension; - else - bkOptions = "false," + m_option->m_backupExtension; - - m_config->writeEntry(rcBackupExtension, bkOptions); - m_config->sync(); -} - -void KFileReplacePart::fileReplace() -{ - TQString directoryName = m_option->m_directories[0]; - TQDir d(directoryName); - d.setMatchAllDirs(true); - d.setFilter(m_optionMask); - - TQString currentFilter = m_option->m_filters[0]; - TQStringList filesList = d.entryList(currentFilter); - TQStringList::iterator filesIt; - int filesNumber = 0; - - m_view->displayScannedFiles(filesNumber); - - for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt) - { - TQString fileName = (*filesIt); - - // m_stop == true means that we pushed the stop button - if(m_stop) - break; - - // Avoids files that not match requirements - if(!KFileReplaceLib::isAnAccessibleFile(d.canonicalPath(), fileName, m_option)) - continue; - kapp->processEvents(); - if(m_option->m_backup) - replaceAndBackup(d.canonicalPath(), fileName); - else - replaceAndOverwrite(d.canonicalPath(), fileName); - - filesNumber++; - m_view->displayScannedFiles(filesNumber); - } -} - -void KFileReplacePart::recursiveFileReplace(const TQString& directoryName, int& filesNumber) -{ - //if m_stop == true then interrupts recursion - if(m_stop) - return; - else - { - TQDir d(directoryName); - - d.setMatchAllDirs(true); - d.setFilter(m_optionMask); - - TQString currentFilter = m_option->m_filters[0]; - TQStringList filesList = d.entryList(currentFilter); - TQStringList::iterator filesIt; - - for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) - { - //if m_stop == true then end for-loop - if(m_stop) - break; - - TQString fileName = (*filesIt); - - // Avoids files that not match requirements - if(!KFileReplaceLib::isAnAccessibleFile(d.canonicalPath(),fileName, m_option)) - continue; - - TQString filePath = d.canonicalPath()+"/"+fileName; - - TQFileInfo qi(filePath); - - m_view->displayScannedFiles(filesNumber); - - //if filePath is a directory then recursion - if(qi.isDir()) - recursiveFileReplace(filePath, filesNumber); - else - { - kapp->processEvents(); - if(m_option->m_backup) - replaceAndBackup(d.canonicalPath(), fileName); - else - replaceAndOverwrite(d.canonicalPath(), fileName); - - filesNumber++; - m_view->displayScannedFiles(filesNumber); - } - } - } -} - -void KFileReplacePart::replaceAndBackup(const TQString& currentDir, const TQString& oldFileName) -{ - //Creates a path string - TQString oldPathString = currentDir+"/"+oldFileName; - - TQFile currentFile(oldPathString); - if(!currentFile.open(IO_ReadOnly)) - { - KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(oldFileName),TQString(), rcNotifyOnErrors); - return ; - } - TQTextStream currentStream(¤tFile); - if (m_option->m_encoding == "utf8") - currentStream.setEncoding(TQTextStream::UnicodeUTF8); - else - currentStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); - TQString line = currentStream.read(), - backupLine = line; - - TQString backupSize = KFileReplaceLib::formatFileSize(currentFile.size()); - - currentFile.close(); - - TQString backupExtension = m_option->m_backupExtension; - - bool atLeastOneStringFound = false; - KListViewItem *item = 0; - int occurrence = 0; - - replacingLoop(line, &item, atLeastOneStringFound, occurrence, m_option->m_regularExpressions, m_option->m_askConfirmReplace); - - //If we are not performing a simulation creates a backup file - if(!m_option->m_simulation) - { - if(atLeastOneStringFound) - { - TDEIO::NetAccess::file_copy(KURL::fromPathOrURL(oldPathString), KURL::fromPathOrURL(oldPathString + backupExtension), -1, true); - } - } - - if(!m_option->m_simulation) - { - if(atLeastOneStringFound) - { - TQFile newFile(oldPathString); - if(!newFile.open(IO_WriteOnly)) - { - KMessageBox::information(m_w, i18n("Cannot open file %1 for writing.").arg(oldFileName),TQString(), rcNotifyOnErrors); - return ; - } - TQTextStream newStream(&newFile); - if (m_option->m_encoding == "utf8") - newStream.setEncoding(TQTextStream::UnicodeUTF8); - else - newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); - newStream << line; - newFile.close(); - } - } - - if(!m_option->m_ignoreFiles) - atLeastOneStringFound = true; - - TQFileInfo oldFileInfo(oldPathString); - - if(atLeastOneStringFound && item/* && atLeastOneStringConfirmed*/) - { - KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+oldFileName); - item->setText(0,oldFileName); - item->setText(1,currentDir); - TQString newSize = KFileReplaceLib::formatFileSize(oldFileInfo.size()); - if(!m_option->m_simulation) - { - item->setText(2, backupSize); - item->setText(3, newSize); - } - else - { - item->setText(2, backupSize); - item->setText(3, "-"); - } - - item->setText(4,TQString::number(occurrence,10)); - item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); - item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); - } -} - -void KFileReplacePart::replaceAndOverwrite(const TQString& currentDir, const TQString& oldFileName) -{ - TQString oldPathString = currentDir+"/"+oldFileName; - TQFile oldFile(oldPathString); - TQFileInfo oldFileInfo(oldPathString); - - if (!oldFile.open(IO_ReadOnly)) - { - KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(oldFile.name()),TQString(), rcNotifyOnErrors); - return ; - } - - TQString fileSizeBeforeReplacing = KFileReplaceLib::formatFileSize(oldFileInfo.size()); - KListViewItem *item = 0; - - TQTextStream oldStream( &oldFile ); - if (m_option->m_encoding == "utf8") - oldStream.setEncoding(TQTextStream::UnicodeUTF8); - else - oldStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); - TQString line = oldStream.read(); - - oldFile.close(); - - bool atLeastOneStringFound = false; - int occurrence = 0; - - replacingLoop(line, &item, atLeastOneStringFound, occurrence, m_option->m_regularExpressions, m_option->m_askConfirmReplace); - - - if(!m_option->m_simulation) - { - if(atLeastOneStringFound) - { - TQFile newFile(oldPathString); - if(!newFile.open(IO_WriteOnly)) - { - KMessageBox::information(m_w, i18n("Cannot open file %1 for writing.").arg(newFile.name()),TQString(), rcNotifyOnErrors); - return ; - } - TQTextStream newStream( &newFile ); - if (m_option->m_encoding == "utf8") - newStream.setEncoding(TQTextStream::UnicodeUTF8); - else - newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); - newStream << line; - newFile.close(); - } - } - - TQFileInfo nf(oldPathString); - TQString fileSizeAfterReplacing = KFileReplaceLib::formatFileSize(nf.size()); - - //if ignoreFiles == false then every files must be show - if(!m_option->m_ignoreFiles) - atLeastOneStringFound = true; - - if(atLeastOneStringFound && item/*&& atLeastOneStringConfirmed*/) - { - KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+oldFileName); - item->setText(0,oldFileName); - item->setText(1,currentDir); - item->setText(2,fileSizeBeforeReplacing); - if(!m_option->m_simulation) - item->setText(3,fileSizeAfterReplacing); - else - item->setText(3,"-"); - - item->setText(4,TQString::number(occurrence,10)); - item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); - item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); - } -} - -void KFileReplacePart::replacingLoop(TQString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace) -{ - KeyValueMap tempMap = m_replacementMap; - KeyValueMap::Iterator it; - KListView* rv = m_view->getResultsView(); - - for(it = tempMap.begin(); it != tempMap.end(); ++it) - { - if(m_stop) - break; - - ResultViewEntry entry(it.key(), it.data(), regularExpression, m_option->m_caseSensitive); - while(entry.pos(line) != -1) - { - if(m_stop) - break; - - if(askConfirmReplace) - { - int answer = KMessageBox::questionYesNo(0, - i18n("Do you want to replace the string %1 with the string %2?").arg(it.key()).arg(it.data()), - i18n("Confirm Replace"), - i18n("Replace"), - i18n("Do Not Replace"), - rcDontAskAgain); - if(answer == KMessageBox::Yes) - { - atLeastOneStringFound = true; - TQString msg = entry.message(entry.capturedText(line), - entry.lineNumber(line), - entry.columnNumber(line)); - - if(!*item) - *item = new KListViewItem(rv); - KListViewItem* tempItem = new KListViewItem(*item); - tempItem->setMultiLinesEnabled(true); - tempItem->setText(0,msg); - occur ++; - entry.updateLine(line); - entry.incPos(); - } - else - { - entry.incPos(); - } - if(dontAskAgain()) askConfirmReplace = false; - } - else - { - atLeastOneStringFound = true; - TQString msg = entry.message(entry.capturedText(line), - entry.lineNumber(line), - entry.columnNumber(line)); - - if(!*item) - *item = new KListViewItem(rv); - KListViewItem* tempItem = new KListViewItem(*item); - tempItem->setMultiLinesEnabled(true); - tempItem->setText(0,msg); - occur ++; - entry.updateLine(line); - entry.incPos(); - } - - } - } -} - -void KFileReplacePart::fileSearch(const TQString& directoryName, const TQString& filters) -{ - TQDir d(directoryName); - - d.setMatchAllDirs(true); - d.setFilter(m_optionMask); - - TQStringList filesList = d.entryList(filters); - TQString filePath = d.canonicalPath(); - TQStringList::iterator filesIt; - uint filesNumber = 0; - - m_view->displayScannedFiles(filesNumber); - - for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt) - { - // We pushed stop button - if(m_stop) - break; - - TQString fileName = (*filesIt); - - // Avoids files that not match - if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) - continue; - - TQFileInfo fileInfo(filePath+"/"+fileName); - if(fileInfo.isDir()) - continue; - kapp->processEvents(); - search(filePath, fileName); - filesNumber++; - m_view->displayScannedFiles(filesNumber); - } -} - -void KFileReplacePart::recursiveFileSearch(const TQString& directoryName, const TQString& filters, uint& filesNumber) -{ - // if m_stop == true then interrupt recursion - if(m_stop) - return; - else - { - TQDir d(directoryName); - - d.setMatchAllDirs(true); - d.setFilter(m_optionMask); - - TQStringList filesList = d.entryList(filters); - TQString filePath = d.canonicalPath(); - TQStringList::iterator filesIt; - - for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) - { - // stop polling - if(m_stop) - break; - - TQString fileName = (*filesIt); - // Avoids files that not match - if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) - continue; - - // Composes file path string - TQFileInfo fileInfo(filePath+"/"+fileName); - - m_view->displayScannedFiles(filesNumber); - - // Searchs recursively if "filePath" is a directory - if(fileInfo.isDir()) - recursiveFileSearch(filePath+"/"+fileName, filters, filesNumber); - else - { - kapp->processEvents(); - search(filePath, fileName); - filesNumber++; - m_view->displayScannedFiles(filesNumber); - } - } - } -} - -void KFileReplacePart::search(const TQString& currentDir, const TQString& fileName) -{ - TQFile file(currentDir+"/"+fileName); - - if(!file.open(IO_ReadOnly)) - { - KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(fileName), TQString(), rcNotifyOnErrors); - return ; - } - // Creates a stream with the file - TQTextStream stream( &file ); - if (m_option->m_encoding == "utf8") - stream.setEncoding(TQTextStream::UnicodeUTF8); - else - stream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); - TQString line = stream.read(); - file.close(); - - TQFileInfo fileInfo(currentDir+"/"+fileName); - - KListViewItem *item = 0; - - //Counts occurrences - int occurrence = 0; - - //This map contains strings to search - KeyValueMap tempMap = m_replacementMap; - //If no strings has been found, then no lines will be added to the result view - bool atLeastOneStringFound = false; - - KeyValueMap::Iterator it = tempMap.begin(); - - KListView* rv = m_view->getResultsView(); - - while(it != tempMap.end()) - { - //stop polling - if(m_stop) - break; - - TQString key = it.key(); - TQString strKey; - TQRegExp rxKey; - - if(m_option->m_regularExpressions) - rxKey = TQRegExp("("+key+")", m_option->m_caseSensitive, false); - else - strKey = key; - /* If this option is true then for any string in - * the map we search for the first match*/ - if(m_option->m_haltOnFirstOccur) - { - int pos; - - if(m_option->m_regularExpressions) - pos = line.find(rxKey); - else - pos = line.find(strKey, 0 ,m_option->m_caseSensitive); - - if(pos != -1) - { - atLeastOneStringFound = true; - int lineNumber = line.mid(0,pos).contains('\n')+1; - int columnNumber = pos - line.findRev('\n',pos); - - if (!item) - item = new KListViewItem(rv); - - KListViewItem* tempItem= new KListViewItem(item); - TQString msg, - capturedText; - - if(m_option->m_regularExpressions) - capturedText = rxKey.cap(1); - else - capturedText = line.mid(pos,strKey.length()); - - msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); - tempItem->setMultiLinesEnabled(true); - tempItem->setText(0,msg); - occurrence = 1; - } - }// ends m_option->m_haltOnFirstOccur if-block - else - { - /* This point of the code is reached when we must search for all - * occurrences of all the strings*/ - - int pos = 0; - if(m_option->m_regularExpressions) - pos = rxKey.search(line,pos); - else - pos = line.find(strKey, pos ,m_option->m_caseSensitive); - - while(pos != -1) - { - //stop polling - if(m_stop) - break; - - atLeastOneStringFound = true; - TQString msg, - capturedText; - int lineNumber = line.mid(0,pos).contains('\n')+1; - int columnNumber = pos - line.findRev('\n',pos); - - if(m_option->m_regularExpressions) - { - capturedText = rxKey.cap(1); - pos = rxKey.search(line, pos+rxKey.matchedLength()); - } - else - { - capturedText = line.mid(pos,strKey.length()); - pos = line.find(strKey,pos+strKey.length()); - } - - msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); - - if(!item) - item = new KListViewItem(rv); - KListViewItem* tempItem = new KListViewItem(item); - tempItem->setMultiLinesEnabled(true); - tempItem->setText(0,msg); - occurrence++; - //we push stop button - if(m_stop) - break; - } - } - //Advances of one position in the strings map - ++it; - - //we push stop button - if(m_stop) - break; - } - - //if ignoreFiles == false then every files must be show - if(!m_option->m_ignoreFiles) - atLeastOneStringFound = true; - - if(atLeastOneStringFound && item) - { - KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+fileName); - item->setText(0,fileName); - item->setText(1,currentDir); - item->setText(2,KFileReplaceLib::formatFileSize(fileInfo.size())); - item->setText(3,TQString::number(occurrence,10)); - item->setText(4,TQString("%1[%2]").arg(fileInfo.owner()).arg(fileInfo.ownerId())); - item->setText(5,TQString("%1[%2]").arg(fileInfo.group()).arg(fileInfo.groupId())); - } -} - -void KFileReplacePart::loadViewContent() -{ - /* Maps the content of the strings view to a TQMap */ - KeyValueMap tempMap; - CommandEngine command; - - TQListViewItemIterator itlv(m_view->getStringsView()); - while(itlv.current()) - { - TQListViewItem *item = itlv.current(); - if(m_option->m_variables) - tempMap[item->text(0)] = command.variableValue(item->text(1)); - else - tempMap[item->text(0)] = item->text(1); - ++itlv; - } - m_replacementMap = tempMap; -} - -void KFileReplacePart::loadRulesFile(const TQString& fileName) -{ - /* Loads a file with kfr extension. - * creates a xml document and browses it*/ - TQDomDocument doc("mydocument"); - TQFile file(fileName); - KListView* sv = m_view->getStringsView(); - - if(!file.open(IO_ReadOnly)) - { - KMessageBox::error(m_w, i18n("Cannot open the file %1 and load the string list.").arg(fileName)); - return ; - } - - if(!doc.setContent(&file)) - { - file.close(); - - KMessageBox::information(m_w, i18n("File %1 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 kfilereplace.").arg(fileName),i18n("Warning")); - - KFileReplaceLib::convertOldToNewKFRFormat(fileName, sv); - - return; - } - else - file.close(); - - //clears view - sv->clear(); - - TQDomElement docElem = doc.documentElement(); - TQDomNode n = docElem.firstChild(); - TQString searchAttribute = n.toElement().attribute("search").latin1(); - - KeyValueMap docMap; - - if(searchAttribute.isNull() || searchAttribute.isEmpty()) - { - int answer = KMessageBox::warningYesNo(m_w, i18n("The format of kfr files has been changed; attempting to load %1. Please see the KFilereplace manual for details. Do you want to load a search-and-replace list of strings?").arg(fileName),i18n("Warning"),i18n("Load"),i18n("Do Not Load")); - - if(answer == KMessageBox::Yes) - searchAttribute = "false"; - else - searchAttribute = "true"; - } - //Verifies the search mode - if(searchAttribute == "true") - m_option->m_searchingOnlyMode = true; - else - m_option->m_searchingOnlyMode = false; - - //Refreshes the view appearances - m_view->changeView(m_option->m_searchingOnlyMode); - //Goes to next tag - n = n.nextSibling(); - //Reads the string list - while(!n.isNull()) - { - TQDomElement e = n.toElement(); // tries to convert the node to an element. - if(!e.isNull()) - { - TQString oldString = e.firstChild().toElement().text(), - newString = e.lastChild().toElement().text(); - docMap[oldString] = newString; - } - n = n.nextSibling(); - } - - // Adds file to "load strings form file" menu - TQStringList fileList = m_option->m_recentStringFileList; - if(!fileList.contains(fileName)) - { - fileList.append(fileName); - ((KRecentFilesAction* ) actionCollection()->action("strings_load_recent"))->setItems(fileList); - m_option->m_recentStringFileList = fileList; - } - - m_view->changeView(m_option->m_searchingOnlyMode); - - m_view->loadMap(docMap); - - //resetActions(); -} - -bool KFileReplacePart::launchNewProjectDialog(const KURL & startURL) -{ - if(!startURL.isEmpty()) - m_option->m_directories.prepend(startURL.path()); - - /* This dlg reads options from m_option, then execs, finally returns options.*/ - KNewProjectDlg dlg(m_option); - - if(!dlg.exec()) - return false; - - dlg.saveRCOptions(); - - m_config->sync(); - - slotQuickStringsAdd(); - - m_view->updateOptions(m_option); - - resetActions(); - - return true; -} - -void KFileReplacePart::setOptionMask() -{ - m_optionMask |= TQDir::Dirs; - - if(!m_option->m_ignoreHidden) - m_optionMask |= TQDir::Hidden; - - if(!m_option->m_followSymLinks) - m_optionMask |= TQDir::NoSymLinks; -} - -bool KFileReplacePart::checkBeforeOperation() -{ - loadViewContent(); - KListView* sv = m_view->getStringsView(); - - // Checks if there are strings to replace (not need in search operation) - if (sv->childCount() == 0) - { - KMessageBox::error(m_w, i18n("There are no strings to search and replace.")); - return false; - } - - // Checks if the main directory can be accessed - TQString currentDirectory = m_option->m_directories[0]; - TQDir dir; - - dir.setPath(currentDirectory); - TQString directory = dir.absPath(); - - if(!dir.exists()) - { - KMessageBox::error(m_w, i18n("The main folder of the project %1 does not exist.").arg(directory)); - return false; - } - - TQFileInfo dirInfo(directory); - if(!(dirInfo.isReadable() && dirInfo.isExecutable()) - || (!m_option->m_searchingOnlyMode && !m_option->m_simulation && !(dirInfo.isWritable()))) - { - KMessageBox::error(m_w, i18n("Access denied in the main folder of the project:
%1
").arg(directory)); - return false; - } - - // Clears the list view - m_view->getResultsView()->clear(); - - return true; -} - -bool KFileReplacePart::dontAskAgain() -{ - m_config->setGroup("Notification Messages"); - TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); - if(dontAskAgain == "yes") - return true; - else - return false; -} - -void KFileReplacePart::whatsThis() -{ - actionCollection()->action("options_backup")->setWhatsThis(optionsBackupWhatthis); - actionCollection()->action("options_case")->setWhatsThis(optionsCaseWhatthis); - actionCollection()->action("options_var")->setWhatsThis(optionsVarWhatthis); - actionCollection()->action("options_recursive")->setWhatsThis(optionsRecursiveWhatthis); - actionCollection()->action("options_regularexpressions")->setWhatsThis(optionsRegularExpressionsWhatthis); -} - -#include "kfilereplacepart.moc" diff --git a/kfilereplace/kfilereplacepart.desktop b/kfilereplace/kfilereplacepart.desktop deleted file mode 100644 index f8c01e3e..00000000 --- a/kfilereplace/kfilereplacepart.desktop +++ /dev/null @@ -1,95 +0,0 @@ -[Desktop Entry] -Type=Service -MimeType=inode/directory -Icon=kfilereplace.png -ServiceTypes=KParts/ReadOnlyPart -X-TDE-Library=libkfilereplacepart -Comment=A batch search and replace tool -Comment[bg]=Търсене и замяна във фонов режим -Comment[ca]=Una eina per a la cerca i substitució per lots -Comment[cs]=Dávkový nástroj pro hledání a nahrazování -Comment[da]=Søg- og erstat-gruppekørselsværktøj -Comment[de]=Ein Werkzeug zum Suchen und Ersetzen im Stapelbetrieb -Comment[el]= Εργαλείο πολλαπλής αναζήτησης και αντικατάστασης -Comment[es]=Una herramienta de búsqueda y reemplazo por lotes -Comment[et]=Otsimise ja asendamise tööriist -Comment[eu]=Bilaketa eta ordezkapen tresna -Comment[fa]=ابزار جستجو و جایگزینی دسته‌ای -Comment[fi]=Batchien etsintä- ja korvaustyökalu -Comment[fr]=Un outil de recherche et de remplacement de texte en série. -Comment[gl]=Unha utilidade de busca e reemprazo por lotes -Comment[hi]=एक खोज तथा बदल उपकरण -Comment[hu]=Sok fájl kezelésére alkalmas kereső- és cserélőprogram -Comment[is]=Tól til að leita að texta og skipta út -Comment[it]=Uno strumento per la ricerca e la sostituzione in sequenza -Comment[ja]=バッチ検索および置換ツール -Comment[ka]=ჯგუფური ძიების და ჩანაცვლების ხელსაწყო -Comment[lt]=Paketinis paieškos ir keitimo įrankis -Comment[ms]=Gugusan alatan cari dan ganti -Comment[nds]=En Söök- un Utwesselwarktüüch för Stapelbedrief -Comment[ne]=एउटा समूह खोजी गर्ने र बदल्ने उपकरण -Comment[nl]=Een gereedschap voor zoeken en vervangen -Comment[pl]=Narzędzie do wyszukiwania i zamiany -Comment[pt]=Uma ferramenta de procura e substituição por atacado -Comment[pt_BR]=Uma ferramenta de substituição e pesquisa batch -Comment[ru]=Пакетный поиск и замена -Comment[sk]=Dávkovací nástroj pre nájsť a zameniť -Comment[sl]=Orodje serijskega iskanja in zamenjevanja -Comment[sr]=Алат за пакетну претрагу и замену -Comment[sr@Latn]=Alat za paketnu pretragu i zamenu -Comment[sv]=Ett sök- och ersättningsverktyg -Comment[ta]=தொகுதி தேடல் மற்றும் கருவி இடமாற்றல் -Comment[tg]=Ҷустуҷӯи пакет ва ивази асбоб -Comment[tr]=Bir toplu arama ve değiştirme aracı -Comment[uk]=Засіб пакетного пошуку та заміни -Comment[zh_CN]=批量搜索替换工具 -Comment[zh_HK]=批次搜尋及取代工具 -Comment[zh_TW]=批次搜尋及取代工具 -Name=KFileReplace -Name[hi]=के-फ़ाइल-रिप्लेस -Name[ne]=बदल्ने केडीई फाइल -Name[pa]=ਕੇ-ਫਾਇਲ-ਬਦਲੋ -Name[sk]=KFile zameniť -Name[sv]=Kfilereplace -Name[ta]=Kகோப்பு இடமாற்று -Name[tg]=KФайлро ҷойгузор кардан -Name[tr]=K Dosya Değiştirme -GenericName=File Replace View -GenericName[bg]=Преглед на файловете за замяна -GenericName[ca]=Vista per a substituir fitxers -GenericName[cs]=Nahrazení souborů -GenericName[da]=Filerstatningsvisning -GenericName[de]=KFileReplace -GenericName[el]=Προβολή αντικατάστασης αρχείου -GenericName[es]=Vista de reemplazo de archivo -GenericName[et]=Failide asendamise vaade -GenericName[eu]=Fitxategi ordezkapen ikuspegia -GenericName[fa]=نمای جایگزینی پرونده -GenericName[fi]=Tiedoston korvausnäyttö -GenericName[fr]=Remplacement de fichiers -GenericName[gl]=Vista de reemprazo de ficheiro -GenericName[hu]=Fájlcserélő nézet -GenericName[is]=Texta útskiptingarsýn -GenericName[it]=Vista di sostituzione file -GenericName[ja]=ファイル置換ビュー -GenericName[ka]=ფაილის ჩანაცვლების ხედი -GenericName[lt]=Keitimų bylose vaizdas -GenericName[ms]=Paparan Ganti Fail -GenericName[nds]=Datei-Utwesselansicht -GenericName[ne]=फाइल बदल्ने दृश्य -GenericName[nl]=Weergave van bestanden vervangen -GenericName[pa]=ਫਾਇਲ ਤਬਦੀਲ ਝਲਕ -GenericName[pl]=Widok zamiany w plikach -GenericName[pt]=Vista de Substituição de Ficheiros -GenericName[pt_BR]=Visão de Substituição de Arquivos -GenericName[ru]=Средство поиска и замены в файлах -GenericName[sk]=Pohľad zámeny súboru -GenericName[sl]=Prikaz zamenjave datotek -GenericName[sr]=Приказ замена у фајловима -GenericName[sr@Latn]=Prikaz zamena u fajlovima -GenericName[sv]=Filersättningsvy -GenericName[ta]=கோப்பு இடமாற்று காட்சி -GenericName[uk]=Перегляд заміни в файлах -GenericName[zh_CN]=文件替换视图 -GenericName[zh_HK]=檔案取代檢視模式 -GenericName[zh_TW]=檔案取代檢視 diff --git a/kfilereplace/kfilereplacepart.h b/kfilereplace/kfilereplacepart.h deleted file mode 100644 index cc427153..00000000 --- a/kfilereplace/kfilereplacepart.h +++ /dev/null @@ -1,160 +0,0 @@ -// -// -// C++ Interface: kfilereplacepart -// -// Description: -// -// -// Author: Andras Mantia , (C) 2003 -// Maintainer: Emiliano Gulmini , (C) 2004 -// -// Copyright: GPL v2. See COPYING file that comes with this distribution -// -// - -#ifndef KFILEREPLACEPART_H -#define KFILEREPLACEPART_H - -// QT - -// KDE -#include -class KAboutApplication; -class TDEAboutData; -class TDEConfig; - -// local -#include "configurationclasses.h" -class KFileReplaceView; - -#define KFR_VERSION "0.8.1" - -class KFileReplacePart: public KParts::ReadOnlyPart -{ - Q_OBJECT - - - private: //MEMBERS - KFileReplaceView* m_view; - TQWidget* m_parentWidget, - * m_w; - TDEConfig* m_config; - KAboutApplication* m_aboutDlg; - KeyValueMap m_replacementMap; - RCOptions* m_option; - bool m_stop, - m_searchingOperation; - int m_optionMask; - - public://Constructors - KFileReplacePart(TQWidget *parentWidget, - const char *widgetName, - TQObject *parent, - const char *name, - const TQStringList &args); - ~KFileReplacePart(); - - //SLOTS - private slots: - void slotSetNewParameters(); - void slotSearchingOperation(); - void slotReplacingOperation(); - void slotSimulatingOperation(); - void slotStop(); - void slotCreateReport(); - void slotStringsAdd(); - void slotQuickStringsAdd(); - void slotStringsDeleteItem(); - void slotStringsEmpty(); - void slotStringsEdit(); - void slotStringsSave(); - void slotStringsLoad(); - void slotStringsInvertCur(); - void slotStringsInvertAll(); - void slotOpenRecentStringFile(const KURL& urlFile); - void slotOptionRecursive(); - void slotOptionBackup(); - void slotOptionCaseSensitive(); - void slotOptionVariables(); - void slotOptionRegularExpressions(); - void slotOptionPreferences(); - void showAboutApplication(void); - void appHelpActivated(); - void reportBug(); - void resetActions(); - void slotSearchMode(bool b){ m_option->m_searchingOnlyMode = b; } - - //METHODS - public: - static TDEAboutData* createAboutData(); - TDEConfig *config(){ return m_config; } - - protected: - virtual bool openFile() { return false; } - virtual bool openURL (const KURL &url); - - private: - /** - * Initialization methods - */ - void initGUI(); - void initView(); - - /** - * This method freezes the GUI of kfilereplace during searching - */ - void freezeActions(); - - /** - * These methods load the resources from kfilereplacerc - */ - void loadOptionsFromRC(); - void loadOptions(); - void loadFileSizeOptions(); - void loadDateAccessOptions(); - void loadOwnerOptions(); - void loadLocationsList(); - void loadFiltersList(); - void loadBackupExtensionOptions(); - - /** - * These methods save the resources to kfilereplacerc - */ - void saveOptionsToRC(); - void saveOptions(); - void saveFileSizeOptions(); - void saveDateAccessOptions(); - void saveOwnerOptions(); - void saveLocationsList(); - void saveFiltersList(); - void saveBackupExtensionOptions(); - - /** - * Replacing methods - */ - void fileReplace(); - void recursiveFileReplace(const TQString& dirName, int& filesNumber); - void replaceAndBackup(const TQString& currentDir, const TQString& oldFileName); - void replaceAndOverwrite(const TQString& currentDir, const TQString& oldFileName); - void replacingLoop(TQString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace); - - /** - * Searching methods - */ - void fileSearch(const TQString& dirName, const TQString& filters); - void recursiveFileSearch(const TQString& dirName, const TQString& filters, uint& filesNumber); - void search(const TQString& currentDir, const TQString& fileName); - - /** - * Others methods - */ - void loadViewContent(); - void loadRulesFile(const TQString& fileName); - bool launchNewProjectDialog(const KURL& startURL); - void setOptionMask(); - bool checkBeforeOperation(); - bool dontAskAgain(); - void whatsThis(); -}; - -#endif// KFileReplacePart diff --git a/kfilereplace/kfilereplacepartui.rc b/kfilereplace/kfilereplacepartui.rc deleted file mode 100644 index 66946878..00000000 --- a/kfilereplace/kfilereplacepartui.rc +++ /dev/null @@ -1,75 +0,0 @@ - - - - Search/&Replace - - - - - - - &Strings - - - - - - - - - - - - - &Results - - - - - - - - - - - - &Options - - - - - - - - &Settings - - - &Help - - - - - - - -KFileReplace Main Toolbar - - - - - - - - - - - - - - - - - - - - diff --git a/kfilereplace/kfilereplaceui.rc b/kfilereplace/kfilereplaceui.rc deleted file mode 100644 index 2f645413..00000000 --- a/kfilereplace/kfilereplaceui.rc +++ /dev/null @@ -1,10 +0,0 @@ - - - - &File - - - Search/&Replace - - - diff --git a/kfilereplace/kfilereplaceview.cpp b/kfilereplace/kfilereplaceview.cpp deleted file mode 100644 index 5996193e..00000000 --- a/kfilereplace/kfilereplaceview.cpp +++ /dev/null @@ -1,672 +0,0 @@ -/***************************************************************************** - kfilereplaceview.cpp - description - ------------------- - begin : sam oct 16 15:28:00 CEST 1999 - copyright : (C) 1999 by Fran�is Dupoux - (C) 2004 Emiliano Gulmini -*****************************************************************************/ - -/***************************************************************************** - * * - * 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. * - * * - *****************************************************************************/ - -// TQt -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include - -// local -#include "kfilereplaceview.h" -#include "kfilereplacelib.h" -#include "kaddstringdlg.h" -#include "whatthis.h" - -using namespace whatthisNameSpace; - -KFileReplaceView::KFileReplaceView(RCOptions* info, TQWidget *parent,const char *name):KFileReplaceViewWdg(parent,name) -{ - m_option = info; - - initGUI(); - - // connect events - connect(m_lvResults, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); - connect(m_lvResults_2, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); - connect(m_lvStrings, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); - connect(m_lvStrings_2, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); - - whatsThis(); -} - -TQString KFileReplaceView::currentPath() -{ - TQListViewItem *lvi; - - if(! m_lviCurrent) lvi = m_rv->currentItem(); - else lvi = (TQListViewItem*) m_lviCurrent; - - while (lvi->parent()) - lvi = lvi->parent(); - - return TQString(lvi->text(1)+"/"+lvi->text(0)); -} - -void KFileReplaceView::showSemaphore(TQString s) -{ - if(s == "green") - { - m_ledGo->setState(KLed::On); - m_ledWait->setState(KLed::Off); - m_ledStop->setState(KLed::Off); - } - else - if(s == "yellow") - { - m_ledGo->setState(KLed::Off); - m_ledWait->setState(KLed::On); - m_ledStop->setState(KLed::Off); - } - else - if(s == "red") - { - m_ledGo->setState(KLed::Off); - m_ledWait->setState(KLed::Off); - m_ledStop->setState(KLed::On); - } -} - -void KFileReplaceView::stringsInvert(bool invertAll) -{ - TQListViewItem* lviCurItem, - * lviFirst; - KListView* sv = getStringsView(); - - if(invertAll) - lviCurItem = lviFirst = sv->firstChild(); - else - lviCurItem = lviFirst = sv->currentItem(); - - if(lviCurItem == 0) - return ; - - do - { - TQString searchText = lviCurItem->text(0), - replaceText = lviCurItem->text(1); - - // Cannot invert the string when search string is empty - if (replaceText.isEmpty()) - { - KMessageBox::error(0, i18n("Cannot invert string %1, because the search string would be empty.").arg(searchText)); - return; - } - - lviCurItem->setText(0, replaceText); - lviCurItem->setText(1, searchText); - - lviCurItem = lviCurItem->nextSibling(); - if(!invertAll) - break; - } while(lviCurItem && lviCurItem != lviFirst); - setCurrentStringsViewMap(); -} - -void KFileReplaceView::changeView(bool searchingOnlyMode) -{ - if(searchingOnlyMode) - { - m_stackResults->raiseWidget(m_lvResults_2); - m_stackStrings->raiseWidget(m_lvStrings_2); - m_rv = m_lvResults_2; - m_sv = m_lvStrings_2; - } - else - { - m_stackResults->raiseWidget(m_lvResults); - m_stackStrings->raiseWidget(m_lvStrings); - m_rv = m_lvResults; - m_sv = m_lvStrings; - } -} - -KListView* KFileReplaceView::getResultsView() -{ - if(m_option->m_searchingOnlyMode) - m_rv = m_lvResults_2; - else - m_rv = m_lvResults; - - return m_rv; -} - -KListView* KFileReplaceView::getStringsView() -{ - if(m_option->m_searchingOnlyMode) - m_sv = m_lvStrings_2; - else - m_sv = m_lvStrings; - return m_sv; -} - -//PUBLIC SLOTS -void KFileReplaceView::slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos) -{ - if (lvi == 0) // No item selected - return; - - // RIGHT BUTTON - if (button == Qt::RightButton) - { - m_lviCurrent = static_cast(lvi); - m_menuResult->popup(pos); - } -} - -void KFileReplaceView::slotResultProperties() -{ - TQString currItem = currentPath(); - if(! currItem.isEmpty()) - { - KURL url(currItem); - (void) new KPropertiesDialog(url); - m_lviCurrent = 0; - } -} - -void KFileReplaceView::slotResultOpen() -{ - TQString currItem = currentPath(); - if(!currItem.isEmpty()) - { - (void) new KRun(KURL(currItem), 0, true, true); - m_lviCurrent = 0; - } -} - -void KFileReplaceView::slotResultOpenWith() -{ - TQString currItem = currentPath(); - if(!currItem.isEmpty()) - { - KURL::List kurls; - kurls.append(KURL(currItem)); - KRun::displayOpenWithDialog(kurls); - m_lviCurrent = 0; - } -} - -void KFileReplaceView::slotResultDirOpen() -{ - TQString currItem = currentPath(); - if(!currItem.isEmpty()) - { - TQFileInfo fi; - fi.setFile(currItem); - (void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true); - m_lviCurrent = 0; - } -} - -void KFileReplaceView::slotResultEdit() -{ - TQListViewItem *lvi = m_rv->firstChild(); - - while (lvi) - { - DCOPClient *client = kapp->dcopClient(); - DCOPRef quanta(client->appId(),"WindowManagerIf"); - TQString path = TQString(lvi->text(1)+"/"+lvi->text(0)); - TQListViewItem *lviChild = lvi; - - while(lviChild) - { - if(lviChild->isSelected()) - { - coord c; - if(lviChild == lvi) - { - c.line = 0; - c.column = 0; - } - else - { - c= extractWordCoordinates(lviChild); - } - bool success = quanta.send("openFile", path, c.line, c.column); - - if(!success) - { - TQString message = i18n("File %1 cannot be opened. Might be a DCOP problem.").arg(path); - KMessageBox::error(parentWidget(), message); - } - } - if (lviChild == lvi) - lviChild = lviChild->firstChild(); - else - lviChild = lviChild->nextSibling(); - } - - lvi = lvi->nextSibling(); - } - - m_lviCurrent = 0; -} - -void KFileReplaceView::slotResultDelete() -{ - TQString currItem = currentPath(); - if (!currItem.isEmpty()) - { - TQFile fi; - int answer = KMessageBox::warningContinueCancel(this, i18n("Do you really want to delete %1?").arg(currItem), - TQString(),KStdGuiItem::del()); - - if(answer == KMessageBox::Continue) - { - fi.setName(currItem); - fi.remove(); - - delete m_lviCurrent; - m_lviCurrent = 0; - } - } -} - -void KFileReplaceView::slotResultTreeExpand() -{ - TQListViewItem *lviRoot = getResultsView()->firstChild(); - - if(lviRoot) - expand(lviRoot, true); -} - -void KFileReplaceView::slotResultTreeReduce() -{ - TQListViewItem *lviRoot = getResultsView()->firstChild(); - - if(lviRoot) - expand(lviRoot, false); -} - -void KFileReplaceView::slotStringsAdd() -{ - KeyValueMap oldMap(m_option->m_mapStringsView); - - KAddStringDlg addStringDlg(m_option, false); - - if(!addStringDlg.exec()) - return; - - KeyValueMap addedStringsMap(m_option->m_mapStringsView); - KeyValueMap::Iterator itMap; - - for(itMap = oldMap.begin(); itMap != oldMap.end(); ++itMap) - addedStringsMap.insert(itMap.key(),itMap.data()); - - m_option->m_mapStringsView = addedStringsMap; - - raiseResultsView(); - raiseStringsView(); - - loadMapIntoView(addedStringsMap); -} - -void KFileReplaceView::slotQuickStringsAdd(const TQString& quickSearch, const TQString& quickReplace) -{ - if(!quickSearch.isEmpty()) - { - KeyValueMap map; - if(quickReplace.isEmpty()) - { - map[quickSearch] = TQString(); - m_option->m_searchingOnlyMode = true; - } - else - { - map[quickSearch] = quickReplace; - m_option->m_searchingOnlyMode = false; - } - - m_option->m_mapStringsView = map; - - raiseResultsView(); - raiseStringsView(); - - loadMapIntoView(map); - } -} - -void KFileReplaceView::slotStringsEdit() -{ - KeyValueMap oldMap(m_option->m_mapStringsView); - if(oldMap.isEmpty()) return; - bool oldSearchFlagValue = m_option->m_searchingOnlyMode; - - oldMap.remove(m_sv->currentItem()->text(0)); - - m_option->m_mapStringsView.clear(); - - m_option->m_mapStringsView.insert(m_sv->currentItem()->text(0), m_sv->currentItem()->text(1)); - - KAddStringDlg addStringDlg(m_option, true); - - if(!addStringDlg.exec()) - return; - - KeyValueMap newMap(m_option->m_mapStringsView); - if(oldSearchFlagValue == m_option->m_searchingOnlyMode) - { - KeyValueMap::Iterator itMap; - - //merges the two maps - for(itMap = oldMap.begin(); itMap != oldMap.end(); ++itMap) - newMap.insert(itMap.key(),itMap.data()); - } - - m_option->m_mapStringsView = newMap; - - raiseResultsView(); - raiseStringsView(); - - loadMapIntoView(newMap); -} - -void KFileReplaceView::slotStringsSave() -{ - // Check there are strings in the list - KListView* sv = getStringsView(); - - if (sv->firstChild() == 0) - { - KMessageBox::error(0, i18n("No strings to save as the list is empty.")); - return ; - } - - TQString header("\n"), - footer("\n"), - body; - if(m_option->m_searchingOnlyMode) - header += "\n\t"; - else - header += "\n\t"; - - TQListViewItem* lvi = sv->firstChild(); - - while( lvi ) - { - body += TQString("\n\t" - "\n\t\t" - "\n\t\t" - "\n\t").arg(lvi->text(0)).arg(lvi->text(1)); - lvi = lvi->nextSibling(); - } - - // Selects the file where strings will be saved - TQString menu = "*.kfr|" + i18n("KFileReplace 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" == KFileReplace extension - - fileName = KFileReplaceLib::addExtension(fileName, "kfr"); - - TQFile file( fileName ); - if(!file.open( IO_WriteOnly )) - { - KMessageBox::error(0, i18n("File %1 cannot be saved.").arg(fileName)); - return ; - } - TQTextStream oTStream( &file ); - oTStream.setEncoding(TQTextStream::UnicodeUTF8); - oTStream << header - << body - << footer; - file.close(); -} - -void KFileReplaceView::slotStringsDeleteItem() -{ - TQListViewItem* item = m_sv->currentItem(); - if(item != 0) - { - KeyValueMap m = m_option->m_mapStringsView; - m.remove(item->text(0)); - m_option->m_mapStringsView = m; - delete item; - } -} - -void KFileReplaceView::slotStringsEmpty() -{ - TQListViewItem * myChild = m_sv->firstChild(); - while( myChild ) - { - TQListViewItem* item = myChild; - myChild = myChild->nextSibling(); - delete item; - } - KeyValueMap m; - m_option->m_mapStringsView = m; -} - -//PRIVATE -void KFileReplaceView::initGUI() -{ - m_option->m_searchingOnlyMode = true; - - m_stackResults->addWidget(m_lvResults); - m_stackResults->addWidget(m_lvResults_2); - m_stackStrings->addWidget(m_lvStrings); - m_stackStrings->addWidget(m_lvStrings_2); - - DCOPClient *client = kapp->dcopClient(); - QCStringList appList = client->registeredApplications(); - bool quantaFound = false; - - - for(QCStringList::Iterator it = appList.begin(); it != appList.end(); ++it) - { - if((*it).left(6) == "quanta") - { - quantaFound = true; - break; - } - } - - m_menuResult = new KPopupMenu(this, "ResultPopup"); - - - - m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("fileopen")), - i18n("&Open"), - this, - TQT_SLOT(slotResultOpen())); - if(!quantaFound) - { - m_menuResult->insertItem(i18n("Open &With..."), - this, - TQT_SLOT(slotResultOpenWith())); - } - - if(quantaFound) - { - m_menuResult->insertItem(SmallIconSet("quanta"), - i18n("&Edit in Quanta"), - this, - TQT_SLOT(slotResultEdit())); - } - - m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("up")), - i18n("Open Parent &Folder"), - this, - TQT_SLOT(slotResultDirOpen())); - m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("editdelete")), - i18n("&Delete"), - this, - TQT_SLOT(slotResultDelete())); - m_menuResult->insertSeparator(); - m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("info")), - i18n("&Properties"), - this, - TQT_SLOT(slotResultProperties())); - raiseResultsView(); - raiseStringsView(); -} - -void KFileReplaceView::raiseStringsView() -{ - if(m_option->m_searchingOnlyMode) - m_sv = m_lvStrings_2; - else - m_sv = m_lvStrings; - - m_stackStrings->raiseWidget(m_sv); -} - -void KFileReplaceView::raiseResultsView() -{ - if(m_option->m_searchingOnlyMode) - m_rv = m_lvResults_2; - else - m_rv = m_lvResults; - - m_stackResults->raiseWidget(m_rv); -} - -coord KFileReplaceView::extractWordCoordinates(TQListViewItem* lvi) -{ - //get coordinates of the first string of the current selected file - coord c; - c.line = 0; - c.column = 0; - TQString s = lvi->text(0); - //tqWarning("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW=%s",s.latin1()); - /* if(lvi->parent()) s = lvi->text(0); - else return c;*/ - - TQString temp; - int i = 0; - - //extracts line and column from lvi->text(0) - //FIXME: Don't get the line and column number from the text as it's translated and it will - //fail for non-English languages! - - //EMILIANO: This is not a good fixing but for now it should reduce the problems - while(true) - { - if(s[i] < '0' || s[i] > '9') - i++; - else - break; - } - while(true) - { - if(s[i] >= '0' && s[i] <= '9') - { - temp += s[i]; - i++; - } - else - break; - } - c.line = temp.toInt(); - temp = TQString(); - - while(true) - { - if(s[i] < '0' || s[i] > '9') - i++; - else - break; - } - while(true) - { - if(s[i] >= '0' && s[i] <= '9') - { - temp += s[i]; - i++; - } - else - break; - } - c.column = temp.toInt(); - - if(c.line > 0) c.line--; - if(c.column > 0) c.column--; - - return c; -} - -void KFileReplaceView::expand(TQListViewItem *lviCurrent, bool b) -{ - // current item - lviCurrent->setOpen(b); - - // recursivity - while((lviCurrent = lviCurrent->nextSibling()) != 0) - { - lviCurrent->setOpen(b); - - if (lviCurrent->firstChild()) - expand(lviCurrent->firstChild(), b); - } -} - -void KFileReplaceView::setMap() -{ - KeyValueMap map; - TQListViewItem* i = m_sv->firstChild(); - while(i != 0) - { - if(m_option->m_searchingOnlyMode) - map[i->text(0)] = TQString(); - else - map[i->text(0)] = i->text(1); - i = i->nextSibling(); - } - m_option->m_mapStringsView = map; -} - -void KFileReplaceView::loadMapIntoView(KeyValueMap map) -{ - m_sv->clear(); - KeyValueMap::Iterator itMap; - - for(itMap = map.begin(); itMap != map.end(); ++itMap) - { - TQListViewItem* lvi = new TQListViewItem(m_sv); - lvi->setMultiLinesEnabled(true); - lvi->setText(0,itMap.key()); - if(!m_option->m_searchingOnlyMode) - lvi->setText(1,itMap.data()); - } - -} - -void KFileReplaceView::whatsThis() -{ - TQWhatsThis::add(getResultsView(), lvResultWhatthis); - TQWhatsThis::add(getStringsView(), lvStringsWhatthis); -} -#include "kfilereplaceview.moc" diff --git a/kfilereplace/kfilereplaceview.h b/kfilereplace/kfilereplaceview.h deleted file mode 100644 index 4df878cf..00000000 --- a/kfilereplace/kfilereplaceview.h +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - kfilereplaceview.h - description - ------------------- - begin : sam oct 16 15:28:00 CEST 1999 - copyright : (C) 1999 by Franois Dupoux - (C) 2004 Emiliano Gulmini - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 KFILEREPLACEVIEW_H -#define KFILEREPLACEVIEW_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -//QT -#include -#include -class TQPixMap; - -//KDE -class KPopupMenu; -class KListView; - -//local -#include "kfilereplaceviewwdg.h" -#include "configurationclasses.h" - -class coord -{ - public: - int line, - column; - public: - coord(){ line = 1; - column = 1;} - coord(const coord& c) { line = c.line; - column = c.column;} - coord operator=(const coord& c) { line = c.line; - column = c.column; - return (*this);} -}; - - -/** - * The view of KFilereplace. - */ -class KFileReplaceView : public KFileReplaceViewWdg -{ - Q_OBJECT - - private: - KPopupMenu* m_menuResult; - RCOptions* m_option; - KListViewItem* m_lviCurrent; - KListView* m_rv, - * m_sv; - - public://Constructors - KFileReplaceView(RCOptions* info, TQWidget *parent,const char *name); - - public: - TQString currentPath(); - void showSemaphore(TQString s); - void displayScannedFiles(int filesNumber) { m_lcdFilesNumber->display(TQString::number(filesNumber,10)); } - void stringsInvert(bool invertAll); - void changeView(bool searchingOnlyMode); - KListView* getResultsView(); - KListView* getStringsView(); - void updateOptions(RCOptions* info) { m_option = info; } - void loadMap(KeyValueMap extMap){ loadMapIntoView(extMap); } - KeyValueMap getStringsViewMap()const { return m_option->m_mapStringsView;} - void setCurrentStringsViewMap(){ setMap(); } - //void emitSearchingOnlyMode(bool b) { emit searchingOnlyMode(b); } - - public slots: - void slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos); - void slotResultProperties(); - void slotResultOpen(); - void slotResultOpenWith(); - void slotResultDirOpen(); - void slotResultEdit(); - void slotResultDelete(); - void slotResultTreeExpand(); - void slotResultTreeReduce(); - void slotStringsAdd(); - void slotQuickStringsAdd(const TQString& quickSearch, const TQString& quickReplace); - void slotStringsDeleteItem(); - void slotStringsEmpty(); - void slotStringsEdit(); - void slotStringsSave(); - - private: - void initGUI(); - void raiseStringsView(); - void raiseResultsView(); - coord extractWordCoordinates(TQListViewItem* lvi); - void expand(TQListViewItem *lviCurrent, bool b); - void setMap(); - void loadMapIntoView(KeyValueMap map); - void whatsThis(); - - /*signals: - void resetActions(); - void searchingOnlyMode(bool);*/ -}; - -#endif // KFILEREPLACEVIEW_H diff --git a/kfilereplace/kfilereplaceviewwdg.ui b/kfilereplace/kfilereplaceviewwdg.ui deleted file mode 100644 index c8fca48d..00000000 --- a/kfilereplace/kfilereplaceviewwdg.ui +++ /dev/null @@ -1,555 +0,0 @@ - -KFileReplaceViewWdg - - - KFileReplaceViewWdg - - - - 0 - 0 - 635 - 370 - - - - - unnamed - - - 0 - - - - splitter3 - - - Vertical - - - - m_stackResults - - - - 7 - 7 - 0 - 0 - - - - - WStackPage - - - 0 - - - - unnamed - - - 0 - - - - - Name - - - true - - - true - - - - - Folder - - - true - - - true - - - - - Old Size - - - true - - - true - - - - - New Size - - - true - - - true - - - - - Replaced Strings - - - true - - - true - - - - - Owner User - - - true - - - true - - - - - Owner Group - - - true - - - true - - - - m_lvResults - - - Extended - - - true - - - true - - - true - - - LastColumn - - - false - - - - 238 - 246 - 255 - - - - - - - - WStackPage - - - 1 - - - - unnamed - - - 0 - - - - - Name - - - true - - - true - - - - - Folder - - - true - - - true - - - - - Size - - - true - - - true - - - - - Found Strings - - - true - - - true - - - - - Owner User - - - true - - - true - - - - - Owner Group - - - true - - - true - - - - m_lvResults_2 - - - Extended - - - true - - - true - - - true - - - LastColumn - - - false - - - - 238 - 246 - 255 - - - - - - - - - m_stackStrings - - - - 7 - 7 - 0 - 0 - - - - - WStackPage - - - 0 - - - - unnamed - - - 0 - - - - - Search For - - - true - - - true - - - - - Replace With - - - true - - - true - - - - m_lvStrings - - - true - - - false - - - AllColumns - - - false - - - - - - - WStackPage - - - 1 - - - - unnamed - - - 0 - - - - - Search For - - - true - - - true - - - - m_lvStrings_2 - - - true - - - false - - - AllColumns - - - false - - - - - - - - - layout7 - - - - unnamed - - - - layout6 - - - - unnamed - - - - m_ledGo - - - - 20 - 20 - - - - On - - - - 170 - 255 - 0 - - - - Green means ready - - - Ready - - - - - m_ledWait - - - - 20 - 20 - - - - On - - - - 255 - 255 - 0 - - - - Yellow means wait while sorting list - - - Please wait while sorting list - - - - - m_ledStop - - - - 20 - 20 - - - - - 255 - 0 - 0 - - - - Red means scanning files - - - - - - - spacer1 - - - Horizontal - - - Expanding - - - - 354 - 20 - - - - - - layout1 - - - - unnamed - - - - m_tlFilesNumber - - - Scanned files: - - - - - m_lcdFilesNumber - - - LineEditPanel - - - Raised - - - 7 - - - Dec - - - Flat - - - 0 - - - - - - - - - - - klistview.h - klistview.h - klistview.h - klistview.h - kled.h - kled.h - kled.h - - diff --git a/kfilereplace/knewprojectdlg.cpp b/kfilereplace/knewprojectdlg.cpp deleted file mode 100644 index b610990e..00000000 --- a/kfilereplace/knewprojectdlg.cpp +++ /dev/null @@ -1,531 +0,0 @@ -/*************************************************************************** - knewprojectdlg.cpp - description - ------------------- - begin : Tue Dec 28 1999 - copyright : (C) 1999 by Fran�is Dupoux - (C) 2004 Emiliano Gulmini - 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 -#include -#include -#include -#include -#include -#include -#include - -//KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// local -#include "knewprojectdlg.h" -#include "whatthis.h" - -using namespace whatthisNameSpace; - - -KNewProjectDlg::KNewProjectDlg(RCOptions* info, TQWidget *parent, const char *name) : KNewProjectDlgS(parent, name) -{ - m_searchNowFlag = ""; - m_option = info; - - initGUI(); - - connect(m_pbLocation, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDir())); - connect(m_pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotReject())); - connect(m_pbSearchNow, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchNow())); - connect(m_pbSearchLater, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchLater())); - connect(m_leSearch, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotSearchLineEdit(const TQString&))); - connect(m_chbSizeMin, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableSpinboxSizeMin(bool))); - connect(m_chbSizeMax, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableSpinboxSizeMax(bool))); - connect(m_chbDateMin, TQT_SIGNAL(toggled(bool)), m_dedDateMin, TQT_SLOT(setEnabled(bool))); - connect(m_chbDateMax, TQT_SIGNAL(toggled(bool)), m_dedDateMax, TQT_SLOT(setEnabled(bool))); - connect(m_chbDateMin,TQT_SIGNAL(toggled(bool)),this, TQT_SLOT(slotEnableCbValidDate(bool))); - connect(m_chbDateMax,TQT_SIGNAL(toggled(bool)),this, TQT_SLOT(slotEnableCbValidDate(bool))); - connect(m_chbOwnerUser, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbUser(bool))); - connect(m_chbOwnerGroup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbGroup(bool))); - connect(m_chbBackup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbBackup(bool))); - connect(m_pbHelp, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotHelp())); - - whatsThis(); -} - -KNewProjectDlg::~KNewProjectDlg() -{ -} - -void KNewProjectDlg::saveRCOptions() -{ - saveOptions(); - saveFileSizeOptions(); - saveDateAccessOptions(); - saveOwnerOptions(); - saveLocationsList(); - saveFiltersList(); - saveBackupExtensionOptions(); -} - -void KNewProjectDlg::slotDir() -{ - TQString directoryString = KFileDialog::getExistingDirectory(TQString(), this, i18n("Project Directory")); - if(!directoryString.isEmpty()) - m_cbLocation->setEditText(directoryString); -} - -void KNewProjectDlg::slotOK() -{ - // Check that Search text and Filter are not empty - m_option->m_directories = m_cbLocation->currentText(); - m_option->m_filters = m_cbFilter->currentText(); - if(!m_leSearch->text().isEmpty()) - { - if(m_leReplace->text().isEmpty()) - m_option->m_searchingOnlyMode = true; - else - m_option->m_searchingOnlyMode = false; - } - m_option->m_quickSearchString = m_searchNowFlag + m_leSearch->text(); - m_option->m_quickReplaceString = m_searchNowFlag + m_leReplace->text(); - - if (m_option->m_directories.isEmpty() || m_option->m_filters.isEmpty()) - { - KMessageBox::error(this, i18n("You must fill the combo boxes (location and filter) before continuing.")); - return; - } - - // OWNER OPTIONS - if ((m_chbOwnerUser->isChecked() && m_edOwnerUser->text().isEmpty()) || - (m_chbOwnerGroup->isChecked() && m_edOwnerGroup->text().isEmpty())) - { - KMessageBox::error(this, i18n("Some edit boxes are empty in the Owner page.")); - return ; - } - - // Check option "Size Min/Max": check MinSize is not greater than MaxSize - int minSize = m_spbSizeMin->value(), - maxSize = m_spbSizeMax->value(); - if ((minSize != FileSizeOption) && (maxSize != FileSizeOption)) - if (minSize > maxSize) - { - KMessageBox::error(this, i18n("The minimum size is greater than the maximum size.")); - return ; - } - - accept(); -} - -void KNewProjectDlg::slotReject() -{ - m_option->m_quickSearchString = m_searchNowFlag; - m_option->m_quickReplaceString = m_searchNowFlag; - - reject(); -} - -void KNewProjectDlg::slotSearchNow() -{ //Add a 'N' to represent the status search-now - m_searchNowFlag = "N"; - slotOK(); -} - -void KNewProjectDlg::slotSearchLater() -{ //Add a 'L' to represent the status search-later - m_searchNowFlag = "L"; - slotOK(); -} - -void KNewProjectDlg::slotSearchLineEdit(const TQString& t) -{ - m_pbSearchNow->setEnabled(!t.isEmpty()); -} - -void KNewProjectDlg::slotEnableSpinboxSizeMin(bool b) -{ - m_spbSizeMin->setEnabled(b); -} - -void KNewProjectDlg::slotEnableSpinboxSizeMax(bool b) -{ - m_spbSizeMax->setEnabled(b); -} - -void KNewProjectDlg::slotEnableCbValidDate(bool b) -{ - Q_UNUSED(b); - m_cbDateValid->setEnabled(m_chbDateMax->isChecked() || m_chbDateMin->isChecked()); -} - -void KNewProjectDlg::slotEnableChbUser(bool b) -{ - m_cbOwnerUserType->setEnabled(b); - m_cbOwnerUserBool->setEnabled(b); - m_edOwnerUser->setEnabled(b); -} - -void KNewProjectDlg::slotEnableChbGroup(bool b) -{ - m_cbOwnerGroupType->setEnabled(b); - m_cbOwnerGroupBool->setEnabled(b); - m_edOwnerGroup->setEnabled(b); -} - -void KNewProjectDlg::slotEnableChbBackup(bool b) -{ - m_leBackup->setEnabled(b); - m_tlBackup->setEnabled(b); -} - -//PRIVATE -void KNewProjectDlg::initGUI() -{ - TQIconSet iconSet = SmallIconSet("fileopen"); - TQPixmap pixMap = iconSet.pixmap( TQIconSet::Small, TQIconSet::Normal ); - - m_pbLocation->setIconSet(iconSet); - m_pbLocation->setFixedSize(pixMap.width() + 8, pixMap.height() + 8); - - m_pbSearchNow->setEnabled(false); - - loadOptions(); - loadFileSizeOptions(); - loadDateAccessOptions(); - loadOwnerOptions(); - loadBackupExtensionOptions(); - loadLocationsList(); - loadFiltersList(); -} - -void KNewProjectDlg::loadOptions() -{ - TQStringList availableEncodingNames(TDEGlobal::charsets()->availableEncodingNames()); - m_cbEncoding->insertStringList(availableEncodingNames); - int idx = -1; - int utf8Idx = -1; - for (uint i = 0; i < availableEncodingNames.count(); i++) - { - if (availableEncodingNames[i] == m_option->m_encoding) - { - idx = i; - break; - } - if (availableEncodingNames[i] == "utf8") - { - utf8Idx = i; - } - } - if (idx != -1) - m_cbEncoding->setCurrentItem(idx); - else - m_cbEncoding->setCurrentItem(utf8Idx); - - m_chbIncludeSubfolders->setChecked(m_option->m_recursive); - m_chbCaseSensitive->setChecked(m_option->m_caseSensitive); - m_chbEnableVariables->setChecked(m_option->m_variables); - m_chbRegularExpressions->setChecked(m_option->m_regularExpressions); -} - -void KNewProjectDlg::loadFileSizeOptions() -{ - int size = m_option->m_minSize; - if(size == FileSizeOption) - { - m_chbSizeMin->setChecked(false); - m_spbSizeMin->setEnabled(false); - m_spbSizeMin->setValue(0); - } - else - { - m_chbSizeMin->setChecked(true); - m_spbSizeMin->setEnabled(true); - m_spbSizeMin->setValue(size); - } - - size = m_option->m_maxSize; - if(size == FileSizeOption) - { - m_chbSizeMax->setChecked(false); - m_spbSizeMax->setEnabled(false); - m_spbSizeMax->setValue(0); - } - else - { - m_chbSizeMax->setChecked(true); - m_spbSizeMax->setEnabled(true); - m_spbSizeMax->setValue(size); - } -} - -void KNewProjectDlg::loadDateAccessOptions() -{ - // ================== DATE OPTIONS ======================== - - TQString date = m_option->m_minDate; - if(date == AccessDateOption) - { - m_chbDateMin->setChecked(false); - m_dedDateMin->setDate(m_dedDateMin->minValue()); - m_dedDateMin->setEnabled(false); - } - else - { - m_chbDateMin->setChecked(true); - m_dedDateMin->setDate(TQDate::fromString(date,Qt::ISODate)); - m_dedDateMin->setEnabled(true); - } - - date = m_option->m_maxDate; - if(date == AccessDateOption) - { - m_chbDateMax->setChecked(false); - m_dedDateMax->setDate(m_dedDateMax->maxValue()); - m_dedDateMax->setEnabled(false); - } - else - { - m_chbDateMax->setChecked(true); - m_dedDateMax->setDate(TQDate::fromString(date,Qt::ISODate)); - m_dedDateMax->setEnabled(true); - } - - m_cbDateValid->setEnabled(m_chbDateMax->isChecked() || m_chbDateMin->isChecked()); - -} - -void KNewProjectDlg::loadOwnerOptions() -{ - bool enableOwner = m_option->m_ownerUserIsChecked; - - m_chbOwnerUser->setChecked(enableOwner); - m_cbOwnerUserType->setEnabled(enableOwner); - m_cbOwnerUserBool->setEnabled(enableOwner); - m_edOwnerUser->setEnabled(enableOwner); - - m_cbOwnerUserType->setCurrentText(m_option->m_ownerUserType); - m_cbOwnerUserBool->setCurrentText(m_option->m_ownerUserBool); - - m_edOwnerUser->setText(m_option->m_ownerUserValue); - - enableOwner = m_option->m_ownerGroupIsChecked; - - m_chbOwnerGroup->setChecked(enableOwner); - m_cbOwnerGroupType->setEnabled(enableOwner); - m_cbOwnerGroupBool->setEnabled(enableOwner); - m_edOwnerGroup->setEnabled(enableOwner); - - m_cbOwnerGroupType->setCurrentText(m_option->m_ownerGroupType); - m_cbOwnerGroupBool->setCurrentText(m_option->m_ownerGroupBool); - m_edOwnerGroup->setText(m_option->m_ownerGroupValue); -} - -void KNewProjectDlg::loadLocationsList() -{ - m_cbLocation->insertStringList(m_option->m_directories); -} - -void KNewProjectDlg::loadFiltersList() -{ - m_cbFilter->insertStringList(m_option->m_filters); -} - -void KNewProjectDlg::loadBackupExtensionOptions() -{ - bool enableBackup = m_option->m_backup; - - m_chbBackup->setChecked(enableBackup); - m_leBackup->setEnabled(enableBackup); - m_tlBackup->setEnabled(enableBackup); - m_leBackup->setText(m_option->m_backupExtension); -} - -void KNewProjectDlg::saveOptions() -{ - m_option->m_encoding = m_cbEncoding->currentText(); - m_option->m_recursive = m_chbIncludeSubfolders->isChecked(); - m_option->m_caseSensitive = m_chbCaseSensitive->isChecked(); - m_option->m_variables = m_chbEnableVariables->isChecked(); - m_option->m_regularExpressions = m_chbRegularExpressions->isChecked(); -} - -void KNewProjectDlg::saveFileSizeOptions() -{ - if(m_chbSizeMax->isChecked()) - m_option->m_maxSize = m_spbSizeMax->value(); - else - m_option->m_maxSize = FileSizeOption; - - if(m_chbSizeMin->isChecked()) - m_option->m_minSize = m_spbSizeMin->value(); - else - m_option->m_minSize = FileSizeOption; -} - -void KNewProjectDlg::saveDateAccessOptions() -{ - if(m_chbDateMin->isChecked() || m_chbDateMax->isChecked()) - m_option->m_dateAccess = m_cbDateValid->currentText(); - else - m_option->m_dateAccess = ValidAccessDateOption; - - if(m_chbDateMin->isChecked()) - { - TQString date = m_dedDateMin->date().toString(Qt::ISODate); - m_option->m_minDate = date; - } - else - m_option->m_minDate = AccessDateOption; - - if(m_chbDateMax->isChecked()) - { - TQString date = m_dedDateMax->date().toString(Qt::ISODate); - m_option->m_maxDate = date; - } - else - m_option->m_maxDate = AccessDateOption; -} - -void KNewProjectDlg::saveOwnerOptions() -{ - bool isChecked = m_chbOwnerUser->isChecked(); - if(isChecked) - { - m_option->m_ownerUserIsChecked = true; - m_option->m_ownerUserType = m_cbOwnerUserType->currentText(); - m_option->m_ownerUserBool = m_cbOwnerUserBool->currentText(); - m_option->m_ownerUserValue = m_edOwnerUser->text(); - } - else - { - m_option->m_ownerUserIsChecked = false; - m_option->m_ownerUserType = "Name"; - m_option->m_ownerUserBool = "Equals To"; - m_option->m_ownerUserValue = ""; - } - - isChecked = m_chbOwnerGroup->isChecked(); - if(isChecked) - { - m_option->m_ownerGroupIsChecked = true; - m_option->m_ownerGroupType = m_cbOwnerGroupType->currentText(); - m_option->m_ownerGroupBool = m_cbOwnerGroupBool->currentText(); - m_option->m_ownerGroupValue = m_edOwnerGroup->text(); - } - else - { - m_option->m_ownerGroupIsChecked = false; - m_option->m_ownerGroupType = "Name"; - m_option->m_ownerGroupBool = "Equals To"; - m_option->m_ownerGroupValue = ""; - } -} - -void KNewProjectDlg::saveLocationsList() -{ - TQString current = m_cbLocation->currentText(); - TQStringList list = current; - - int count = m_cbLocation->listBox()->count(), - i; - for(i = 0; i < count; i++) - { - TQString text = m_cbLocation->listBox()->item(i)->text(); - if(text != current) - list.append(text); - } - m_option->m_directories = list; -} - -void KNewProjectDlg::saveFiltersList() -{ - TQString current = m_cbFilter->currentText(); - TQStringList list = current; - - int count = m_cbFilter->listBox()->count(), - i; - for(i = 0; i < count; i++) - { - TQString text = m_cbFilter->listBox()->item(i)->text(); - if(text != current) - list.append(text); - } - m_option->m_filters = list; -} - -void KNewProjectDlg::saveBackupExtensionOptions() -{ - TQString backupExt = m_leBackup->text(); - m_option->m_backup = (m_chbBackup->isChecked() && !backupExt.isEmpty()); - m_option->m_backupExtension = backupExt; -} - -void KNewProjectDlg::setDatas(const TQString& directoryString, const TQString& filterString) -{ - if (!directoryString.isEmpty()) - m_cbLocation->setEditText(directoryString); - - if (!filterString.isEmpty()) - m_cbFilter->setEditText(filterString); -} - -bool KNewProjectDlg::contains(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 KNewProjectDlg::whatsThis() -{ - TQWhatsThis::add(m_cbLocation, cbLocationWhatthis); - TQWhatsThis::add(m_cbFilter, cbFilterWhatthis); - - TQWhatsThis::add(m_spbSizeMin, edSizeMinWhatthis); - TQWhatsThis::add(m_spbSizeMax, edSizeMaxWhatthis); - - TQWhatsThis::add(m_cbDateValid, cbDateValidWhatthis); - TQWhatsThis::add(m_chbDateMin, chbDateMinWhatthis); - TQWhatsThis::add(m_chbDateMax, chbDateMaxWhatthis); - - TQWhatsThis::add(m_chbIncludeSubfolders, chbRecursiveWhatthis); - TQWhatsThis::add(m_chbRegularExpressions, chbRegularExpressionsWhatthis); - TQWhatsThis::add(m_chbEnableVariables, chbVariablesWhatthis); - TQWhatsThis::add(m_chbCaseSensitive, chbCaseSensitiveWhatthis); - TQWhatsThis::add(m_chbBackup, chbBackupWhatthis); - TQWhatsThis::add(m_leBackup, chbBackupWhatthis); - TQWhatsThis::add(m_leSearch, leSearchWhatthis); - TQWhatsThis::add(m_leReplace, leReplaceWhatthis); -} - -#include "knewprojectdlg.moc" - diff --git a/kfilereplace/knewprojectdlg.h b/kfilereplace/knewprojectdlg.h deleted file mode 100644 index 7be5ecb9..00000000 --- a/kfilereplace/knewprojectdlg.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - knewprojectdlg.h - description - ------------------- - begin : Tue Dec 28 1999 - copyright : (C) 1999 by Fran�ois Dupoux - (C) 2004 Emiliano Gulmini - 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. * - * * - ***************************************************************************/ - -#ifndef KNEWPROJECTDLG_H -#define KNEWPROJECTDLG_H - -//KDE -class TDEConfig; - -//local -#include "knewprojectdlgs.h" -#include "configurationclasses.h" - -class KNewProjectDlg : public KNewProjectDlgS -{ - Q_OBJECT - - - private: - TQString m_searchNowFlag; - RCOptions* m_option; - - public: - KNewProjectDlg(RCOptions* info, TQWidget *parent=0, const char *name=0); - ~KNewProjectDlg(); - - public: - //void updateOptions(const RCOptions& info); - void saveRCOptions(); - - protected slots: - void slotDir(); - void slotOK(); - void slotReject(); - void slotSearchNow(); - void slotSearchLater(); - void slotSearchLineEdit(const TQString& t); - void slotEnableSpinboxSizeMin(bool b); - void slotEnableSpinboxSizeMax(bool b); - void slotEnableCbValidDate(bool b); - void slotEnableChbUser(bool b); - void slotEnableChbGroup(bool b); - void slotEnableChbBackup(bool b); - void slotHelp(){ kapp->invokeHelp(TQString(), "kfilereplace"); } - - private: - void initGUI(); - - void loadOptions(); - void loadFileSizeOptions(); - void loadDateAccessOptions(); - void loadOwnerOptions(); - void loadLocationsList(); - void loadFiltersList(); - void loadBackupExtensionOptions(); - - void saveOptions(); - void saveFileSizeOptions(); - void saveDateAccessOptions(); - void saveOwnerOptions(); - void saveLocationsList(); - void saveFiltersList(); - void saveBackupExtensionOptions(); - - bool contains(TQListView* lv,const TQString& s, int column); - void setDatas(const TQString& directoryString, const TQString& filterString); - void whatsThis(); -}; - -#endif // KNewProjectDlg diff --git a/kfilereplace/knewprojectdlgs.ui b/kfilereplace/knewprojectdlgs.ui deleted file mode 100644 index b3509c1d..00000000 --- a/kfilereplace/knewprojectdlgs.ui +++ /dev/null @@ -1,898 +0,0 @@ - -KNewProjectDlgS - - - KNewProjectDlgS - - - - 0 - 0 - 568 - 609 - - - - Search & Replace in Files - - - true - - - true - - - - unnamed - - - - layout28 - - - - unnamed - - - - m_pbHelp - - - true - - - - 3 - 1 - 0 - 0 - - - - - 0 - 0 - - - - - 70 - 32767 - - - - &Help - - - - - spacer7 - - - Horizontal - - - Expanding - - - - 150 - 20 - - - - - - m_pbSearchNow - - - Search Now - - - - - - true - - - - - m_pbSearchLater - - - Search Later - - - - - - - - m_pbCancel - - - - 3 - 1 - 0 - 0 - - - - - 70 - 32767 - - - - &Cancel - - - - - - - tabWidget2 - - - - tab - - - &General - - - - unnamed - - - - groupBox5 - - - Startup Folder Options - - - - unnamed - - - - m_tlFilter - - - Filter: - - - cbFilter - - - - - m_tlLocation - - - Location: - - - AutoText - - - cbLocation - - - - - m_cbLocation - - - - 3 - 0 - 0 - 0 - - - - true - - - 20 - - - 10 - - - AtTop - - - false - - - Insert a search path here. You can use the search path button. - - - - - m_pbLocation - - - - - - - - - - - m_cbFilter - - - - 3 - 0 - 0 - 0 - - - - true - - - 20 - - - 10 - - - AtTop - - - false - - - - - - - - m_chbIncludeSubfolders - - - &Include subfolders - - - true - - - - - - - groupBox6 - - - Search/Replace Strings - - - - unnamed - - - - m_leSearch - - - - - m_leReplace - - - - - m_tlSearch - - - Search: - - - - - m_tlReplace - - - Replace: - - - - - - - groupBox4 - - - General Options - - - - unnamed - - - - m_chbRegularExpressions - - - true - - - Enable &regular expressions - - - - - m_chbBackup - - - Do &backup copy instead of overwrite - - - - - m_chbCaseSensitive - - - &Case sensitive - - - - - m_chbEnableVariables - - - Enable co&mmands in the replace string - - - - - m_tlBackup - - - Backup copy suffix: - - - - - m_leBackup - - - - - - - - m_cbEncoding - - - - 3 - 0 - 0 - 0 - - - - - - textLabel1 - - - Encoding of the files: - - - - - - - - - tab - - - &Advanced - - - - unnamed - - - - gbOwnership - - - Ownership Filtering - - - - unnamed - - - - m_chbOwnerUser - - - User: - - - - - - Name - - - - - ID (Number) - - - - m_cbOwnerUserType - - - false - - - 2 - - - 2 - - - true - - - - - - Equals To - - - - - Is Not - - - - m_cbOwnerUserBool - - - false - - - 2 - - - 2 - - - false - - - - - - Equals To - - - - - Is Not - - - - m_cbOwnerGroupBool - - - false - - - 2 - - - 2 - - - false - - - - - - Name - - - - - ID (Number) - - - - m_cbOwnerGroupType - - - false - - - 2 - - - 2 - - - false - - - - - m_chbOwnerGroup - - - Group: - - - - - m_edOwnerUser - - - false - - - - - m_edOwnerGroup - - - false - - - - - - - gbAccessDate - - - Access Date Filtering - - - - unnamed - - - - layout8 - - - - unnamed - - - - layout18 - - - - unnamed - - - - m_tlDateValid - - - Dates valid for: - - - - - m_chbDateMin - - - Accessed after: - - - - - m_chbDateMax - - - Accessed before: - - - - - - - layout19 - - - - unnamed - - - - - Last Writing Access - - - - - Last Reading Access - - - - m_cbDateValid - - - 2 - - - 2 - - - false - - - - - m_dedDateMin - - - false - - - - 2000 - 1 - 1 - - - - true - - - - 2100 - 12 - 31 - - - - - 1900 - 12 - 31 - - - - - - m_dedDateMax - - - false - - - - 2000 - 1 - 1 - - - - true - - - - 2100 - 12 - 31 - - - - - 1900 - 9 - 14 - - - - - - - - spacer3 - - - Horizontal - - - Expanding - - - - 190 - 16 - - - - - - - - - - gbSize - - - Size Filtering - - - - unnamed - - - - layout32 - - - - unnamed - - - - layout31 - - - - unnamed - - - - m_chbSizeMin - - - Minimum si&ze: - - - - - m_chbSizeMax - - - Maximum size: - - - - - - - layout30 - - - - unnamed - - - - m_spbSizeMin - - - 4000000 - - - 0 - - - - - m_spbSizeMax - - - 4000000 - - - 0 - - - - - - - layout31 - - - - unnamed - - - - m_tlSizeMin - - - KB - - - - - m_tlSizeMax - - - KB - - - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 330 - 16 - - - - - - - - - - - - - - tabWidget2 - m_leSearch - m_leReplace - m_cbLocation - m_pbLocation - m_cbFilter - m_chbIncludeSubfolders - m_cbEncoding - m_chbCaseSensitive - m_chbRegularExpressions - m_chbEnableVariables - m_chbBackup - m_leBackup - m_pbSearchNow - m_pbSearchLater - m_pbCancel - m_pbHelp - m_chbSizeMin - m_spbSizeMin - m_chbSizeMax - m_spbSizeMax - m_cbDateValid - m_chbDateMin - m_chbDateMax - m_chbOwnerUser - m_cbOwnerUserType - m_cbOwnerUserBool - m_edOwnerUser - m_chbOwnerGroup - m_cbOwnerGroupType - m_cbOwnerGroupBool - m_edOwnerGroup - m_dedDateMin - m_dedDateMax - - - diff --git a/kfilereplace/koptionsdlg.cpp b/kfilereplace/koptionsdlg.cpp deleted file mode 100644 index 8d303f08..00000000 --- a/kfilereplace/koptionsdlg.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/*************************************************************************** - koptionsdlg.cpp - description - ------------------- - begin : Tue Dec 28 1999 - copyright : (C) 1999 by Fran�is Dupoux - (C) 2004 Emiliano Gulmini - 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 -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -//#include - -// local -#include "whatthis.h" -#include "koptionsdlg.h" - - -using namespace whatthisNameSpace; - - -KOptionsDlg::KOptionsDlg(RCOptions* info, TQWidget *parent, const char *name) : KOptionsDlgS(parent,name,true) -{ - m_config = new TDEConfig("kfilereplacerc"); - m_option = info; - - initGUI(); - - connect(m_pbOK, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotOK())); - connect(m_pbDefault, TQT_SIGNAL(clicked()),this,TQT_SLOT(slotDefaults())); - connect(m_chbBackup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbBackup(bool))); - connect(m_pbHelp, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotHelp())); - connect(m_chbConfirmStrings, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbConfirmStrings(bool))); - connect(m_chbShowConfirmDialog, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbShowConfirmDialog(bool))); - - whatsThis(); -} - -KOptionsDlg::~KOptionsDlg() -{ -} - -//PRIVATE SLOTS -void KOptionsDlg::slotOK() -{ - saveRCOptions(); - accept(); -} - -/** Set defaults values for all options of the dialog */ -void KOptionsDlg::slotDefaults() -{ - m_chbCaseSensitive->setChecked(CaseSensitiveOption); - m_chbRecursive->setChecked(RecursiveOption); - m_chbHaltOnFirstOccurrence->setChecked(StopWhenFirstOccurenceOption); - - m_chbFollowSymLinks->setChecked(FollowSymbolicLinksOption); - m_chbIgnoreHidden->setChecked(IgnoreHiddenOption); - m_chbRegularExpressions->setChecked(RegularExpressionsOption); - m_chbIgnoreFiles->setChecked(IgnoreFilesOption); - m_chbConfirmStrings->setChecked(AskConfirmReplaceOption); - - TQStringList bkList = TQStringList::split(",",BackupExtensionOption,true); - - bool enableBackup = (bkList[0] == "true" ? true : false); - - m_chbBackup->setChecked(enableBackup); - m_leBackup->setEnabled(enableBackup); - m_tlBackup->setEnabled(enableBackup); - - m_leBackup->setText(bkList[1]); - - m_chbVariables->setChecked(VariablesOption); - - m_chbNotifyOnErrors->setChecked(NotifyOnErrorsOption); -} - -void KOptionsDlg::slotChbBackup(bool b) -{ - m_leBackup->setEnabled(b); - m_tlBackup->setEnabled(b); -} - -void KOptionsDlg::slotChbConfirmStrings(bool b) -{ - if(b) - { - m_chbShowConfirmDialog->setEnabled(true); - m_chbShowConfirmDialog->setChecked(true); - m_config->setGroup("Notification Messages"); - m_config->writeEntry(rcDontAskAgain,"no"); - } - else - { - m_chbShowConfirmDialog->setEnabled(false); - m_chbShowConfirmDialog->setChecked(false); - m_config->setGroup("Notification Messages"); - m_config->writeEntry(rcDontAskAgain,"yes"); - } -} - -void KOptionsDlg::slotChbShowConfirmDialog(bool b) -{ - m_config->setGroup("Notification Messages"); - if(b) - { - m_config->writeEntry(rcDontAskAgain,"no"); - } - else - { - m_config->writeEntry(rcDontAskAgain,"yes"); - } -} - -//PRIVATE -void KOptionsDlg::initGUI() -{ - m_config->sync(); - m_config->setGroup("Notification Messages"); - m_option->m_notifyOnErrors = m_config->readBoolEntry(rcNotifyOnErrors, true); - - TQString dontAskAgain = m_config->readEntry(rcDontAskAgain,"no"); - - m_chbConfirmStrings->setChecked(m_option->m_askConfirmReplace); - - if(m_chbConfirmStrings->isChecked()) - { - if(dontAskAgain == "yes") - m_chbShowConfirmDialog->setChecked(false); - else - m_chbShowConfirmDialog->setChecked(true); - } - - TQStringList availableEncodingNames(TDEGlobal::charsets()->availableEncodingNames()); - m_cbEncoding->insertStringList( availableEncodingNames ); - int idx = -1; - int utf8Idx = -1; - for (uint i = 0; i < availableEncodingNames.count(); i++) - { - if (availableEncodingNames[i] == m_option->m_encoding) - { - idx = i; - break; - } - if (availableEncodingNames[i] == "utf8") - { - utf8Idx = i; - } - } - if (idx != -1) - m_cbEncoding->setCurrentItem(idx); - else - m_cbEncoding->setCurrentItem(utf8Idx); - - m_chbCaseSensitive->setChecked(m_option->m_caseSensitive); - m_chbRecursive->setChecked(m_option->m_recursive); - - bool enableBackup = m_option->m_backup; - - m_chbBackup->setChecked(enableBackup); - m_leBackup->setEnabled(enableBackup); - m_tlBackup->setEnabled(enableBackup); - - m_leBackup->setText(m_option->m_backupExtension); - - m_chbVariables->setChecked(m_option->m_variables); - m_chbRegularExpressions->setChecked(m_option->m_regularExpressions); - m_chbHaltOnFirstOccurrence->setChecked(m_option->m_haltOnFirstOccur); - m_chbFollowSymLinks->setChecked(m_option->m_followSymLinks); - m_chbIgnoreHidden->setChecked(m_option->m_ignoreHidden); - m_chbIgnoreFiles->setChecked(m_option->m_ignoreFiles); - - m_chbNotifyOnErrors->setChecked(m_option->m_notifyOnErrors); -} - -void KOptionsDlg::saveRCOptions() -{ - m_option->m_encoding = m_cbEncoding->currentText(); - m_option->m_caseSensitive = m_chbCaseSensitive->isChecked(); - m_option->m_recursive = m_chbRecursive->isChecked(); - TQString backupExt = m_leBackup->text(); - m_option->m_backup = (m_chbBackup->isChecked() && !backupExt.isEmpty()); - m_option->m_backupExtension = backupExt; - m_option->m_variables = m_chbVariables->isChecked(); - m_option->m_regularExpressions = m_chbRegularExpressions->isChecked(); - m_option->m_haltOnFirstOccur = m_chbHaltOnFirstOccurrence->isChecked(); - m_option->m_followSymLinks = m_chbFollowSymLinks->isChecked(); - m_option->m_ignoreHidden = m_chbIgnoreHidden->isChecked(); - m_option->m_ignoreFiles = m_chbIgnoreFiles->isChecked(); - m_option->m_askConfirmReplace = m_chbConfirmStrings->isChecked(); - m_option->m_notifyOnErrors = m_chbNotifyOnErrors->isChecked(); - - m_config->setGroup("Notification Messages"); - m_config->writeEntry(rcNotifyOnErrors, m_option->m_notifyOnErrors); - - m_config->sync(); -} - -void KOptionsDlg::whatsThis() -{ - // Create help TQWhatsThis - TQWhatsThis::add(m_chbCaseSensitive, chbCaseSensitiveWhatthis); - TQWhatsThis::add(m_chbRecursive, chbRecursiveWhatthis); - TQWhatsThis::add(m_chbHaltOnFirstOccurrence, chbHaltOnFirstOccurrenceWhatthis); - TQWhatsThis::add(m_chbFollowSymLinks, chbFollowSymLinksWhatthis); - TQWhatsThis::add(m_chbIgnoreHidden, chbIgnoreHiddenWhatthis); - TQWhatsThis::add(m_chbIgnoreFiles, chbIgnoreFilesWhatthis); - TQWhatsThis::add(m_chbRegularExpressions, chbRegularExpressionsWhatthis); - TQWhatsThis::add(m_chbVariables, chbVariablesWhatthis); - TQWhatsThis::add(m_chbBackup, chbBackupWhatthis); - TQWhatsThis::add(m_chbConfirmStrings, chbConfirmStringsWhatthis); -} - -#include "koptionsdlg.moc" diff --git a/kfilereplace/koptionsdlg.h b/kfilereplace/koptionsdlg.h deleted file mode 100644 index a9e8e620..00000000 --- a/kfilereplace/koptionsdlg.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - koptionsdlg.h - description - ------------------- - begin : Tue Dec 28 1999 - copyright : (C) 1999 by Fran�ois Dupoux - (C) 2004 Emiliano Gulmini - 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. * - * * - ***************************************************************************/ - -#ifndef KOPTIONSDLG_H -#define KOPTIONSDLG_H - -// KDE -class TDEConfig; - -//local -#include "configurationclasses.h" -#include "koptionsdlgs.h" - -/** - *@author Fran�ois Dupoux - */ - -class KOptionsDlg : public KOptionsDlgS -{ - Q_OBJECT - - public: - KOptionsDlg(RCOptions* info, TQWidget *parent, const char *name); - ~KOptionsDlg(); - - private: - RCOptions* m_option; - TDEConfig *m_config; - - private slots: - void slotOK(); - void slotDefaults(); - void slotChbBackup(bool b); - void slotChbConfirmStrings(bool b); - void slotChbShowConfirmDialog(bool b); - void slotHelp(){ kapp->invokeHelp(TQString(), "kfilereplace"); } - - private: - void initGUI(); - void saveRCOptions(); - void whatsThis(); -}; - -#endif // KOPTIONSDLG_H diff --git a/kfilereplace/koptionsdlgs.ui b/kfilereplace/koptionsdlgs.ui deleted file mode 100644 index 131e01f0..00000000 --- a/kfilereplace/koptionsdlgs.ui +++ /dev/null @@ -1,347 +0,0 @@ - -KOptionsDlgS - - - KOptionsDlgS - - - - 0 - 0 - 572 - 420 - - - - Options - - - true - - - - unnamed - - - - tabWidget2 - - - - tab1 - - - General - - - - unnamed - - - - groupBox7 - - - General Options - - - - unnamed - - - - m_chbVariables - - - Enable commands in replace strings - - - - - - - - m_tlBackup - - - Backup copy suffix: - - - - - m_leBackup - - - - - - - - m_chbNotifyOnErrors - - - Notif&y on errors - - - - - m_chbCaseSensitive - - - Case sensitive - - - - - - - - m_chbRecursive - - - Recursive (search/replace in all sub folders) - - - - - - - - m_chbRegularExpressions - - - true - - - Enable regular e&xpressions - - - - - m_chbBackup - - - Do &backup copy - - - - - textLabel1 - - - Encoding of the files: - - - - - m_cbEncoding - - - - 3 - 0 - 0 - 0 - - - - - - - - - - Tab3 - - - &Advanced - - - - unnamed - - - - gbxConfirm - - - Advanced Options - - - - unnamed - - - - m_chbIgnoreHidden - - - Ignore hidden files and folders - - - - - m_chbFollowSymLinks - - - Follow s&ymbolic links - - - - - m_chbHaltOnFirstOccurrence - - - When searching, stop on first string found (faster but no details) - - - - - m_chbIgnoreFiles - - - true - - - Do not show file if no strings are found or replaced - - - - - layout9 - - - - unnamed - - - - spacer2 - - - Horizontal - - - Fixed - - - - 16 - 20 - - - - - - m_chbShowConfirmDialog - - - false - - - Show confirmation dialog - - - - - - - m_chbConfirmStrings - - - false - - - Confirm before replace each string - - - - - - - - - - m_pbHelp - - - true - - - &Help - - - - - spacer1 - - - Horizontal - - - Expanding - - - - 202 - 20 - - - - - - m_pbDefault - - - &Default Values - - - - - m_pbOK - - - &OK - - - - - m_pbCancel - - - &Cancel - - - - - - - m_pbCancel - clicked() - KOptionsDlgS - reject() - - - - tabWidget2 - m_cbEncoding - m_chbCaseSensitive - m_chbRecursive - m_chbRegularExpressions - m_chbVariables - m_chbNotifyOnErrors - m_chbBackup - m_leBackup - m_pbDefault - m_pbOK - m_pbCancel - m_pbHelp - m_chbConfirmStrings - m_chbShowConfirmDialog - m_chbIgnoreFiles - m_chbHaltOnFirstOccurrence - m_chbFollowSymLinks - m_chbIgnoreHidden - - - diff --git a/kfilereplace/main.cpp b/kfilereplace/main.cpp deleted file mode 100644 index b3adfffe..00000000 --- a/kfilereplace/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - main.cpp - Main file for the KFileReplace shell - ------------------- - begin : Thu Sep 16 14:14:09 2004 - copyright : (C) 2004 by Andras Mantia - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include "kfilereplace.h" - -#include -#include -#include -#include - -static const char description[] = - I18N_NOOP("Batch search and replace tool"); - -static const char version[] = "0.1"; - -static KCmdLineOptions options[] = - { - { "+[PATH]", I18N_NOOP( "Starting folder" ), 0 }, - KCmdLineLastOption - }; - -int main(int argc, char *argv[]) -{ - TDEAboutData about("kfilereplace", I18N_NOOP("KFileReplace"), version, description, - TDEAboutData::License_GPL_V2, "(C) 2004-2005 Andras Mantia\n(C) 2004-2005 Emiliano Gulmini\n(C) 1999-2002 Francois Dupoux", I18N_NOOP("Part of the KDEWebDev module."), - "http://www.tdewebdev.org"); - - about.addAuthor("Andras Mantia", I18N_NOOP("Shell author, KPart creator, co-maintainer"), "amantia@kde.org"); - about.addAuthor("Emiliano Gulmini", I18N_NOOP("Current maintainer, code cleaner and rewriter"),"emi_barbarossa@yahoo.it"); - about.addAuthor("Francois Dupou", - I18N_NOOP("Original author of the KFileReplace tool"), - "dupoux@dupoux.com"); - - TDECmdLineArgs::init(argc, argv, &about); - TDECmdLineArgs::addCmdLineOptions( options ); - - TDEApplication app; - - // see if we are starting with session management - if (app.isRestored()) - { - RESTORE(KFileReplace); - } - else - { - // no session.. just start up normally - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - - KFileReplace *kfr = new KFileReplace; - kfr->show(); - - if (args->count() == 0) - { - kfr->openURL(KURL()); - } - else - { - kfr->openURL(args->url(0)); - } - args->clear(); - } - - return app.exec(); -} diff --git a/kfilereplace/report.cpp b/kfilereplace/report.cpp deleted file mode 100644 index 6d485eba..00000000 --- a/kfilereplace/report.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/*************************************************************************** - report.cpp - Report document 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 -#include - -// KDE -#include -#include -#include - -// local -#include "report.h" -#include "configurationclasses.h" - -void Report::createReportFile() -{ - TQString xmlFileName = m_docPath + ".xml", - cssFileName = m_docPath + ".css"; - - // Generates a report file - // a) Open the file - TQFile report(xmlFileName); - if (!report.open( IO_WriteOnly )) - { - KMessageBox::error(0, i18n("Cannot open the file %1.").arg(xmlFileName)); - return ; - } - - // b) Write the header of the XML file - - TQDateTime datetime = TQDateTime::currentDateTime(Qt::LocalTime); - TQString dateString = datetime.toString(Qt::LocalDate); - KUser user; - TQString columnTextFour, - columnReplaceWith; - if(!m_isSearchFlag) - { - columnTextFour = i18n("Replaced Strings"); - columnReplaceWith = i18n("Replace with"); - } - else - { - columnTextFour = i18n("Total number occurrences"); - columnReplaceWith = i18n("-"); - } - - TQString css = cssFileName.mid(cssFileName.findRev("/")+1,cssFileName.length()-(cssFileName.findRev("/")+1)); - TQTextStream oTStream( &report ); - oTStream << "\n" - "" - "\n" - " "+i18n("KFileReplace Report")+" \n" - " "+user.fullName()+"("+user.loginName()+")"+"\n" - " "+dateString+"\n" - "
\n" - " \n" - " "+i18n("Searching/Replacing Strings Table")+" \n" - "
\n" - " \n" - " "+i18n("Search for")+"\n"; - - if(!m_isSearchFlag) - oTStream<< " "+columnReplaceWith+"\n"; - - oTStream<< " \n" - "
\n"; - // c) Write the strings list - TQListViewItem *lviCurItem, - *lviFirst; - - lviCurItem = lviFirst = m_stringsView->firstChild(); - - if(lviCurItem == 0) - return ; - - TQString rowType="a1"; - - do - { TQString rowTag = "\n" - " text(0)+"]]>\n" - " text(1)+"]]>\n" - "\n"; - - oTStream << rowTag; - - rowType = ((rowType == "a1") ? "a2" : "a1"); - - lviCurItem = lviCurItem->nextSibling(); - } while(lviCurItem && lviCurItem != lviFirst); - - oTStream<< "
\n"; - - oTStream<< "\n" - " \n" - " "+i18n("Results Table")+ " " - "
\n" - " \n" - " "+i18n("Name")+"\n" - " "+i18n("Folder")+"\n"; - if(m_isSearchFlag) - { - oTStream<< " "+i18n("Size")+"\n"; - } - else - { - oTStream<< " "+i18n("Old Size")+"\n" - " "+i18n("New Size")+"\n"; - } - oTStream<< " "+columnTextFour+"\n" - " "+i18n("Owner User")+"\n" - " "+i18n("Owner Group")+"\n" - " \n" - "
\n"; - - // d) Write the result list - - lviCurItem = lviFirst = m_resultsView->firstChild(); - - if(lviCurItem == 0) - return ; - - unsigned int totalOccurrences = 0; - - rowType="a1"; - - do - { TQString rowTag = " \n" - " text(0)+"]]>\n" - " text(1)+"]]>\n"; - if(m_isSearchFlag) - { - rowTag += " text(2)+"]]>\n" - " text(3)+"]]>\n" - " text(4)+"]]>\n" - " text(5)+"]]>\n" - " \n"; - } - else - { - rowTag += " text(2)+"]]>\n" - " text(3)+"]]>\n" - " text(4)+"]]>\n" - " text(5)+"]]>\n" - " text(6)+"]]>\n" - " \n"; - } - - oTStream << rowTag; - - rowType = ((rowType == "a1") ? "a2" : "a1"); - - if(m_isSearchFlag) - totalOccurrences += lviCurItem->text(3).toInt(); - else - totalOccurrences += lviCurItem->text(4).toInt(); - - lviCurItem = lviCurItem->nextSibling(); - } while(lviCurItem && lviCurItem != lviFirst); - - - // e) Write the end of the file - - oTStream<< "
\n" - "" - << totalOccurrences - << "\n" - "
\n"; - - report.close(); -} - -void Report::createStyleSheet() -{ - TQString cssFileName = m_docPath +".css"; - TQFile styleSheet(cssFileName); - if (!styleSheet.open( IO_WriteOnly )) - { - KMessageBox::error(0, i18n("Cannot open the file %1.").arg(cssFileName)); - return ; - } - - TQTextStream oTStream( &styleSheet ); - - TQString css = "title { display:block;font:40px bold sans-serif; }\n\n" - "createdby:before { content :\""+i18n("Created by")+": \"; }\n" - "createdby { display:inline; }\n\n" - "date:before { content :\"-"+i18n("date")+": \"; }\n" - "date { display:inline; }\n\n" - "totaloccurrences:before { content :\""+i18n("Total occurrences")+": \"; }\n" - "totaloccurrences { display:block;text-align:right; font-weight:bold;margin-top:5px;margin-right:5px;}\n" - "tablecaption {display:table-caption;font:20px bold sans-serif;}\n\n" - "hr {display:block;background:black;height:1px;margin:5px 0px 5px;}\n" - "whiteline {display:block;height:16px;}\n\n" - "searchfor {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n"; - - if(!m_isSearchFlag) - { - css += "replacewith {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n"; - } - - css += "folder {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n" - "header { display: table-header-group; }\n\n" - "name {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n" - "newsize {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0;\n" - " text-align:right; }\n\n" - "oldsize {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0;\n" - " text-align:right; }\n\n" - "ownergroup {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n" - "owneruser {\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n" - "replacedstrings {\n" - " text-align:right;\n" - " display:table-cell;\n" - " border:1px solid black;\n" - " padding:0 7px 0; }\n\n" - "*[class~=header] {\n" - " background : lightgray;\n" - " text-align : center; }\n\n" - "row { display : table-row; }\n\n" - "table {\n" - " display:table;\n" - " border-collapse: collapse; }\n\n" - "*[class~=a1] {\n" - " background-color:aliceblue;\n" - " font-weight : bold;font-size:15px; }\n\n" - "*[class~=a2] {\n" - " background-color:khaki;\n" - " font-weight : bold;\n" - " font-size:15px; }\n\n"; - - oTStream << css; - - styleSheet.close(); -} - -void Report::createDocument(const TQString& docPath) -{ - m_docPath = docPath; - - createStyleSheet(); - createReportFile(); -} - diff --git a/kfilereplace/report.h b/kfilereplace/report.h deleted file mode 100644 index 13856334..00000000 --- a/kfilereplace/report.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - report.h - Report document 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 REPORT_H -#define REPORT_H - -// QT -class TQString; - -// KDE -#include -#include "configurationclasses.h" -class KListView; - -/** Report class is used to create a pair of files (a xml and a css file) which are - * a short statistical report of the operations. - */ - -class Report -{ - private: - KListView* m_stringsView, - * m_resultsView; - TQString m_docPath; - bool m_isSearchFlag; - RCOptions* m_option; - - public: - Report(RCOptions* info, KListView* rv, KListView* sv) { m_option = info; - m_resultsView = rv; - m_stringsView = sv; - m_isSearchFlag = m_option->m_searchingOnlyMode; - } - ~Report() { m_option = 0; } - private: - void createReportFile(); - void createStyleSheet(); - - public: - void createDocument(const TQString& docPath); -}; - -#endif // REPORT_H diff --git a/kfilereplace/toolbar/CMakeLists.txt b/kfilereplace/toolbar/CMakeLists.txt deleted file mode 100644 index 5496d621..00000000 --- a/kfilereplace/toolbar/CMakeLists.txt +++ /dev/null @@ -1,13 +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 -# -################################################# - - -tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/kfilereplacepart/icons ) diff --git a/kfilereplace/toolbar/Makefile.am b/kfilereplace/toolbar/Makefile.am deleted file mode 100644 index 1b5627ad..00000000 --- a/kfilereplace/toolbar/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -appdir = $(kde_datadir)/kfilereplacepart/icons -app_ICON = AUTO - diff --git a/kfilereplace/toolbar/cr22-action-back.png b/kfilereplace/toolbar/cr22-action-back.png deleted file mode 100644 index 3e8f12fe..00000000 Binary files a/kfilereplace/toolbar/cr22-action-back.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-backup_option.png b/kfilereplace/toolbar/cr22-action-backup_option.png deleted file mode 100644 index a0e1e02f..00000000 Binary files a/kfilereplace/toolbar/cr22-action-backup_option.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-casesensitive_option.png b/kfilereplace/toolbar/cr22-action-casesensitive_option.png deleted file mode 100644 index 6302c0f2..00000000 Binary files a/kfilereplace/toolbar/cr22-action-casesensitive_option.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-command_option.png b/kfilereplace/toolbar/cr22-action-command_option.png deleted file mode 100644 index 1da3688b..00000000 Binary files a/kfilereplace/toolbar/cr22-action-command_option.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-editadd.png b/kfilereplace/toolbar/cr22-action-editadd.png deleted file mode 100644 index 5eb6f503..00000000 Binary files a/kfilereplace/toolbar/cr22-action-editadd.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-editremove.png b/kfilereplace/toolbar/cr22-action-editremove.png deleted file mode 100644 index 50117f6d..00000000 Binary files a/kfilereplace/toolbar/cr22-action-editremove.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-filereplace.png b/kfilereplace/toolbar/cr22-action-filereplace.png deleted file mode 100644 index c3692e11..00000000 Binary files a/kfilereplace/toolbar/cr22-action-filereplace.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-filesearch.png b/kfilereplace/toolbar/cr22-action-filesearch.png deleted file mode 100644 index 1be59c49..00000000 Binary files a/kfilereplace/toolbar/cr22-action-filesearch.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-filesimulate.png b/kfilereplace/toolbar/cr22-action-filesimulate.png deleted file mode 100644 index 7cc5b284..00000000 Binary files a/kfilereplace/toolbar/cr22-action-filesimulate.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-informations.png b/kfilereplace/toolbar/cr22-action-informations.png deleted file mode 100644 index daeb5b80..00000000 Binary files a/kfilereplace/toolbar/cr22-action-informations.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-invert.png b/kfilereplace/toolbar/cr22-action-invert.png deleted file mode 100644 index f3ab8be6..00000000 Binary files a/kfilereplace/toolbar/cr22-action-invert.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-next.png b/kfilereplace/toolbar/cr22-action-next.png deleted file mode 100644 index cfab7cfb..00000000 Binary files a/kfilereplace/toolbar/cr22-action-next.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-projectopen.png b/kfilereplace/toolbar/cr22-action-projectopen.png deleted file mode 100644 index 607e6aa8..00000000 Binary files a/kfilereplace/toolbar/cr22-action-projectopen.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-recursive_option.png b/kfilereplace/toolbar/cr22-action-recursive_option.png deleted file mode 100644 index bc98df90..00000000 Binary files a/kfilereplace/toolbar/cr22-action-recursive_option.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-regularexpression_option.png b/kfilereplace/toolbar/cr22-action-regularexpression_option.png deleted file mode 100644 index f74c7b56..00000000 Binary files a/kfilereplace/toolbar/cr22-action-regularexpression_option.png and /dev/null differ diff --git a/kfilereplace/toolbar/cr22-action-unsortedList.png b/kfilereplace/toolbar/cr22-action-unsortedList.png deleted file mode 100644 index bed281f1..00000000 Binary files a/kfilereplace/toolbar/cr22-action-unsortedList.png and /dev/null differ diff --git a/kfilereplace/tutorial.kwd b/kfilereplace/tutorial.kwd deleted file mode 100644 index 2183e53b..00000000 Binary files a/kfilereplace/tutorial.kwd and /dev/null differ diff --git a/kfilereplace/whatthis.h b/kfilereplace/whatthis.h deleted file mode 100644 index 09f6ac80..00000000 --- a/kfilereplace/whatthis.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - whatthis.h - description - ------------------- - begin : fri 12 march CEST 2004 - copyright : (C) 2004 Emiliano Gulmini - email : - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 WHATTHIS_H -#define WHATTHIS_H - -// QT -#include - -// KDE -#include - -namespace whatthisNameSpace -{ - //KFileReplaceView messages - const TQString lvResultWhatthis = i18n("Shows the statistics of your operations. Note that the columns content changes depending on what kind of operation you are performing."); - - const TQString lvStringsWhatthis = i18n("Shows a list of strings to search for (and if you specified it, a list of strings to replace with). Use the \"add strings\" dialog to edit your string list or double click on a string."); - - //KNewProjectDlg messages - const TQString cbLocationWhatthis = i18n("Base folder for operations of search/replace. Insert path string here by hand or use the search button."); - - const TQString cbFilterWhatthis = i18n("Shell-like wildcards. Example: \"*.html;*.txt;*.xml\"."); - - const TQString edSizeMinWhatthis = i18n("Insert the minimum file size you want to search, or leave it unchecked if you don't want minimum size limit."); - - const TQString edSizeMaxWhatthis = i18n("Insert the maximum file size you want to search, or leave it unchecked if you don't want maximum size limit."); - - const TQString edDateMinWhatthis = i18n("Insert the minimum value for file access date that you want to search, or leave it unchecked if you don't a minimum limit."); - - const TQString edDateMaxWhatthis = i18n("Insert the maximum value for file access date that you want to search, or leave it unchecked if you don't a maximum limit."); - - const TQString cbDateValidWhatthis = i18n("Select \"writing\" if you want to use the date of the last modification, or \"reading\" to use the the date of the last access."); - - const TQString chbDateMinWhatthis = i18n("Minimum value for access date."); - - const TQString chbDateMaxWhatthis = i18n("Maximum value for access date."); - - const TQString leSearchWhatthis = i18n("Insert here the string to search for."); - - const TQString leReplaceWhatthis = i18n("Insert here the string to replace with."); - - //KOptionsDlg messages - const TQString chbCaseSensitiveWhatthis = i18n("Enable this option if your search is case sensitive."); - - const TQString chbRecursiveWhatthis = i18n("Enable this option to search in sub folders too."); - - const TQString chbHaltOnFirstOccurrenceWhatthis = i18n("Enable this option when you are searching for a string and you are only interested to know if the string is present or not in the current file."); - - const TQString chbIgnoreWhitespacesWhatthis =""; - - const TQString chbFollowSymLinksWhatthis = i18n("If kfilereplace encounters a symbolic link treats it like a normal folder or file."); - - const TQString chbIgnoreHiddenWhatthis = i18n("Enable this option to ignore hidden files or folders."); - - const TQString chbIgnoreFilesWhatthis = i18n("If this option is enabled, KFR will show even the names of the files in which no string has been found or replaced."); - - const TQString chbRegularExpressionsWhatthis = i18n("Allows you to apply QT-like regular expressions on the search string. Note that a complex regular expression could affect speed performance"); - - const TQString chbVariablesWhatthis = i18n("Enable \"commands\". For example: if search string is \"user\" and replace string is the command \"[$user:uid$]\", KFR will substitute \"user\" with the uid of the user."); - - const TQString chbBackupWhatthis = i18n("Enable this option if you want leave original files untouched."); - - const TQString chbConfirmStringsWhatthis = i18n("Enable this option if you want to be asked for single string replacement confirmation."); - - //KFileReplacePart - const TQString fileSimulateWhatthis = i18n("Enable this option to perform replacing as a simulation, i.e. without make any changes in files."); - - const TQString optionsRegularExpressionsWhatthis = chbRegularExpressionsWhatthis; - - const TQString optionsBackupWhatthis = chbBackupWhatthis; - - const TQString optionsCaseWhatthis = chbCaseSensitiveWhatthis; - - const TQString optionsVarWhatthis = chbVariablesWhatthis; - - const TQString optionsRecursiveWhatthis = chbRecursiveWhatthis; - - //KAddStringDlg - const TQString rbSearchOnlyWhatthis = i18n("Select search-only mode."); - - const TQString rbSearchReplaceWhatthis = i18n("Select search-and-replace mode."); - - const TQString edSearchWhatthis = i18n("Insert here a string you want search for."); - - const TQString edReplaceWhatthis = i18n("Insert here the string that KFR will use to replace the search string."); -} -#endif diff --git a/kimagemapeditor/kimagemapeditor.cpp b/kimagemapeditor/kimagemapeditor.cpp index c4d698c5..199b757b 100644 --- a/kimagemapeditor/kimagemapeditor.cpp +++ b/kimagemapeditor/kimagemapeditor.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,7 +57,7 @@ #include #include #include -#include +#include #if KDE_IS_VERSION(3,1,90) #include #else diff --git a/kimagemapeditor/kimedialogs.cpp b/kimagemapeditor/kimedialogs.cpp index 665984ea..59187ffc 100644 --- a/kimagemapeditor/kimedialogs.cpp +++ b/kimagemapeditor/kimedialogs.cpp @@ -34,7 +34,7 @@ //#include // KDE #include -#include +#include #include #include #include diff --git a/kimagemapeditor/kimeshell.cpp b/kimagemapeditor/kimeshell.cpp index cb7d9e21..3914ac50 100644 --- a/kimagemapeditor/kimeshell.cpp +++ b/kimagemapeditor/kimeshell.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kimagemapeditor/qextfileinfo.cpp b/kimagemapeditor/qextfileinfo.cpp index 440e9c78..518dc79a 100644 --- a/kimagemapeditor/qextfileinfo.cpp +++ b/kimagemapeditor/qextfileinfo.cpp @@ -21,11 +21,11 @@ //kde includes #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include diff --git a/kimagemapeditor/qextfileinfo.h b/kimagemapeditor/qextfileinfo.h index b064bcd8..86dd2923 100644 --- a/kimagemapeditor/qextfileinfo.h +++ b/kimagemapeditor/qextfileinfo.h @@ -12,10 +12,10 @@ #ifndef _TQEXTFILEINFO_H_ #define _TQEXTFILEINFO_H_ -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/klinkstatus/klinkstatus.tdevelop b/klinkstatus/klinkstatus.tdevelop index 1a58961e..2caa649b 100644 --- a/klinkstatus/klinkstatus.tdevelop +++ b/klinkstatus/klinkstatus.tdevelop @@ -57,12 +57,12 @@ - + - + --enable-debug=full diff --git a/klinkstatus/src/cfg/klsconfig.kcfgc b/klinkstatus/src/cfg/klsconfig.kcfgc index 089abab7..10adf128 100644 --- a/klinkstatus/src/cfg/klsconfig.kcfgc +++ b/klinkstatus/src/cfg/klsconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=klinkstatus.kcfg #IncludeFiles=defines.h ClassName=KLSConfig diff --git a/klinkstatus/src/engine/linkchecker.cpp b/klinkstatus/src/engine/linkchecker.cpp index 47a45ca6..13700c4e 100644 --- a/klinkstatus/src/engine/linkchecker.cpp +++ b/klinkstatus/src/engine/linkchecker.cpp @@ -27,11 +27,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/klinkstatus/src/engine/linkchecker.h b/klinkstatus/src/engine/linkchecker.h index a28d66bb..93b9268c 100644 --- a/klinkstatus/src/engine/linkchecker.h +++ b/klinkstatus/src/engine/linkchecker.h @@ -24,7 +24,7 @@ #include #include -#include +#include class KHTMLPart; #include "../parser/http.h" diff --git a/klinkstatus/src/klinkstatus.cpp b/klinkstatus/src/klinkstatus.cpp index 2efde62e..8309cb19 100644 --- a/klinkstatus/src/klinkstatus.cpp +++ b/klinkstatus/src/klinkstatus.cpp @@ -21,8 +21,8 @@ #include "klinkstatus.h" #include -#include -#include +#include +#include #include #include #include diff --git a/klinkstatus/src/klinkstatus_part.cpp b/klinkstatus/src/klinkstatus_part.cpp index 78c72716..bf56dbd3 100644 --- a/klinkstatus/src/klinkstatus_part.cpp +++ b/klinkstatus/src/klinkstatus_part.cpp @@ -23,13 +23,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include diff --git a/klinkstatus/src/ui/klshistorycombo.cpp b/klinkstatus/src/ui/klshistorycombo.cpp index c29ae53d..13c8a16d 100644 --- a/klinkstatus/src/ui/klshistorycombo.cpp +++ b/klinkstatus/src/ui/klshistorycombo.cpp @@ -13,7 +13,7 @@ #include "klsconfig.h" #include -#include +#include #include #include #include diff --git a/klinkstatus/src/ui/sessionwidget.cpp b/klinkstatus/src/ui/sessionwidget.cpp index e6a96f61..a761499d 100644 --- a/klinkstatus/src/ui/sessionwidget.cpp +++ b/klinkstatus/src/ui/sessionwidget.cpp @@ -24,16 +24,16 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include diff --git a/kommander/editor/assoctexteditorimpl.cpp b/kommander/editor/assoctexteditorimpl.cpp index 4cbaeb08..9fbfe938 100644 --- a/kommander/editor/assoctexteditorimpl.cpp +++ b/kommander/editor/assoctexteditorimpl.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ /* KDE INCLUDES */ #include -#include +#include #include #include #include diff --git a/kommander/editor/filechooser.cpp b/kommander/editor/filechooser.cpp index 6dfb84ec..ac0aad5a 100644 --- a/kommander/editor/filechooser.cpp +++ b/kommander/editor/filechooser.cpp @@ -1,7 +1,7 @@ #include "filechooser.h" #include #include -#include +#include #include FileChooser::FileChooser( TQWidget *parent, const char *name ) diff --git a/kommander/editor/formfile.cpp b/kommander/editor/formfile.cpp index fbb64d48..97a636ef 100644 --- a/kommander/editor/formfile.cpp +++ b/kommander/editor/formfile.cpp @@ -34,7 +34,7 @@ // KDE includes #include -#include +#include #include #include #include diff --git a/kommander/editor/kommander.xml b/kommander/editor/kommander.xml index ee10455b..2652e09b 100644 --- a/kommander/editor/kommander.xml +++ b/kommander/editor/kommander.xml @@ -558,7 +558,7 @@ dcop kdialog - kfile + tdefile xhost xmodmap xset diff --git a/kommander/editor/main.cpp b/kommander/editor/main.cpp index a4c4b27b..75e4ce67 100644 --- a/kommander/editor/main.cpp +++ b/kommander/editor/main.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kommander/editor/mainwindow.cpp b/kommander/editor/mainwindow.cpp index 608049ed..fd3f0ecb 100644 --- a/kommander/editor/mainwindow.cpp +++ b/kommander/editor/mainwindow.cpp @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ #include #include #include -#include +#include extern TQMap *qwf_functions; extern TQMap *qwf_forms; diff --git a/kommander/editor/mainwindowactions.cpp b/kommander/editor/mainwindowactions.cpp index 749f5d3b..8a217843 100644 --- a/kommander/editor/mainwindowactions.cpp +++ b/kommander/editor/mainwindowactions.cpp @@ -60,7 +60,7 @@ #include #include -#include +#include #include #include #include diff --git a/kommander/editor/messagelog.cpp b/kommander/editor/messagelog.cpp index 16947a77..33a385b3 100644 --- a/kommander/editor/messagelog.cpp +++ b/kommander/editor/messagelog.cpp @@ -17,7 +17,7 @@ #include "messagelog.h" #include -#include +#include #include #include #include diff --git a/kommander/factory/kommanderfactory.cpp b/kommander/factory/kommanderfactory.cpp index 7c717a68..76da35f1 100644 --- a/kommander/factory/kommanderfactory.cpp +++ b/kommander/factory/kommanderfactory.cpp @@ -19,7 +19,7 @@ **********************************************************************/ /* Modifications by Marc Britton (c) 2002 under GNU GPL, terms as above */ -#include +#include #include #include "kommanderfactory.h" diff --git a/kommander/pluginmanager/mainwindow.cpp b/kommander/pluginmanager/mainwindow.cpp index 8c1eb55b..249aed75 100644 --- a/kommander/pluginmanager/mainwindow.cpp +++ b/kommander/pluginmanager/mainwindow.cpp @@ -20,8 +20,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kommander/pluginmanager/pluginmanager.cpp b/kommander/pluginmanager/pluginmanager.cpp index e5de0841..64f1bf22 100644 --- a/kommander/pluginmanager/pluginmanager.cpp +++ b/kommander/pluginmanager/pluginmanager.cpp @@ -14,7 +14,7 @@ ***************************************************************************/ -#include +#include #include #include "pluginmanager.h" diff --git a/kommander/widget/functionlib.cpp b/kommander/widget/functionlib.cpp index a43fbfaf..18f9a6b8 100644 --- a/kommander/widget/functionlib.cpp +++ b/kommander/widget/functionlib.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kommander/widget/kommanderfunctions.cpp b/kommander/widget/kommanderfunctions.cpp index b36a7251..dc890657 100644 --- a/kommander/widget/kommanderfunctions.cpp +++ b/kommander/widget/kommanderfunctions.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/kommander/widgets/fileselector.cpp b/kommander/widgets/fileselector.cpp index 897f85c8..54a0e90a 100644 --- a/kommander/widgets/fileselector.cpp +++ b/kommander/widgets/fileselector.cpp @@ -16,7 +16,7 @@ /* KDE INCLUDES */ -#include +#include #include #include #include diff --git a/kxsldbg/kxsldbg.cpp b/kxsldbg/kxsldbg.cpp index 49b2305e..5dab0044 100644 --- a/kxsldbg/kxsldbg.cpp +++ b/kxsldbg/kxsldbg.cpp @@ -6,7 +6,7 @@ #include "kxsldbg.h" #include -#include +#include #include #include diff --git a/kxsldbg/kxsldbgpart/kxsldbg_part.cpp b/kxsldbg/kxsldbgpart/kxsldbg_part.cpp index 05bbf489..6fbd6f46 100644 --- a/kxsldbg/kxsldbgpart/kxsldbg_part.cpp +++ b/kxsldbg/kxsldbgpart/kxsldbg_part.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kxsldbg/kxsldbgpart/qxsldbgdoc.h b/kxsldbg/kxsldbgpart/qxsldbgdoc.h index 49f18070..c7c50174 100644 --- a/kxsldbg/kxsldbgpart/qxsldbgdoc.h +++ b/kxsldbg/kxsldbgpart/qxsldbgdoc.h @@ -9,7 +9,7 @@ #ifndef TQXSLDBGDOC_H #define TQXSLDBGDOC_H -#include +#include #include #include #include diff --git a/kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp b/kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp index 2967b522..ddf862ca 100644 --- a/kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp +++ b/kxsldbg/kxsldbgpart/xsldbgconfigimpl.cpp @@ -16,7 +16,7 @@ ************************************************************************************/ #include -#include +#include #include #include diff --git a/lib/compatibility/knewstuff/downloaddialog.cpp b/lib/compatibility/knewstuff/downloaddialog.cpp index c5f402e1..afc27b16 100644 --- a/lib/compatibility/knewstuff/downloaddialog.cpp +++ b/lib/compatibility/knewstuff/downloaddialog.cpp @@ -25,11 +25,11 @@ #include #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/lib/compatibility/knewstuff/engine.cpp b/lib/compatibility/knewstuff/engine.cpp index 2abb7bca..12857917 100644 --- a/lib/compatibility/knewstuff/engine.cpp +++ b/lib/compatibility/knewstuff/engine.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/compatibility/knewstuff/knewstuffgeneric.cpp b/lib/compatibility/knewstuff/knewstuffgeneric.cpp index 163d9ade..9d516298 100644 --- a/lib/compatibility/knewstuff/knewstuffgeneric.cpp +++ b/lib/compatibility/knewstuff/knewstuffgeneric.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/compatibility/knewstuff/knewstuffsecure.cpp b/lib/compatibility/knewstuff/knewstuffsecure.cpp index 3c90f068..a6a905c0 100644 --- a/lib/compatibility/knewstuff/knewstuffsecure.cpp +++ b/lib/compatibility/knewstuff/knewstuffsecure.cpp @@ -16,10 +16,10 @@ #include //kde includes -#include +#include #include #include -#include +#include #include #include #include diff --git a/lib/compatibility/knewstuff/provider.cpp b/lib/compatibility/knewstuff/provider.cpp index 92be65b6..4c631847 100644 --- a/lib/compatibility/knewstuff/provider.cpp +++ b/lib/compatibility/knewstuff/provider.cpp @@ -18,9 +18,9 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include -#include +#include #include #include #include diff --git a/lib/compatibility/knewstuff/uploaddialog.cpp b/lib/compatibility/knewstuff/uploaddialog.cpp index 9e6ae83a..08940d0a 100644 --- a/lib/compatibility/knewstuff/uploaddialog.cpp +++ b/lib/compatibility/knewstuff/uploaddialog.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "engine.h" diff --git a/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp b/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp index 47e2d71d..b0f12173 100644 --- a/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp +++ b/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp @@ -33,7 +33,7 @@ #include #ifndef NO_KDE2 -#include +#include #include #include #include diff --git a/lib/compatibility/tdemdi/qextmdi/ktabwidget.cpp b/lib/compatibility/tdemdi/qextmdi/ktabwidget.cpp index 041143d9..3b17a43a 100644 --- a/lib/compatibility/tdemdi/qextmdi/ktabwidget.cpp +++ b/lib/compatibility/tdemdi/qextmdi/ktabwidget.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/lib/compatibility/tdemdi/qextmdi/tdemdichildarea.cpp b/lib/compatibility/tdemdi/qextmdi/tdemdichildarea.cpp index 91dcb4cd..916cee5b 100644 --- a/lib/compatibility/tdemdi/qextmdi/tdemdichildarea.cpp +++ b/lib/compatibility/tdemdi/qextmdi/tdemdichildarea.cpp @@ -30,7 +30,7 @@ #include "tdemdidefines.h" -#include +#include #include #include #include diff --git a/lib/compatibility/tdemdi/qextmdi/tdemdidockcontainer.cpp b/lib/compatibility/tdemdi/qextmdi/tdemdidockcontainer.cpp index 80307785..6099d0c1 100644 --- a/lib/compatibility/tdemdi/qextmdi/tdemdidockcontainer.cpp +++ b/lib/compatibility/tdemdi/qextmdi/tdemdidockcontainer.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include //TODO: Well, this is already defined in tdeui/kdockwidget.cpp diff --git a/lib/compatibility/tdemdi/qextmdi/tdemdiguiclient.cpp b/lib/compatibility/tdemdi/qextmdi/tdemdiguiclient.cpp index e326cc26..bef9fb12 100644 --- a/lib/compatibility/tdemdi/qextmdi/tdemdiguiclient.cpp +++ b/lib/compatibility/tdemdi/qextmdi/tdemdiguiclient.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/qextfileinfo.cpp b/lib/qextfileinfo.cpp index 3aaf5e1b..d13f9733 100644 --- a/lib/qextfileinfo.cpp +++ b/lib/qextfileinfo.cpp @@ -21,11 +21,11 @@ //kde includes #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include diff --git a/lib/qextfileinfo.h b/lib/qextfileinfo.h index 1fbe1093..bb3f3c05 100644 --- a/lib/qextfileinfo.h +++ b/lib/qextfileinfo.h @@ -12,10 +12,10 @@ #ifndef _TQEXTFILEINFO_H_ #define _TQEXTFILEINFO_H_ -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/quanta/components/csseditor/colorrequester.cpp b/quanta/components/csseditor/colorrequester.cpp index 7538ebe9..be7aba50 100644 --- a/quanta/components/csseditor/colorrequester.cpp +++ b/quanta/components/csseditor/colorrequester.cpp @@ -55,7 +55,7 @@ void colorRequester::init() if ( !d->edit ) d->edit = new KLineEdit( this, "line edit" ); - myButton = new KPushButton( this, "kfile button"); + myButton = new KPushButton( this, "tdefile button"); TQIconSet iconSet = SmallIconSet(TQString::fromLatin1("colorize")); TQPixmap pixMap = iconSet.pixmap( TQIconSet::Small, TQIconSet::Normal ); myButton->setIconSet( iconSet ); diff --git a/quanta/components/csseditor/csseditor.cpp b/quanta/components/csseditor/csseditor.cpp index d3586f57..a157adae 100644 --- a/quanta/components/csseditor/csseditor.cpp +++ b/quanta/components/csseditor/csseditor.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "propertysetter.h" diff --git a/quanta/components/csseditor/cssselector.cpp b/quanta/components/csseditor/cssselector.cpp index 7e61cf02..b1da7961 100644 --- a/quanta/components/csseditor/cssselector.cpp +++ b/quanta/components/csseditor/cssselector.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "project.h" #include "stylesheetparser.h" diff --git a/quanta/components/csseditor/tlpeditors.cpp b/quanta/components/csseditor/tlpeditors.cpp index 994876a3..ab70afd6 100644 --- a/quanta/components/csseditor/tlpeditors.cpp +++ b/quanta/components/csseditor/tlpeditors.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "qextfileinfo.h" diff --git a/quanta/components/debugger/dbgp/CMakeLists.txt b/quanta/components/debugger/dbgp/CMakeLists.txt index 868fc177..0652c64d 100644 --- a/quanta/components/debugger/dbgp/CMakeLists.txt +++ b/quanta/components/debugger/dbgp/CMakeLists.txt @@ -34,6 +34,6 @@ tde_add_kpart( quantadebuggerdbgp AUTOMOC quantadebuggerdbgp.cpp dbgpsettingss.ui dbgpsettings.cpp dbgpnetwork.cpp qbytearrayfifo.cpp - LINK debuggerinterface-static kio-shared + LINK debuggerinterface-static tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/quanta/components/framewizard/fmfpeditor.cpp b/quanta/components/framewizard/fmfpeditor.cpp index e2bfb44a..a191cd19 100644 --- a/quanta/components/framewizard/fmfpeditor.cpp +++ b/quanta/components/framewizard/fmfpeditor.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include //#include diff --git a/quanta/data/config/plugins.rc b/quanta/data/config/plugins.rc index 1a5a5c24..d8035b9e 100644 --- a/quanta/data/config/plugins.rc +++ b/quanta/data/config/plugins.rc @@ -15,8 +15,8 @@ Input=3 [KFileReplace] Arguments= -FileName=trinity/libkfilereplacepart.la -Icon=kfilereplace +FileName=trinity/libtdefilereplacepart.la +Icon=tdefilereplace Input=3 Location= OutputWindow=Editor Tab diff --git a/quanta/data/config/quanta_preview_config.desktop b/quanta/data/config/quanta_preview_config.desktop index 4000aa18..a3f2e7d7 100644 --- a/quanta/data/config/quanta_preview_config.desktop +++ b/quanta/data/config/quanta_preview_config.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Type=Service -Exec=kcmshell --caption %c %i tdehtml_behavior tdehtml_java_js tdehtml_fonts cookies cache proxy kcmcss crypto useragent tdehtml_plugins +Exec=tdecmshell --caption %c %i tdehtml_behavior tdehtml_java_js tdehtml_fonts cookies cache proxy kcmcss crypto useragent tdehtml_plugins Icon=konqueror DocPath=konqueror/index.html Name=Configure KHTML Browser Part diff --git a/quanta/data/doc/templates.html b/quanta/data/doc/templates.html index 3043187e..616dfbdc 100644 --- a/quanta/data/doc/templates.html +++ b/quanta/data/doc/templates.html @@ -137,7 +137,7 @@ cool things we took into consideration when using templates in projects. the file to the project templates prior to linking. This will prevent broken links on upload.
  • You always have control where you place your templates so you can choose to move them. However Quanta does not track this so you will need to change links. This is a good - task for kfilereplace which we are setting up to plug in as a kpart.
  • + task for tdefilereplace which we are setting up to plug in as a kpart.

    Templates conclusion diff --git a/quanta/dialogs/actionconfigdialog.cpp b/quanta/dialogs/actionconfigdialog.cpp index 7ae6b4a4..9654c046 100644 --- a/quanta/dialogs/actionconfigdialog.cpp +++ b/quanta/dialogs/actionconfigdialog.cpp @@ -26,7 +26,7 @@ //kde includes #include -#include +#include #include #include #include diff --git a/quanta/dialogs/copyto.cpp b/quanta/dialogs/copyto.cpp index bc2543dc..b5c53356 100644 --- a/quanta/dialogs/copyto.cpp +++ b/quanta/dialogs/copyto.cpp @@ -17,8 +17,8 @@ // qt includes // kde includes -#include -#include +#include +#include //app includes #include "copyto.h" diff --git a/quanta/dialogs/copyto.h b/quanta/dialogs/copyto.h index 29412488..3e021e0a 100644 --- a/quanta/dialogs/copyto.h +++ b/quanta/dialogs/copyto.h @@ -19,7 +19,7 @@ #define COPYTO_H // kde includes -#include +#include /** diff --git a/quanta/dialogs/dirtydlg.cpp b/quanta/dialogs/dirtydlg.cpp index be6f308a..08ce2883 100644 --- a/quanta/dialogs/dirtydlg.cpp +++ b/quanta/dialogs/dirtydlg.cpp @@ -23,10 +23,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include //app includes #include "dirtydialog.h" diff --git a/quanta/dialogs/dirtydlg.h b/quanta/dialogs/dirtydlg.h index 4b6d9232..5fd14e36 100644 --- a/quanta/dialogs/dirtydlg.h +++ b/quanta/dialogs/dirtydlg.h @@ -18,7 +18,7 @@ #define DIRTYDLG_H // kde includes -#include +#include class DirtyDialog; class KDialogBase; diff --git a/quanta/dialogs/dtepeditdlg.cpp b/quanta/dialogs/dtepeditdlg.cpp index bbb3456d..79247f40 100644 --- a/quanta/dialogs/dtepeditdlg.cpp +++ b/quanta/dialogs/dtepeditdlg.cpp @@ -24,8 +24,8 @@ //kde includes #include -#include -#include +#include +#include #include #include #include diff --git a/quanta/dialogs/filecombo.cpp b/quanta/dialogs/filecombo.cpp index 63fd1e58..8f31f692 100644 --- a/quanta/dialogs/filecombo.cpp +++ b/quanta/dialogs/filecombo.cpp @@ -22,7 +22,7 @@ // KDE includes #include -#include +#include #include // app include diff --git a/quanta/dialogs/settings/parseroptions.cpp b/quanta/dialogs/settings/parseroptions.cpp index 92ff1206..1f0e8b3c 100644 --- a/quanta/dialogs/settings/parseroptions.cpp +++ b/quanta/dialogs/settings/parseroptions.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include /* * Constructs a ParserOptions which is a child of 'parent', with the diff --git a/quanta/dialogs/tagdialogs/colorcombo.cpp b/quanta/dialogs/tagdialogs/colorcombo.cpp index 19331def..ebe9a7fd 100644 --- a/quanta/dialogs/tagdialogs/colorcombo.cpp +++ b/quanta/dialogs/tagdialogs/colorcombo.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include diff --git a/quanta/dialogs/tagdialogs/tagdialog.cpp b/quanta/dialogs/tagdialogs/tagdialog.cpp index 90f5f80c..fe466986 100644 --- a/quanta/dialogs/tagdialogs/tagdialog.cpp +++ b/quanta/dialogs/tagdialogs/tagdialog.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/quanta/dialogs/tagdialogs/tagimgdlg.cpp b/quanta/dialogs/tagdialogs/tagimgdlg.cpp index d2a680f5..24578a88 100644 --- a/quanta/dialogs/tagdialogs/tagimgdlg.cpp +++ b/quanta/dialogs/tagdialogs/tagimgdlg.cpp @@ -22,8 +22,8 @@ //kde includes #include #include -#include -#include +#include +#include #include //app includes diff --git a/quanta/messages/annotationoutput.cpp b/quanta/messages/annotationoutput.cpp index 6888f462..e42eef5d 100644 --- a/quanta/messages/annotationoutput.cpp +++ b/quanta/messages/annotationoutput.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/quanta/messages/messageoutput.cpp b/quanta/messages/messageoutput.cpp index 2d126794..210ee532 100644 --- a/quanta/messages/messageoutput.cpp +++ b/quanta/messages/messageoutput.cpp @@ -18,7 +18,7 @@ // KDE includes #include #include -#include +#include #include #include #include diff --git a/quanta/parsers/dtd/dtd.cpp b/quanta/parsers/dtd/dtd.cpp index 34826ca4..19ccc218 100644 --- a/quanta/parsers/dtd/dtd.cpp +++ b/quanta/parsers/dtd/dtd.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/parsers/dtd/dtdparser.cpp b/quanta/parsers/dtd/dtdparser.cpp index 07d571f8..52bd35c8 100644 --- a/quanta/parsers/dtd/dtdparser.cpp +++ b/quanta/parsers/dtd/dtdparser.cpp @@ -23,13 +23,13 @@ #include //kde includes -#include +#include #include #include #include #include #include -#include +#include //other includes #ifdef LIBXML_2_5 diff --git a/quanta/parts/kafka/htmlenhancer.cpp b/quanta/parts/kafka/htmlenhancer.cpp index 8077a76b..32c58bc1 100644 --- a/quanta/parts/kafka/htmlenhancer.cpp +++ b/quanta/parts/kafka/htmlenhancer.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "quantacommon.h" #include "document.h" diff --git a/quanta/parts/kafka/kafkasyncoptions.cpp b/quanta/parts/kafka/kafkasyncoptions.cpp index 2c37f0cd..2e6db3f9 100644 --- a/quanta/parts/kafka/kafkasyncoptions.cpp +++ b/quanta/parts/kafka/kafkasyncoptions.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "kafkasyncoptions.h" diff --git a/quanta/parts/kafka/undoredo.cpp b/quanta/parts/kafka/undoredo.cpp index c7345467..a342a23f 100644 --- a/quanta/parts/kafka/undoredo.cpp +++ b/quanta/parts/kafka/undoredo.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/quanta/parts/preview/whtmlpart.cpp b/quanta/parts/preview/whtmlpart.cpp index 94552890..bc39e1af 100644 --- a/quanta/parts/preview/whtmlpart.cpp +++ b/quanta/parts/preview/whtmlpart.cpp @@ -20,7 +20,7 @@ #include //kde includes -#include +#include #include #include #include diff --git a/quanta/plugins/quantapluginconfig.cpp b/quanta/plugins/quantapluginconfig.cpp index 62f25553..02bb3724 100644 --- a/quanta/plugins/quantapluginconfig.cpp +++ b/quanta/plugins/quantapluginconfig.cpp @@ -17,7 +17,7 @@ /* KDE INCLUDES */ #include -#include +#include #include #include #include diff --git a/quanta/plugins/quantaplugineditor.cpp b/quanta/plugins/quantaplugineditor.cpp index 347ae9c6..6c8245f3 100644 --- a/quanta/plugins/quantaplugineditor.cpp +++ b/quanta/plugins/quantaplugineditor.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ /* KDE INCLUDES */ -#include +#include #include #include #include diff --git a/quanta/plugins/quantaplugininterface.cpp b/quanta/plugins/quantaplugininterface.cpp index fc9a8823..51a2cf25 100644 --- a/quanta/plugins/quantaplugininterface.cpp +++ b/quanta/plugins/quantaplugininterface.cpp @@ -17,7 +17,7 @@ /* KDE INCLUDES */ #include -#include +#include #include #include #include diff --git a/quanta/plugins/quantaplugininterface.h b/quanta/plugins/quantaplugininterface.h index 5e876a5e..28458fad 100644 --- a/quanta/plugins/quantaplugininterface.h +++ b/quanta/plugins/quantaplugininterface.h @@ -19,7 +19,7 @@ #define QUANTAPLUGININTERFACE_H /* KDE INCLUDES */ -#include +#include #include /* QT INCLUDES */ diff --git a/quanta/project/project.cpp b/quanta/project/project.cpp index 6d5593d8..560b4e7e 100644 --- a/quanta/project/project.cpp +++ b/quanta/project/project.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/quanta/project/projectnewgeneral.cpp b/quanta/project/projectnewgeneral.cpp index fe6030bb..c60a9ac2 100644 --- a/quanta/project/projectnewgeneral.cpp +++ b/quanta/project/projectnewgeneral.cpp @@ -26,7 +26,7 @@ #include // kde includes -#include +#include #include #include #include diff --git a/quanta/project/projectnewlocal.cpp b/quanta/project/projectnewlocal.cpp index 97d824f4..b430b43b 100644 --- a/quanta/project/projectnewlocal.cpp +++ b/quanta/project/projectnewlocal.cpp @@ -28,7 +28,7 @@ // kde includes #include #include -#include +#include #include #include #include diff --git a/quanta/project/projectnewweb.cpp b/quanta/project/projectnewweb.cpp index 31d3f620..7d62d276 100644 --- a/quanta/project/projectnewweb.cpp +++ b/quanta/project/projectnewweb.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/project/projectoptions.ui.h b/quanta/project/projectoptions.ui.h index 3d0200aa..ef8ab07d 100644 --- a/quanta/project/projectoptions.ui.h +++ b/quanta/project/projectoptions.ui.h @@ -16,7 +16,7 @@ ***************************************************************************/ #include -#include +#include #include #include #include diff --git a/quanta/project/projectprivate.cpp b/quanta/project/projectprivate.cpp index c488acc0..305831ab 100644 --- a/quanta/project/projectprivate.cpp +++ b/quanta/project/projectprivate.cpp @@ -30,11 +30,11 @@ #include #include #include -#include +#include #include -#include +#include #include -#include +#include #include #include #include diff --git a/quanta/project/projectupload.cpp b/quanta/project/projectupload.cpp index 1f389cb4..6d075127 100644 --- a/quanta/project/projectupload.cpp +++ b/quanta/project/projectupload.cpp @@ -36,12 +36,12 @@ //kde includes #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/quanta/project/projectupload.h b/quanta/project/projectupload.h index bd341eec..c3071899 100644 --- a/quanta/project/projectupload.h +++ b/quanta/project/projectupload.h @@ -25,7 +25,7 @@ #include #include -#include +#include /** *@author Dmitry Poplavsky & Alexander Yakovlev & Andras Mantia diff --git a/quanta/project/rescanprj.cpp b/quanta/project/rescanprj.cpp index 5f5ebc71..e04fd444 100644 --- a/quanta/project/rescanprj.cpp +++ b/quanta/project/rescanprj.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/project/rescanprj.h b/quanta/project/rescanprj.h index da3844ac..5c36efb9 100644 --- a/quanta/project/rescanprj.h +++ b/quanta/project/rescanprj.h @@ -19,7 +19,7 @@ #define RESCANPRJ_H #include -#include +#include #include "rescanprjdir.h" diff --git a/quanta/quanta.tdevelop b/quanta/quanta.tdevelop index c5729fab..2a70d8f0 100644 --- a/quanta/quanta.tdevelop +++ b/quanta/quanta.tdevelop @@ -88,7 +88,7 @@ - + diff --git a/quanta/src/document.cpp b/quanta/src/document.cpp index f6531e68..dee83bca 100644 --- a/quanta/src/document.cpp +++ b/quanta/src/document.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/src/dtds.cpp b/quanta/src/dtds.cpp index 9a91f304..642c3da7 100644 --- a/quanta/src/dtds.cpp +++ b/quanta/src/dtds.cpp @@ -28,7 +28,7 @@ // include files for KDE #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ #include #include #include -#include +#include // application specific includes diff --git a/quanta/src/kqapp.cpp b/quanta/src/kqapp.cpp index 33a68e91..53b73ea2 100644 --- a/quanta/src/kqapp.cpp +++ b/quanta/src/kqapp.cpp @@ -18,7 +18,7 @@ #include -#include +#include #include #include #include diff --git a/quanta/src/quanta.cpp b/quanta/src/quanta.cpp index f604bc43..d0e862ff 100644 --- a/quanta/src/quanta.cpp +++ b/quanta/src/quanta.cpp @@ -58,10 +58,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -107,7 +107,7 @@ #include #include -#include +#include #ifdef ENABLE_CVSSERVICE #include "cvsservice.h" @@ -195,7 +195,7 @@ extern int NN; const TQString resourceDir = TQString(QUANTA_PACKAGE) + "/"; -// from kfiledialog.cpp - avoid qt warning in STDERR (~/.xsessionerrors) +// from tdefiledialog.cpp - avoid qt warning in STDERR (~/.xsessionerrors) static void silenceTQToolBar(TQtMsgType, const char *){} QuantaApp::QuantaApp(int mdiMode) : DCOPObject("WindowManagerIf"), KMdiMainFrm( 0, "Quanta", (KMdi::MdiMode) mdiMode) diff --git a/quanta/src/quanta_init.cpp b/quanta/src/quanta_init.cpp index 77883967..48f106b0 100644 --- a/quanta/src/quanta_init.cpp +++ b/quanta/src/quanta_init.cpp @@ -40,11 +40,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include @@ -1412,7 +1412,7 @@ void QuantaInit::checkRuntimeDependencies() dependency.name = i18n("Control Center (tdebase)"); - dependency.execName = "kcmshell"; + dependency.execName = "tdecmshell"; dependency.url = "http://www.kde.org"; dependency.description = i18n("preview browser configuration"); dependency.type = Dependency::Executable; @@ -1427,7 +1427,7 @@ void QuantaInit::checkRuntimeDependencies() dependency.name = "KFileReplace"; dependency.execName = "KFileReplace"; - dependency.url = "http://kfilereplace.tdewebdev.org"; + dependency.url = "http://tdefilereplace.tdewebdev.org"; dependency.description = i18n("search and replace in files"); dependency.type = Dependency::Plugin; dependencies.append(dependency); diff --git a/quanta/src/quantadoc.cpp b/quanta/src/quantadoc.cpp index 6a05a444..eb463cf6 100644 --- a/quanta/src/quantadoc.cpp +++ b/quanta/src/quantadoc.cpp @@ -29,7 +29,7 @@ // include files for KDE #include #include -#include +#include #include #include #include diff --git a/quanta/src/viewmanager.cpp b/quanta/src/viewmanager.cpp index 644e50a7..7cf9a1ed 100644 --- a/quanta/src/viewmanager.cpp +++ b/quanta/src/viewmanager.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include //app includes diff --git a/quanta/treeviews/basetreeview.cpp b/quanta/treeviews/basetreeview.cpp index 7ff962e1..b2d774fc 100644 --- a/quanta/treeviews/basetreeview.cpp +++ b/quanta/treeviews/basetreeview.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/quanta/treeviews/basetreeview.h b/quanta/treeviews/basetreeview.h index bf7110cf..bef646ae 100644 --- a/quanta/treeviews/basetreeview.h +++ b/quanta/treeviews/basetreeview.h @@ -22,9 +22,9 @@ #include //kde includes -#include -#include -#include +#include +#include +#include // quanta includes #include "quantacommon.h" diff --git a/quanta/treeviews/docfolder.cpp b/quanta/treeviews/docfolder.cpp index 3e7e8949..3d028451 100644 --- a/quanta/treeviews/docfolder.cpp +++ b/quanta/treeviews/docfolder.cpp @@ -20,7 +20,7 @@ #include // KDE includes -#include +#include #include #include diff --git a/quanta/treeviews/docitem.cpp b/quanta/treeviews/docitem.cpp index f24c3bb9..3fb4ac2f 100644 --- a/quanta/treeviews/docitem.cpp +++ b/quanta/treeviews/docitem.cpp @@ -17,7 +17,7 @@ #include -#include +#include #include "docitem.h" diff --git a/quanta/treeviews/doctreeview.cpp b/quanta/treeviews/doctreeview.cpp index 31579563..684072a5 100644 --- a/quanta/treeviews/doctreeview.cpp +++ b/quanta/treeviews/doctreeview.cpp @@ -22,7 +22,7 @@ #include // KDE clases -#include +#include #include #include #include diff --git a/quanta/treeviews/filestreeview.cpp b/quanta/treeviews/filestreeview.cpp index b9a0ac1d..eee9e6fb 100644 --- a/quanta/treeviews/filestreeview.cpp +++ b/quanta/treeviews/filestreeview.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/treeviews/servertreeview.cpp b/quanta/treeviews/servertreeview.cpp index 4c9a821f..fa34f582 100644 --- a/quanta/treeviews/servertreeview.cpp +++ b/quanta/treeviews/servertreeview.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/treeviews/structtreeview.cpp b/quanta/treeviews/structtreeview.cpp index f744e52d..4fa7afa9 100644 --- a/quanta/treeviews/structtreeview.cpp +++ b/quanta/treeviews/structtreeview.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/quanta/treeviews/templatestreeview.cpp b/quanta/treeviews/templatestreeview.cpp index bd00665f..a9aa75d0 100644 --- a/quanta/treeviews/templatestreeview.cpp +++ b/quanta/treeviews/templatestreeview.cpp @@ -48,11 +48,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include "templatestreeview.h" diff --git a/quanta/treeviews/uploadtreefile.cpp b/quanta/treeviews/uploadtreefile.cpp index 9c055424..5257117e 100644 --- a/quanta/treeviews/uploadtreefile.cpp +++ b/quanta/treeviews/uploadtreefile.cpp @@ -19,7 +19,7 @@ #include // KDE includes -#include +#include #include #include diff --git a/quanta/treeviews/uploadtreeview.cpp b/quanta/treeviews/uploadtreeview.cpp index 259b81dc..4c5af524 100644 --- a/quanta/treeviews/uploadtreeview.cpp +++ b/quanta/treeviews/uploadtreeview.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "uploadtreeview.h" #include "quantacommon.h" diff --git a/quanta/utility/quantabookmarks.cpp b/quanta/utility/quantabookmarks.cpp index c27e07a7..0678a972 100644 --- a/quanta/utility/quantabookmarks.cpp +++ b/quanta/utility/quantabookmarks.cpp @@ -21,7 +21,7 @@ #include "quantabookmarks.h" #include -#include +#include #include #include #include diff --git a/quanta/utility/quantacommon.cpp b/quanta/utility/quantacommon.cpp index e29c1013..e7f9380d 100644 --- a/quanta/utility/quantacommon.cpp +++ b/quanta/utility/quantacommon.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/quanta/utility/quantanetaccess.cpp b/quanta/utility/quantanetaccess.cpp index 6fa248eb..eb47cb86 100644 --- a/quanta/utility/quantanetaccess.cpp +++ b/quanta/utility/quantanetaccess.cpp @@ -17,11 +17,11 @@ #include #include -#include +#include #include #include #include -#include +#include #include #include "qextfileinfo.h" diff --git a/quanta/utility/tagactionset.cpp b/quanta/utility/tagactionset.cpp index 58af9c65..a5397df8 100644 --- a/quanta/utility/tagactionset.cpp +++ b/quanta/utility/tagactionset.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ #include -#include +#include #include #include #include diff --git a/tdefilereplace/CMakeLists.txt b/tdefilereplace/CMakeLists.txt new file mode 100644 index 00000000..621c0e02 --- /dev/null +++ b/tdefilereplace/CMakeLists.txt @@ -0,0 +1,56 @@ +################################################# +# +# (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} +) diff --git a/tdefilereplace/ChangeLog b/tdefilereplace/ChangeLog new file mode 100644 index 00000000..b94d65f5 --- /dev/null +++ b/tdefilereplace/ChangeLog @@ -0,0 +1,211 @@ +2005-02-20: Andras Mantia + * 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 + * Accept paths as command line arguments + +2005-01-29 Emiliano Gulmini + * Cleaning up. + +2005-01-23 Emiliano Gulmini + * 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 + * 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 + * 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 + * 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 + * 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 '' just after the root 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 + * 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 + * 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 + * 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 + * 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 + * I did some cleanup. + +2004-09-11 Emiliano Gulmini + * 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 + * 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 + * I fixed a bug that affected the method "void KFileReplaceView::slotStringsClear()" in tdefilereplaceview.cpp file. + This bug caused the list of strings not to be correctly erased. + +2004-08-07 Emiliano Gulmini + * 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 + * 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 + * The icons have been fixed!!! What a miracle!!! + +2004-07-24 Emiliano Gulmini + * 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 + * I fixed a bug that affects the generation of extension of + the backup files. + +2004-07-17 Emiliano Gulmini + * 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 + * 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 + * 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 + * Added a feature. Now we can open a file from the result view of KFR in Quanta(thanks Andras). + +2004-03-14 Emiliano Gulmini + * 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 + * Removed KresultView(.h,.cpp). Now KFileReplaceView 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 + * 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 + * 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 + * 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 + * 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 klistviewstring.(h,cpp) were removed. + * A lot of clean up has been made in all files. diff --git a/tdefilereplace/Makefile.am b/tdefilereplace/Makefile.am new file mode 100644 index 00000000..8d2584c0 --- /dev/null +++ b/tdefilereplace/Makefile.am @@ -0,0 +1,43 @@ +## 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 -lkio -ltdeparts -lDCOP +libtdefilereplacepart_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) $(LIB_KHTML) + +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 -lkio -ltdeparts -lDCOP +tdefilereplace_LDADD = $(LIB_KPARTS) +tdefilereplace_SOURCES = tdefilereplace.cpp main.cpp diff --git a/tdefilereplace/commandengine.cpp b/tdefilereplace/commandengine.cpp new file mode 100644 index 00000000..5184773c --- /dev/null +++ b/tdefilereplace/commandengine.cpp @@ -0,0 +1,213 @@ +/*************************************************************************** + 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 +#include +#include +#include + +// KDE +#include +#include +#include + +// 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 */ + //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" diff --git a/tdefilereplace/commandengine.h b/tdefilereplace/commandengine.h new file mode 100644 index 00000000..36bcfcb8 --- /dev/null +++ b/tdefilereplace/commandengine.h @@ -0,0 +1,58 @@ +/*************************************************************************** + 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 + +//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 diff --git a/tdefilereplace/configurationclasses.cpp b/tdefilereplace/configurationclasses.cpp new file mode 100644 index 00000000..f0c6bcc4 --- /dev/null +++ b/tdefilereplace/configurationclasses.cpp @@ -0,0 +1,188 @@ +/*************************************************************************** + 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()); +} diff --git a/tdefilereplace/configurationclasses.h b/tdefilereplace/configurationclasses.h new file mode 100644 index 00000000..206de1c4 --- /dev/null +++ b/tdefilereplace/configurationclasses.h @@ -0,0 +1,165 @@ +/*************************************************************************** + configurationclasses.h - description + ------------------- + begin : Sat Apr 17 2004 + copyright : (C) 2004 Emiliano Gulmini + email : + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 +#include +#include +#include +#include + +typedef TQMap 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 diff --git a/tdefilereplace/configure.in.in b/tdefilereplace/configure.in.in new file mode 100644 index 00000000..787f832f --- /dev/null +++ b/tdefilereplace/configure.in.in @@ -0,0 +1,12 @@ +#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) diff --git a/tdefilereplace/hi22-app-tdefilereplace.png b/tdefilereplace/hi22-app-tdefilereplace.png new file mode 100644 index 00000000..429a3984 Binary files /dev/null and b/tdefilereplace/hi22-app-tdefilereplace.png differ diff --git a/tdefilereplace/hi32-app-tdefilereplace.png b/tdefilereplace/hi32-app-tdefilereplace.png new file mode 100644 index 00000000..8dff2abb Binary files /dev/null and b/tdefilereplace/hi32-app-tdefilereplace.png differ diff --git a/tdefilereplace/hi48-app-tdefilereplace.png b/tdefilereplace/hi48-app-tdefilereplace.png new file mode 100644 index 00000000..c11f34ba Binary files /dev/null and b/tdefilereplace/hi48-app-tdefilereplace.png differ diff --git a/tdefilereplace/kaddstringdlg.cpp b/tdefilereplace/kaddstringdlg.cpp new file mode 100644 index 00000000..a87ff7be --- /dev/null +++ b/tdefilereplace/kaddstringdlg.cpp @@ -0,0 +1,273 @@ +/*************************************************************************** + KAddStringDlg.cpp - description + ------------------- + begin : Sat Oct 16 1999 + copyright : (C) 1999 by Fran�ois Dupoux + (C) 2004 Emiliano Gulmini + 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 +#include +#include +#include +#include +#include +#include + +// KDE +#include +#include +#include +#include +#include + +// 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(); + + // Do nothing if list is empty + if(currentItem == 0) + return; + + m_currentMap.remove(currentItem->text(0)); + + if(m_option->m_searchingOnlyMode) + { + m_edSearch->setText(currentItem->text(0)); + m_edReplace->clear(); + //currentItem->setText(1,m_edReplace->text()); + } + else + { + m_edSearch->setText(currentItem->text(0)); + m_edReplace->setText(currentItem->text(1)); + } + + delete currentItem; + + currentItem = 0; +} + +void KAddStringDlg::slotHelp() +{ + kapp->invokeHelp(TQString(), "tdefilereplace"); +} + +#include "kaddstringdlg.moc" + diff --git a/tdefilereplace/kaddstringdlg.h b/tdefilereplace/kaddstringdlg.h new file mode 100644 index 00000000..f39c2961 --- /dev/null +++ b/tdefilereplace/kaddstringdlg.h @@ -0,0 +1,76 @@ +/*************************************************************************** + KAddStringDlg.h - description + ------------------- + begin : Sat Oct 16 1999 + copyright : (C) 1999 by Franois Dupoux + (C) 2004 Emiliano Gulmini + 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. * + * * + ***************************************************************************/ + +#ifndef KADDSTRINGDLG_H +#define KADDSTRINGDLG_H + +// local +#include "kaddstringdlgs.h" +#include "configurationclasses.h" +/** + * This is the dialog used to add a list of searching/replacing strings + */ +class KAddStringDlg : public KAddStringDlgS +{ + Q_OBJECT + + private: + RCOptions* m_option; + TQListView* m_sv; + KeyValueMap m_currentMap; + bool m_wantEdit; + + public: //Constructors + KAddStringDlg(RCOptions* info, bool wantEdit, TQWidget *parent=0, const char *name=0); + + private slots: + void slotOK(); + void slotSearchOnly(); + void slotSearchReplace(); + void slotAddStringToView(); + void slotDeleteStringFromView(); + void slotHelp(); + + private: + /** + * inits... the GUI :-) + */ + void initGUI(); + /** + * Deletes all the items of the view + */ + void eraseViewItems(); + /** + * Deletes all the items of the map + */ + void clearMap() { KeyValueMap m; m_option->m_mapStringsView = m; } + /** + * The view is actually a stack widget that contains two different views widget + */ + void raiseView(); + /** + * Verifies whether 'lv' contains 's' + */ + bool columnContains(TQListView* lv,const TQString& s, int column); + void saveViewContentIntoMap(); + void loadMapIntoView(); + void whatsThis(); +}; + +#endif // KADDSTRINGDLG_H + diff --git a/tdefilereplace/kaddstringdlgs.ui b/tdefilereplace/kaddstringdlgs.ui new file mode 100644 index 00000000..563aa33f --- /dev/null +++ b/tdefilereplace/kaddstringdlgs.ui @@ -0,0 +1,426 @@ + +KAddStringDlgS + + + KAddStringDlgS + + + + 0 + 0 + 586 + 347 + + + + Insert Searching/Replacing Strings + + + true + + + + unnamed + + + + layout14 + + + + unnamed + + + + bgChoose + + + Choose String Adding Mode + + + true + + + + unnamed + + + + m_rbSearchReplace + + + Search and replace mode + + + + + + + + m_rbSearchOnly + + + Search only mode + + + true + + + + + + + frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + + layout11 + + + + unnamed + + + + layout13 + + + + unnamed + + + + m_tlSearch + + + Search for: + + + + + m_edSearch + + + PlainText + + + + + + + layout14 + + + + unnamed + + + + m_tlReplace + + + false + + + Replace with: + + + + + m_edReplace + + + false + + + PlainText + + + AutoAll + + + + + + + + + layout16 + + + + unnamed + + + + spacer8 + + + Vertical + + + Expanding + + + + 20 + 90 + + + + + + layout15 + + + + unnamed + + + + m_pbDel + + + + 30 + 32767 + + + + + + + + + m_pbAdd + + + + 30 + 32767 + + + + + + + false + + + + + + + spacer9 + + + Vertical + + + Expanding + + + + 20 + 90 + + + + + + + + m_stack + + + + 7 + 7 + 0 + 0 + + + + + WStackPage + + + 0 + + + + unnamed + + + 0 + + + + + Search For + + + true + + + true + + + + m_stringView_2 + + + true + + + false + + + AllColumns + + + + + + + WStackPage + + + 1 + + + + unnamed + + + 0 + + + + + Search For + + + true + + + true + + + + + Replace With + + + true + + + true + + + + m_stringView + + + true + + + false + + + AllColumns + + + + + + + + + + layout2 + + + + unnamed + + + + m_pbHelp + + + true + + + &Help + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 90 + 20 + + + + + + layout1 + + + + unnamed + + + + m_pbOK + + + &OK + + + + + m_pbCancel + + + &Cancel + + + + + + + + + + + + + m_pbCancel + clicked() + KAddStringDlgS + reject() + + + + diff --git a/tdefilereplace/knewprojectdlg.cpp b/tdefilereplace/knewprojectdlg.cpp new file mode 100644 index 00000000..4e9c9281 --- /dev/null +++ b/tdefilereplace/knewprojectdlg.cpp @@ -0,0 +1,531 @@ +/*************************************************************************** + knewprojectdlg.cpp - description + ------------------- + begin : Tue Dec 28 1999 + copyright : (C) 1999 by Fran�is Dupoux + (C) 2004 Emiliano Gulmini + 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 +#include +#include +#include +#include +#include +#include +#include + +//KDE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// local +#include "knewprojectdlg.h" +#include "whatthis.h" + +using namespace whatthisNameSpace; + + +KNewProjectDlg::KNewProjectDlg(RCOptions* info, TQWidget *parent, const char *name) : KNewProjectDlgS(parent, name) +{ + m_searchNowFlag = ""; + m_option = info; + + initGUI(); + + connect(m_pbLocation, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDir())); + connect(m_pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotReject())); + connect(m_pbSearchNow, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchNow())); + connect(m_pbSearchLater, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchLater())); + connect(m_leSearch, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotSearchLineEdit(const TQString&))); + connect(m_chbSizeMin, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableSpinboxSizeMin(bool))); + connect(m_chbSizeMax, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableSpinboxSizeMax(bool))); + connect(m_chbDateMin, TQT_SIGNAL(toggled(bool)), m_dedDateMin, TQT_SLOT(setEnabled(bool))); + connect(m_chbDateMax, TQT_SIGNAL(toggled(bool)), m_dedDateMax, TQT_SLOT(setEnabled(bool))); + connect(m_chbDateMin,TQT_SIGNAL(toggled(bool)),this, TQT_SLOT(slotEnableCbValidDate(bool))); + connect(m_chbDateMax,TQT_SIGNAL(toggled(bool)),this, TQT_SLOT(slotEnableCbValidDate(bool))); + connect(m_chbOwnerUser, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbUser(bool))); + connect(m_chbOwnerGroup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbGroup(bool))); + connect(m_chbBackup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChbBackup(bool))); + connect(m_pbHelp, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotHelp())); + + whatsThis(); +} + +KNewProjectDlg::~KNewProjectDlg() +{ +} + +void KNewProjectDlg::saveRCOptions() +{ + saveOptions(); + saveFileSizeOptions(); + saveDateAccessOptions(); + saveOwnerOptions(); + saveLocationsList(); + saveFiltersList(); + saveBackupExtensionOptions(); +} + +void KNewProjectDlg::slotDir() +{ + TQString directoryString = KFileDialog::getExistingDirectory(TQString(), this, i18n("Project Directory")); + if(!directoryString.isEmpty()) + m_cbLocation->setEditText(directoryString); +} + +void KNewProjectDlg::slotOK() +{ + // Check that Search text and Filter are not empty + m_option->m_directories = m_cbLocation->currentText(); + m_option->m_filters = m_cbFilter->currentText(); + if(!m_leSearch->text().isEmpty()) + { + if(m_leReplace->text().isEmpty()) + m_option->m_searchingOnlyMode = true; + else + m_option->m_searchingOnlyMode = false; + } + m_option->m_quickSearchString = m_searchNowFlag + m_leSearch->text(); + m_option->m_quickReplaceString = m_searchNowFlag + m_leReplace->text(); + + if (m_option->m_directories.isEmpty() || m_option->m_filters.isEmpty()) + { + KMessageBox::error(this, i18n("You must fill the combo boxes (location and filter) before continuing.")); + return; + } + + // OWNER OPTIONS + if ((m_chbOwnerUser->isChecked() && m_edOwnerUser->text().isEmpty()) || + (m_chbOwnerGroup->isChecked() && m_edOwnerGroup->text().isEmpty())) + { + KMessageBox::error(this, i18n("Some edit boxes are empty in the Owner page.")); + return ; + } + + // Check option "Size Min/Max": check MinSize is not greater than MaxSize + int minSize = m_spbSizeMin->value(), + maxSize = m_spbSizeMax->value(); + if ((minSize != FileSizeOption) && (maxSize != FileSizeOption)) + if (minSize > maxSize) + { + KMessageBox::error(this, i18n("The minimum size is greater than the maximum size.")); + return ; + } + + accept(); +} + +void KNewProjectDlg::slotReject() +{ + m_option->m_quickSearchString = m_searchNowFlag; + m_option->m_quickReplaceString = m_searchNowFlag; + + reject(); +} + +void KNewProjectDlg::slotSearchNow() +{ //Add a 'N' to represent the status search-now + m_searchNowFlag = "N"; + slotOK(); +} + +void KNewProjectDlg::slotSearchLater() +{ //Add a 'L' to represent the status search-later + m_searchNowFlag = "L"; + slotOK(); +} + +void KNewProjectDlg::slotSearchLineEdit(const TQString& t) +{ + m_pbSearchNow->setEnabled(!t.isEmpty()); +} + +void KNewProjectDlg::slotEnableSpinboxSizeMin(bool b) +{ + m_spbSizeMin->setEnabled(b); +} + +void KNewProjectDlg::slotEnableSpinboxSizeMax(bool b) +{ + m_spbSizeMax->setEnabled(b); +} + +void KNewProjectDlg::slotEnableCbValidDate(bool b) +{ + Q_UNUSED(b); + m_cbDateValid->setEnabled(m_chbDateMax->isChecked() || m_chbDateMin->isChecked()); +} + +void KNewProjectDlg::slotEnableChbUser(bool b) +{ + m_cbOwnerUserType->setEnabled(b); + m_cbOwnerUserBool->setEnabled(b); + m_edOwnerUser->setEnabled(b); +} + +void KNewProjectDlg::slotEnableChbGroup(bool b) +{ + m_cbOwnerGroupType->setEnabled(b); + m_cbOwnerGroupBool->setEnabled(b); + m_edOwnerGroup->setEnabled(b); +} + +void KNewProjectDlg::slotEnableChbBackup(bool b) +{ + m_leBackup->setEnabled(b); + m_tlBackup->setEnabled(b); +} + +//PRIVATE +void KNewProjectDlg::initGUI() +{ + TQIconSet iconSet = SmallIconSet("fileopen"); + TQPixmap pixMap = iconSet.pixmap( TQIconSet::Small, TQIconSet::Normal ); + + m_pbLocation->setIconSet(iconSet); + m_pbLocation->setFixedSize(pixMap.width() + 8, pixMap.height() + 8); + + m_pbSearchNow->setEnabled(false); + + loadOptions(); + loadFileSizeOptions(); + loadDateAccessOptions(); + loadOwnerOptions(); + loadBackupExtensionOptions(); + loadLocationsList(); + loadFiltersList(); +} + +void KNewProjectDlg::loadOptions() +{ + TQStringList availableEncodingNames(TDEGlobal::charsets()->availableEncodingNames()); + m_cbEncoding->insertStringList(availableEncodingNames); + int idx = -1; + int utf8Idx = -1; + for (uint i = 0; i < availableEncodingNames.count(); i++) + { + if (availableEncodingNames[i] == m_option->m_encoding) + { + idx = i; + break; + } + if (availableEncodingNames[i] == "utf8") + { + utf8Idx = i; + } + } + if (idx != -1) + m_cbEncoding->setCurrentItem(idx); + else + m_cbEncoding->setCurrentItem(utf8Idx); + + m_chbIncludeSubfolders->setChecked(m_option->m_recursive); + m_chbCaseSensitive->setChecked(m_option->m_caseSensitive); + m_chbEnableVariables->setChecked(m_option->m_variables); + m_chbRegularExpressions->setChecked(m_option->m_regularExpressions); +} + +void KNewProjectDlg::loadFileSizeOptions() +{ + int size = m_option->m_minSize; + if(size == FileSizeOption) + { + m_chbSizeMin->setChecked(false); + m_spbSizeMin->setEnabled(false); + m_spbSizeMin->setValue(0); + } + else + { + m_chbSizeMin->setChecked(true); + m_spbSizeMin->setEnabled(true); + m_spbSizeMin->setValue(size); + } + + size = m_option->m_maxSize; + if(size == FileSizeOption) + { + m_chbSizeMax->setChecked(false); + m_spbSizeMax->setEnabled(false); + m_spbSizeMax->setValue(0); + } + else + { + m_chbSizeMax->setChecked(true); + m_spbSizeMax->setEnabled(true); + m_spbSizeMax->setValue(size); + } +} + +void KNewProjectDlg::loadDateAccessOptions() +{ + // ================== DATE OPTIONS ======================== + + TQString date = m_option->m_minDate; + if(date == AccessDateOption) + { + m_chbDateMin->setChecked(false); + m_dedDateMin->setDate(m_dedDateMin->minValue()); + m_dedDateMin->setEnabled(false); + } + else + { + m_chbDateMin->setChecked(true); + m_dedDateMin->setDate(TQDate::fromString(date,Qt::ISODate)); + m_dedDateMin->setEnabled(true); + } + + date = m_option->m_maxDate; + if(date == AccessDateOption) + { + m_chbDateMax->setChecked(false); + m_dedDateMax->setDate(m_dedDateMax->maxValue()); + m_dedDateMax->setEnabled(false); + } + else + { + m_chbDateMax->setChecked(true); + m_dedDateMax->setDate(TQDate::fromString(date,Qt::ISODate)); + m_dedDateMax->setEnabled(true); + } + + m_cbDateValid->setEnabled(m_chbDateMax->isChecked() || m_chbDateMin->isChecked()); + +} + +void KNewProjectDlg::loadOwnerOptions() +{ + bool enableOwner = m_option->m_ownerUserIsChecked; + + m_chbOwnerUser->setChecked(enableOwner); + m_cbOwnerUserType->setEnabled(enableOwner); + m_cbOwnerUserBool->setEnabled(enableOwner); + m_edOwnerUser->setEnabled(enableOwner); + + m_cbOwnerUserType->setCurrentText(m_option->m_ownerUserType); + m_cbOwnerUserBool->setCurrentText(m_option->m_ownerUserBool); + + m_edOwnerUser->setText(m_option->m_ownerUserValue); + + enableOwner = m_option->m_ownerGroupIsChecked; + + m_chbOwnerGroup->setChecked(enableOwner); + m_cbOwnerGroupType->setEnabled(enableOwner); + m_cbOwnerGroupBool->setEnabled(enableOwner); + m_edOwnerGroup->setEnabled(enableOwner); + + m_cbOwnerGroupType->setCurrentText(m_option->m_ownerGroupType); + m_cbOwnerGroupBool->setCurrentText(m_option->m_ownerGroupBool); + m_edOwnerGroup->setText(m_option->m_ownerGroupValue); +} + +void KNewProjectDlg::loadLocationsList() +{ + m_cbLocation->insertStringList(m_option->m_directories); +} + +void KNewProjectDlg::loadFiltersList() +{ + m_cbFilter->insertStringList(m_option->m_filters); +} + +void KNewProjectDlg::loadBackupExtensionOptions() +{ + bool enableBackup = m_option->m_backup; + + m_chbBackup->setChecked(enableBackup); + m_leBackup->setEnabled(enableBackup); + m_tlBackup->setEnabled(enableBackup); + m_leBackup->setText(m_option->m_backupExtension); +} + +void KNewProjectDlg::saveOptions() +{ + m_option->m_encoding = m_cbEncoding->currentText(); + m_option->m_recursive = m_chbIncludeSubfolders->isChecked(); + m_option->m_caseSensitive = m_chbCaseSensitive->isChecked(); + m_option->m_variables = m_chbEnableVariables->isChecked(); + m_option->m_regularExpressions = m_chbRegularExpressions->isChecked(); +} + +void KNewProjectDlg::saveFileSizeOptions() +{ + if(m_chbSizeMax->isChecked()) + m_option->m_maxSize = m_spbSizeMax->value(); + else + m_option->m_maxSize = FileSizeOption; + + if(m_chbSizeMin->isChecked()) + m_option->m_minSize = m_spbSizeMin->value(); + else + m_option->m_minSize = FileSizeOption; +} + +void KNewProjectDlg::saveDateAccessOptions() +{ + if(m_chbDateMin->isChecked() || m_chbDateMax->isChecked()) + m_option->m_dateAccess = m_cbDateValid->currentText(); + else + m_option->m_dateAccess = ValidAccessDateOption; + + if(m_chbDateMin->isChecked()) + { + TQString date = m_dedDateMin->date().toString(Qt::ISODate); + m_option->m_minDate = date; + } + else + m_option->m_minDate = AccessDateOption; + + if(m_chbDateMax->isChecked()) + { + TQString date = m_dedDateMax->date().toString(Qt::ISODate); + m_option->m_maxDate = date; + } + else + m_option->m_maxDate = AccessDateOption; +} + +void KNewProjectDlg::saveOwnerOptions() +{ + bool isChecked = m_chbOwnerUser->isChecked(); + if(isChecked) + { + m_option->m_ownerUserIsChecked = true; + m_option->m_ownerUserType = m_cbOwnerUserType->currentText(); + m_option->m_ownerUserBool = m_cbOwnerUserBool->currentText(); + m_option->m_ownerUserValue = m_edOwnerUser->text(); + } + else + { + m_option->m_ownerUserIsChecked = false; + m_option->m_ownerUserType = "Name"; + m_option->m_ownerUserBool = "Equals To"; + m_option->m_ownerUserValue = ""; + } + + isChecked = m_chbOwnerGroup->isChecked(); + if(isChecked) + { + m_option->m_ownerGroupIsChecked = true; + m_option->m_ownerGroupType = m_cbOwnerGroupType->currentText(); + m_option->m_ownerGroupBool = m_cbOwnerGroupBool->currentText(); + m_option->m_ownerGroupValue = m_edOwnerGroup->text(); + } + else + { + m_option->m_ownerGroupIsChecked = false; + m_option->m_ownerGroupType = "Name"; + m_option->m_ownerGroupBool = "Equals To"; + m_option->m_ownerGroupValue = ""; + } +} + +void KNewProjectDlg::saveLocationsList() +{ + TQString current = m_cbLocation->currentText(); + TQStringList list = current; + + int count = m_cbLocation->listBox()->count(), + i; + for(i = 0; i < count; i++) + { + TQString text = m_cbLocation->listBox()->item(i)->text(); + if(text != current) + list.append(text); + } + m_option->m_directories = list; +} + +void KNewProjectDlg::saveFiltersList() +{ + TQString current = m_cbFilter->currentText(); + TQStringList list = current; + + int count = m_cbFilter->listBox()->count(), + i; + for(i = 0; i < count; i++) + { + TQString text = m_cbFilter->listBox()->item(i)->text(); + if(text != current) + list.append(text); + } + m_option->m_filters = list; +} + +void KNewProjectDlg::saveBackupExtensionOptions() +{ + TQString backupExt = m_leBackup->text(); + m_option->m_backup = (m_chbBackup->isChecked() && !backupExt.isEmpty()); + m_option->m_backupExtension = backupExt; +} + +void KNewProjectDlg::setDatas(const TQString& directoryString, const TQString& filterString) +{ + if (!directoryString.isEmpty()) + m_cbLocation->setEditText(directoryString); + + if (!filterString.isEmpty()) + m_cbFilter->setEditText(filterString); +} + +bool KNewProjectDlg::contains(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 KNewProjectDlg::whatsThis() +{ + TQWhatsThis::add(m_cbLocation, cbLocationWhatthis); + TQWhatsThis::add(m_cbFilter, cbFilterWhatthis); + + TQWhatsThis::add(m_spbSizeMin, edSizeMinWhatthis); + TQWhatsThis::add(m_spbSizeMax, edSizeMaxWhatthis); + + TQWhatsThis::add(m_cbDateValid, cbDateValidWhatthis); + TQWhatsThis::add(m_chbDateMin, chbDateMinWhatthis); + TQWhatsThis::add(m_chbDateMax, chbDateMaxWhatthis); + + TQWhatsThis::add(m_chbIncludeSubfolders, chbRecursiveWhatthis); + TQWhatsThis::add(m_chbRegularExpressions, chbRegularExpressionsWhatthis); + TQWhatsThis::add(m_chbEnableVariables, chbVariablesWhatthis); + TQWhatsThis::add(m_chbCaseSensitive, chbCaseSensitiveWhatthis); + TQWhatsThis::add(m_chbBackup, chbBackupWhatthis); + TQWhatsThis::add(m_leBackup, chbBackupWhatthis); + TQWhatsThis::add(m_leSearch, leSearchWhatthis); + TQWhatsThis::add(m_leReplace, leReplaceWhatthis); +} + +#include "knewprojectdlg.moc" + diff --git a/tdefilereplace/knewprojectdlg.h b/tdefilereplace/knewprojectdlg.h new file mode 100644 index 00000000..b8b87da6 --- /dev/null +++ b/tdefilereplace/knewprojectdlg.h @@ -0,0 +1,85 @@ +/*************************************************************************** + knewprojectdlg.h - description + ------------------- + begin : Tue Dec 28 1999 + copyright : (C) 1999 by Fran�ois Dupoux + (C) 2004 Emiliano Gulmini + 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. * + * * + ***************************************************************************/ + +#ifndef KNEWPROJECTDLG_H +#define KNEWPROJECTDLG_H + +//KDE +class TDEConfig; + +//local +#include "knewprojectdlgs.h" +#include "configurationclasses.h" + +class KNewProjectDlg : public KNewProjectDlgS +{ + Q_OBJECT + + + private: + TQString m_searchNowFlag; + RCOptions* m_option; + + public: + KNewProjectDlg(RCOptions* info, TQWidget *parent=0, const char *name=0); + ~KNewProjectDlg(); + + public: + //void updateOptions(const RCOptions& info); + void saveRCOptions(); + + protected slots: + void slotDir(); + void slotOK(); + void slotReject(); + void slotSearchNow(); + void slotSearchLater(); + void slotSearchLineEdit(const TQString& t); + void slotEnableSpinboxSizeMin(bool b); + void slotEnableSpinboxSizeMax(bool b); + void slotEnableCbValidDate(bool b); + void slotEnableChbUser(bool b); + void slotEnableChbGroup(bool b); + void slotEnableChbBackup(bool b); + void slotHelp(){ kapp->invokeHelp(TQString(), "tdefilereplace"); } + + private: + void initGUI(); + + void loadOptions(); + void loadFileSizeOptions(); + void loadDateAccessOptions(); + void loadOwnerOptions(); + void loadLocationsList(); + void loadFiltersList(); + void loadBackupExtensionOptions(); + + void saveOptions(); + void saveFileSizeOptions(); + void saveDateAccessOptions(); + void saveOwnerOptions(); + void saveLocationsList(); + void saveFiltersList(); + void saveBackupExtensionOptions(); + + bool contains(TQListView* lv,const TQString& s, int column); + void setDatas(const TQString& directoryString, const TQString& filterString); + void whatsThis(); +}; + +#endif // KNewProjectDlg diff --git a/tdefilereplace/knewprojectdlgs.ui b/tdefilereplace/knewprojectdlgs.ui new file mode 100644 index 00000000..b3509c1d --- /dev/null +++ b/tdefilereplace/knewprojectdlgs.ui @@ -0,0 +1,898 @@ + +KNewProjectDlgS + + + KNewProjectDlgS + + + + 0 + 0 + 568 + 609 + + + + Search & Replace in Files + + + true + + + true + + + + unnamed + + + + layout28 + + + + unnamed + + + + m_pbHelp + + + true + + + + 3 + 1 + 0 + 0 + + + + + 0 + 0 + + + + + 70 + 32767 + + + + &Help + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 150 + 20 + + + + + + m_pbSearchNow + + + Search Now + + + + + + true + + + + + m_pbSearchLater + + + Search Later + + + + + + + + m_pbCancel + + + + 3 + 1 + 0 + 0 + + + + + 70 + 32767 + + + + &Cancel + + + + + + + tabWidget2 + + + + tab + + + &General + + + + unnamed + + + + groupBox5 + + + Startup Folder Options + + + + unnamed + + + + m_tlFilter + + + Filter: + + + cbFilter + + + + + m_tlLocation + + + Location: + + + AutoText + + + cbLocation + + + + + m_cbLocation + + + + 3 + 0 + 0 + 0 + + + + true + + + 20 + + + 10 + + + AtTop + + + false + + + Insert a search path here. You can use the search path button. + + + + + m_pbLocation + + + + + + + + + + + m_cbFilter + + + + 3 + 0 + 0 + 0 + + + + true + + + 20 + + + 10 + + + AtTop + + + false + + + + + + + + m_chbIncludeSubfolders + + + &Include subfolders + + + true + + + + + + + groupBox6 + + + Search/Replace Strings + + + + unnamed + + + + m_leSearch + + + + + m_leReplace + + + + + m_tlSearch + + + Search: + + + + + m_tlReplace + + + Replace: + + + + + + + groupBox4 + + + General Options + + + + unnamed + + + + m_chbRegularExpressions + + + true + + + Enable &regular expressions + + + + + m_chbBackup + + + Do &backup copy instead of overwrite + + + + + m_chbCaseSensitive + + + &Case sensitive + + + + + m_chbEnableVariables + + + Enable co&mmands in the replace string + + + + + m_tlBackup + + + Backup copy suffix: + + + + + m_leBackup + + + + + + + + m_cbEncoding + + + + 3 + 0 + 0 + 0 + + + + + + textLabel1 + + + Encoding of the files: + + + + + + + + + tab + + + &Advanced + + + + unnamed + + + + gbOwnership + + + Ownership Filtering + + + + unnamed + + + + m_chbOwnerUser + + + User: + + + + + + Name + + + + + ID (Number) + + + + m_cbOwnerUserType + + + false + + + 2 + + + 2 + + + true + + + + + + Equals To + + + + + Is Not + + + + m_cbOwnerUserBool + + + false + + + 2 + + + 2 + + + false + + + + + + Equals To + + + + + Is Not + + + + m_cbOwnerGroupBool + + + false + + + 2 + + + 2 + + + false + + + + + + Name + + + + + ID (Number) + + + + m_cbOwnerGroupType + + + false + + + 2 + + + 2 + + + false + + + + + m_chbOwnerGroup + + + Group: + + + + + m_edOwnerUser + + + false + + + + + m_edOwnerGroup + + + false + + + + + + + gbAccessDate + + + Access Date Filtering + + + + unnamed + + + + layout8 + + + + unnamed + + + + layout18 + + + + unnamed + + + + m_tlDateValid + + + Dates valid for: + + + + + m_chbDateMin + + + Accessed after: + + + + + m_chbDateMax + + + Accessed before: + + + + + + + layout19 + + + + unnamed + + + + + Last Writing Access + + + + + Last Reading Access + + + + m_cbDateValid + + + 2 + + + 2 + + + false + + + + + m_dedDateMin + + + false + + + + 2000 + 1 + 1 + + + + true + + + + 2100 + 12 + 31 + + + + + 1900 + 12 + 31 + + + + + + m_dedDateMax + + + false + + + + 2000 + 1 + 1 + + + + true + + + + 2100 + 12 + 31 + + + + + 1900 + 9 + 14 + + + + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 190 + 16 + + + + + + + + + + gbSize + + + Size Filtering + + + + unnamed + + + + layout32 + + + + unnamed + + + + layout31 + + + + unnamed + + + + m_chbSizeMin + + + Minimum si&ze: + + + + + m_chbSizeMax + + + Maximum size: + + + + + + + layout30 + + + + unnamed + + + + m_spbSizeMin + + + 4000000 + + + 0 + + + + + m_spbSizeMax + + + 4000000 + + + 0 + + + + + + + layout31 + + + + unnamed + + + + m_tlSizeMin + + + KB + + + + + m_tlSizeMax + + + KB + + + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 330 + 16 + + + + + + + + + + + + + + tabWidget2 + m_leSearch + m_leReplace + m_cbLocation + m_pbLocation + m_cbFilter + m_chbIncludeSubfolders + m_cbEncoding + m_chbCaseSensitive + m_chbRegularExpressions + m_chbEnableVariables + m_chbBackup + m_leBackup + m_pbSearchNow + m_pbSearchLater + m_pbCancel + m_pbHelp + m_chbSizeMin + m_spbSizeMin + m_chbSizeMax + m_spbSizeMax + m_cbDateValid + m_chbDateMin + m_chbDateMax + m_chbOwnerUser + m_cbOwnerUserType + m_cbOwnerUserBool + m_edOwnerUser + m_chbOwnerGroup + m_cbOwnerGroupType + m_cbOwnerGroupBool + m_edOwnerGroup + m_dedDateMin + m_dedDateMax + + + diff --git a/tdefilereplace/koptionsdlg.cpp b/tdefilereplace/koptionsdlg.cpp new file mode 100644 index 00000000..bd6bcbe8 --- /dev/null +++ b/tdefilereplace/koptionsdlg.cpp @@ -0,0 +1,236 @@ +/*************************************************************************** + koptionsdlg.cpp - description + ------------------- + begin : Tue Dec 28 1999 + copyright : (C) 1999 by Fran�is Dupoux + (C) 2004 Emiliano Gulmini + 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 +#include +#include +#include +#include +#include + +// KDE +#include +#include +#include +#include +#include +#include +//#include + +// local +#include "whatthis.h" +#include "koptionsdlg.h" + + +using namespace whatthisNameSpace; + + +KOptionsDlg::KOptionsDlg(RCOptions* info, TQWidget *parent, const char *name) : KOptionsDlgS(parent,name,true) +{ + m_config = new TDEConfig("tdefilereplacerc"); + m_option = info; + + initGUI(); + + connect(m_pbOK, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotOK())); + connect(m_pbDefault, TQT_SIGNAL(clicked()),this,TQT_SLOT(slotDefaults())); + connect(m_chbBackup, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbBackup(bool))); + connect(m_pbHelp, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotHelp())); + connect(m_chbConfirmStrings, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbConfirmStrings(bool))); + connect(m_chbShowConfirmDialog, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChbShowConfirmDialog(bool))); + + whatsThis(); +} + +KOptionsDlg::~KOptionsDlg() +{ +} + +//PRIVATE SLOTS +void KOptionsDlg::slotOK() +{ + saveRCOptions(); + accept(); +} + +/** Set defaults values for all options of the dialog */ +void KOptionsDlg::slotDefaults() +{ + m_chbCaseSensitive->setChecked(CaseSensitiveOption); + m_chbRecursive->setChecked(RecursiveOption); + m_chbHaltOnFirstOccurrence->setChecked(StopWhenFirstOccurenceOption); + + m_chbFollowSymLinks->setChecked(FollowSymbolicLinksOption); + m_chbIgnoreHidden->setChecked(IgnoreHiddenOption); + m_chbRegularExpressions->setChecked(RegularExpressionsOption); + m_chbIgnoreFiles->setChecked(IgnoreFilesOption); + m_chbConfirmStrings->setChecked(AskConfirmReplaceOption); + + TQStringList bkList = TQStringList::split(",",BackupExtensionOption,true); + + bool enableBackup = (bkList[0] == "true" ? true : false); + + m_chbBackup->setChecked(enableBackup); + m_leBackup->setEnabled(enableBackup); + m_tlBackup->setEnabled(enableBackup); + + m_leBackup->setText(bkList[1]); + + m_chbVariables->setChecked(VariablesOption); + + m_chbNotifyOnErrors->setChecked(NotifyOnErrorsOption); +} + +void KOptionsDlg::slotChbBackup(bool b) +{ + m_leBackup->setEnabled(b); + m_tlBackup->setEnabled(b); +} + +void KOptionsDlg::slotChbConfirmStrings(bool b) +{ + if(b) + { + m_chbShowConfirmDialog->setEnabled(true); + m_chbShowConfirmDialog->setChecked(true); + m_config->setGroup("Notification Messages"); + m_config->writeEntry(rcDontAskAgain,"no"); + } + else + { + m_chbShowConfirmDialog->setEnabled(false); + m_chbShowConfirmDialog->setChecked(false); + m_config->setGroup("Notification Messages"); + m_config->writeEntry(rcDontAskAgain,"yes"); + } +} + +void KOptionsDlg::slotChbShowConfirmDialog(bool b) +{ + m_config->setGroup("Notification Messages"); + if(b) + { + m_config->writeEntry(rcDontAskAgain,"no"); + } + else + { + m_config->writeEntry(rcDontAskAgain,"yes"); + } +} + +//PRIVATE +void KOptionsDlg::initGUI() +{ + m_config->sync(); + m_config->setGroup("Notification Messages"); + m_option->m_notifyOnErrors = m_config->readBoolEntry(rcNotifyOnErrors, true); + + TQString dontAskAgain = m_config->readEntry(rcDontAskAgain,"no"); + + m_chbConfirmStrings->setChecked(m_option->m_askConfirmReplace); + + if(m_chbConfirmStrings->isChecked()) + { + if(dontAskAgain == "yes") + m_chbShowConfirmDialog->setChecked(false); + else + m_chbShowConfirmDialog->setChecked(true); + } + + TQStringList availableEncodingNames(TDEGlobal::charsets()->availableEncodingNames()); + m_cbEncoding->insertStringList( availableEncodingNames ); + int idx = -1; + int utf8Idx = -1; + for (uint i = 0; i < availableEncodingNames.count(); i++) + { + if (availableEncodingNames[i] == m_option->m_encoding) + { + idx = i; + break; + } + if (availableEncodingNames[i] == "utf8") + { + utf8Idx = i; + } + } + if (idx != -1) + m_cbEncoding->setCurrentItem(idx); + else + m_cbEncoding->setCurrentItem(utf8Idx); + + m_chbCaseSensitive->setChecked(m_option->m_caseSensitive); + m_chbRecursive->setChecked(m_option->m_recursive); + + bool enableBackup = m_option->m_backup; + + m_chbBackup->setChecked(enableBackup); + m_leBackup->setEnabled(enableBackup); + m_tlBackup->setEnabled(enableBackup); + + m_leBackup->setText(m_option->m_backupExtension); + + m_chbVariables->setChecked(m_option->m_variables); + m_chbRegularExpressions->setChecked(m_option->m_regularExpressions); + m_chbHaltOnFirstOccurrence->setChecked(m_option->m_haltOnFirstOccur); + m_chbFollowSymLinks->setChecked(m_option->m_followSymLinks); + m_chbIgnoreHidden->setChecked(m_option->m_ignoreHidden); + m_chbIgnoreFiles->setChecked(m_option->m_ignoreFiles); + + m_chbNotifyOnErrors->setChecked(m_option->m_notifyOnErrors); +} + +void KOptionsDlg::saveRCOptions() +{ + m_option->m_encoding = m_cbEncoding->currentText(); + m_option->m_caseSensitive = m_chbCaseSensitive->isChecked(); + m_option->m_recursive = m_chbRecursive->isChecked(); + TQString backupExt = m_leBackup->text(); + m_option->m_backup = (m_chbBackup->isChecked() && !backupExt.isEmpty()); + m_option->m_backupExtension = backupExt; + m_option->m_variables = m_chbVariables->isChecked(); + m_option->m_regularExpressions = m_chbRegularExpressions->isChecked(); + m_option->m_haltOnFirstOccur = m_chbHaltOnFirstOccurrence->isChecked(); + m_option->m_followSymLinks = m_chbFollowSymLinks->isChecked(); + m_option->m_ignoreHidden = m_chbIgnoreHidden->isChecked(); + m_option->m_ignoreFiles = m_chbIgnoreFiles->isChecked(); + m_option->m_askConfirmReplace = m_chbConfirmStrings->isChecked(); + m_option->m_notifyOnErrors = m_chbNotifyOnErrors->isChecked(); + + m_config->setGroup("Notification Messages"); + m_config->writeEntry(rcNotifyOnErrors, m_option->m_notifyOnErrors); + + m_config->sync(); +} + +void KOptionsDlg::whatsThis() +{ + // Create help TQWhatsThis + TQWhatsThis::add(m_chbCaseSensitive, chbCaseSensitiveWhatthis); + TQWhatsThis::add(m_chbRecursive, chbRecursiveWhatthis); + TQWhatsThis::add(m_chbHaltOnFirstOccurrence, chbHaltOnFirstOccurrenceWhatthis); + TQWhatsThis::add(m_chbFollowSymLinks, chbFollowSymLinksWhatthis); + TQWhatsThis::add(m_chbIgnoreHidden, chbIgnoreHiddenWhatthis); + TQWhatsThis::add(m_chbIgnoreFiles, chbIgnoreFilesWhatthis); + TQWhatsThis::add(m_chbRegularExpressions, chbRegularExpressionsWhatthis); + TQWhatsThis::add(m_chbVariables, chbVariablesWhatthis); + TQWhatsThis::add(m_chbBackup, chbBackupWhatthis); + TQWhatsThis::add(m_chbConfirmStrings, chbConfirmStringsWhatthis); +} + +#include "koptionsdlg.moc" diff --git a/tdefilereplace/koptionsdlg.h b/tdefilereplace/koptionsdlg.h new file mode 100644 index 00000000..4654c5cd --- /dev/null +++ b/tdefilereplace/koptionsdlg.h @@ -0,0 +1,59 @@ +/*************************************************************************** + koptionsdlg.h - description + ------------------- + begin : Tue Dec 28 1999 + copyright : (C) 1999 by Fran�ois Dupoux + (C) 2004 Emiliano Gulmini + 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. * + * * + ***************************************************************************/ + +#ifndef KOPTIONSDLG_H +#define KOPTIONSDLG_H + +// KDE +class TDEConfig; + +//local +#include "configurationclasses.h" +#include "koptionsdlgs.h" + +/** + *@author Fran�ois Dupoux + */ + +class KOptionsDlg : public KOptionsDlgS +{ + Q_OBJECT + + public: + KOptionsDlg(RCOptions* info, TQWidget *parent, const char *name); + ~KOptionsDlg(); + + private: + RCOptions* m_option; + TDEConfig *m_config; + + private slots: + void slotOK(); + void slotDefaults(); + void slotChbBackup(bool b); + void slotChbConfirmStrings(bool b); + void slotChbShowConfirmDialog(bool b); + void slotHelp(){ kapp->invokeHelp(TQString(), "tdefilereplace"); } + + private: + void initGUI(); + void saveRCOptions(); + void whatsThis(); +}; + +#endif // KOPTIONSDLG_H diff --git a/tdefilereplace/koptionsdlgs.ui b/tdefilereplace/koptionsdlgs.ui new file mode 100644 index 00000000..131e01f0 --- /dev/null +++ b/tdefilereplace/koptionsdlgs.ui @@ -0,0 +1,347 @@ + +KOptionsDlgS + + + KOptionsDlgS + + + + 0 + 0 + 572 + 420 + + + + Options + + + true + + + + unnamed + + + + tabWidget2 + + + + tab1 + + + General + + + + unnamed + + + + groupBox7 + + + General Options + + + + unnamed + + + + m_chbVariables + + + Enable commands in replace strings + + + + + + + + m_tlBackup + + + Backup copy suffix: + + + + + m_leBackup + + + + + + + + m_chbNotifyOnErrors + + + Notif&y on errors + + + + + m_chbCaseSensitive + + + Case sensitive + + + + + + + + m_chbRecursive + + + Recursive (search/replace in all sub folders) + + + + + + + + m_chbRegularExpressions + + + true + + + Enable regular e&xpressions + + + + + m_chbBackup + + + Do &backup copy + + + + + textLabel1 + + + Encoding of the files: + + + + + m_cbEncoding + + + + 3 + 0 + 0 + 0 + + + + + + + + + + Tab3 + + + &Advanced + + + + unnamed + + + + gbxConfirm + + + Advanced Options + + + + unnamed + + + + m_chbIgnoreHidden + + + Ignore hidden files and folders + + + + + m_chbFollowSymLinks + + + Follow s&ymbolic links + + + + + m_chbHaltOnFirstOccurrence + + + When searching, stop on first string found (faster but no details) + + + + + m_chbIgnoreFiles + + + true + + + Do not show file if no strings are found or replaced + + + + + layout9 + + + + unnamed + + + + spacer2 + + + Horizontal + + + Fixed + + + + 16 + 20 + + + + + + m_chbShowConfirmDialog + + + false + + + Show confirmation dialog + + + + + + + m_chbConfirmStrings + + + false + + + Confirm before replace each string + + + + + + + + + + m_pbHelp + + + true + + + &Help + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 202 + 20 + + + + + + m_pbDefault + + + &Default Values + + + + + m_pbOK + + + &OK + + + + + m_pbCancel + + + &Cancel + + + + + + + m_pbCancel + clicked() + KOptionsDlgS + reject() + + + + tabWidget2 + m_cbEncoding + m_chbCaseSensitive + m_chbRecursive + m_chbRegularExpressions + m_chbVariables + m_chbNotifyOnErrors + m_chbBackup + m_leBackup + m_pbDefault + m_pbOK + m_pbCancel + m_pbHelp + m_chbConfirmStrings + m_chbShowConfirmDialog + m_chbIgnoreFiles + m_chbHaltOnFirstOccurrence + m_chbFollowSymLinks + m_chbIgnoreHidden + + + diff --git a/tdefilereplace/main.cpp b/tdefilereplace/main.cpp new file mode 100644 index 00000000..4b12eba0 --- /dev/null +++ b/tdefilereplace/main.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + main.cpp - Main file for the KFileReplace shell + ------------------- + begin : Thu Sep 16 14:14:09 2004 + copyright : (C) 2004 by Andras Mantia + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "tdefilereplace.h" + +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("Batch search and replace tool"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = + { + { "+[PATH]", I18N_NOOP( "Starting folder" ), 0 }, + KCmdLineLastOption + }; + +int main(int argc, char *argv[]) +{ + TDEAboutData about("tdefilereplace", I18N_NOOP("KFileReplace"), version, description, + TDEAboutData::License_GPL_V2, "(C) 2004-2005 Andras Mantia\n(C) 2004-2005 Emiliano Gulmini\n(C) 1999-2002 Francois Dupoux", I18N_NOOP("Part of the KDEWebDev module."), + "http://www.tdewebdev.org"); + + about.addAuthor("Andras Mantia", I18N_NOOP("Shell author, KPart creator, co-maintainer"), "amantia@kde.org"); + about.addAuthor("Emiliano Gulmini", I18N_NOOP("Current maintainer, code cleaner and rewriter"),"emi_barbarossa@yahoo.it"); + about.addAuthor("Francois Dupou", + I18N_NOOP("Original author of the KFileReplace tool"), + "dupoux@dupoux.com"); + + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(KFileReplace); + } + else + { + // no session.. just start up normally + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + KFileReplace *kfr = new KFileReplace; + kfr->show(); + + if (args->count() == 0) + { + kfr->openURL(KURL()); + } + else + { + kfr->openURL(args->url(0)); + } + args->clear(); + } + + return app.exec(); +} diff --git a/tdefilereplace/report.cpp b/tdefilereplace/report.cpp new file mode 100644 index 00000000..6d485eba --- /dev/null +++ b/tdefilereplace/report.cpp @@ -0,0 +1,282 @@ +/*************************************************************************** + report.cpp - Report document 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 +#include + +// KDE +#include +#include +#include + +// local +#include "report.h" +#include "configurationclasses.h" + +void Report::createReportFile() +{ + TQString xmlFileName = m_docPath + ".xml", + cssFileName = m_docPath + ".css"; + + // Generates a report file + // a) Open the file + TQFile report(xmlFileName); + if (!report.open( IO_WriteOnly )) + { + KMessageBox::error(0, i18n("Cannot open the file %1.").arg(xmlFileName)); + return ; + } + + // b) Write the header of the XML file + + TQDateTime datetime = TQDateTime::currentDateTime(Qt::LocalTime); + TQString dateString = datetime.toString(Qt::LocalDate); + KUser user; + TQString columnTextFour, + columnReplaceWith; + if(!m_isSearchFlag) + { + columnTextFour = i18n("Replaced Strings"); + columnReplaceWith = i18n("Replace with"); + } + else + { + columnTextFour = i18n("Total number occurrences"); + columnReplaceWith = i18n("-"); + } + + TQString css = cssFileName.mid(cssFileName.findRev("/")+1,cssFileName.length()-(cssFileName.findRev("/")+1)); + TQTextStream oTStream( &report ); + oTStream << "\n" + "" + "\n" + " "+i18n("KFileReplace Report")+" \n" + " "+user.fullName()+"("+user.loginName()+")"+"\n" + " "+dateString+"\n" + "


    \n" + " \n" + " "+i18n("Searching/Replacing Strings Table")+" \n" + "
    \n" + " \n" + " "+i18n("Search for")+"\n"; + + if(!m_isSearchFlag) + oTStream<< " "+columnReplaceWith+"\n"; + + oTStream<< " \n" + "
    \n"; + // c) Write the strings list + TQListViewItem *lviCurItem, + *lviFirst; + + lviCurItem = lviFirst = m_stringsView->firstChild(); + + if(lviCurItem == 0) + return ; + + TQString rowType="a1"; + + do + { TQString rowTag = "\n" + " text(0)+"]]>\n" + " text(1)+"]]>\n" + "\n"; + + oTStream << rowTag; + + rowType = ((rowType == "a1") ? "a2" : "a1"); + + lviCurItem = lviCurItem->nextSibling(); + } while(lviCurItem && lviCurItem != lviFirst); + + oTStream<< "
    \n"; + + oTStream<< "\n" + " \n" + " "+i18n("Results Table")+ " " + "
    \n" + " \n" + " "+i18n("Name")+"\n" + " "+i18n("Folder")+"\n"; + if(m_isSearchFlag) + { + oTStream<< " "+i18n("Size")+"\n"; + } + else + { + oTStream<< " "+i18n("Old Size")+"\n" + " "+i18n("New Size")+"\n"; + } + oTStream<< " "+columnTextFour+"\n" + " "+i18n("Owner User")+"\n" + " "+i18n("Owner Group")+"\n" + " \n" + "
    \n"; + + // d) Write the result list + + lviCurItem = lviFirst = m_resultsView->firstChild(); + + if(lviCurItem == 0) + return ; + + unsigned int totalOccurrences = 0; + + rowType="a1"; + + do + { TQString rowTag = " \n" + " text(0)+"]]>\n" + " text(1)+"]]>\n"; + if(m_isSearchFlag) + { + rowTag += " text(2)+"]]>\n" + " text(3)+"]]>\n" + " text(4)+"]]>\n" + " text(5)+"]]>\n" + " \n"; + } + else + { + rowTag += " text(2)+"]]>\n" + " text(3)+"]]>\n" + " text(4)+"]]>\n" + " text(5)+"]]>\n" + " text(6)+"]]>\n" + " \n"; + } + + oTStream << rowTag; + + rowType = ((rowType == "a1") ? "a2" : "a1"); + + if(m_isSearchFlag) + totalOccurrences += lviCurItem->text(3).toInt(); + else + totalOccurrences += lviCurItem->text(4).toInt(); + + lviCurItem = lviCurItem->nextSibling(); + } while(lviCurItem && lviCurItem != lviFirst); + + + // e) Write the end of the file + + oTStream<< "
    \n" + "" + << totalOccurrences + << "\n" + "\n"; + + report.close(); +} + +void Report::createStyleSheet() +{ + TQString cssFileName = m_docPath +".css"; + TQFile styleSheet(cssFileName); + if (!styleSheet.open( IO_WriteOnly )) + { + KMessageBox::error(0, i18n("Cannot open the file %1.").arg(cssFileName)); + return ; + } + + TQTextStream oTStream( &styleSheet ); + + TQString css = "title { display:block;font:40px bold sans-serif; }\n\n" + "createdby:before { content :\""+i18n("Created by")+": \"; }\n" + "createdby { display:inline; }\n\n" + "date:before { content :\"-"+i18n("date")+": \"; }\n" + "date { display:inline; }\n\n" + "totaloccurrences:before { content :\""+i18n("Total occurrences")+": \"; }\n" + "totaloccurrences { display:block;text-align:right; font-weight:bold;margin-top:5px;margin-right:5px;}\n" + "tablecaption {display:table-caption;font:20px bold sans-serif;}\n\n" + "hr {display:block;background:black;height:1px;margin:5px 0px 5px;}\n" + "whiteline {display:block;height:16px;}\n\n" + "searchfor {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n"; + + if(!m_isSearchFlag) + { + css += "replacewith {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n"; + } + + css += "folder {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n" + "header { display: table-header-group; }\n\n" + "name {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n" + "newsize {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0;\n" + " text-align:right; }\n\n" + "oldsize {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0;\n" + " text-align:right; }\n\n" + "ownergroup {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n" + "owneruser {\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n" + "replacedstrings {\n" + " text-align:right;\n" + " display:table-cell;\n" + " border:1px solid black;\n" + " padding:0 7px 0; }\n\n" + "*[class~=header] {\n" + " background : lightgray;\n" + " text-align : center; }\n\n" + "row { display : table-row; }\n\n" + "table {\n" + " display:table;\n" + " border-collapse: collapse; }\n\n" + "*[class~=a1] {\n" + " background-color:aliceblue;\n" + " font-weight : bold;font-size:15px; }\n\n" + "*[class~=a2] {\n" + " background-color:khaki;\n" + " font-weight : bold;\n" + " font-size:15px; }\n\n"; + + oTStream << css; + + styleSheet.close(); +} + +void Report::createDocument(const TQString& docPath) +{ + m_docPath = docPath; + + createStyleSheet(); + createReportFile(); +} + diff --git a/tdefilereplace/report.h b/tdefilereplace/report.h new file mode 100644 index 00000000..13856334 --- /dev/null +++ b/tdefilereplace/report.h @@ -0,0 +1,58 @@ +/*************************************************************************** + report.h - Report document 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 REPORT_H +#define REPORT_H + +// QT +class TQString; + +// KDE +#include +#include "configurationclasses.h" +class KListView; + +/** Report class is used to create a pair of files (a xml and a css file) which are + * a short statistical report of the operations. + */ + +class Report +{ + private: + KListView* m_stringsView, + * m_resultsView; + TQString m_docPath; + bool m_isSearchFlag; + RCOptions* m_option; + + public: + Report(RCOptions* info, KListView* rv, KListView* sv) { m_option = info; + m_resultsView = rv; + m_stringsView = sv; + m_isSearchFlag = m_option->m_searchingOnlyMode; + } + ~Report() { m_option = 0; } + private: + void createReportFile(); + void createStyleSheet(); + + public: + void createDocument(const TQString& docPath); +}; + +#endif // REPORT_H diff --git a/tdefilereplace/tdefilereplace.cpp b/tdefilereplace/tdefilereplace.cpp new file mode 100644 index 00000000..bd5725e4 --- /dev/null +++ b/tdefilereplace/tdefilereplace.cpp @@ -0,0 +1,111 @@ +/*************************************************************************** + tdefilereplace.cpp - KFileReplace shell implementation + ------------------- + begin : Thu Sep 16 14:14:09 2004 + copyright : (C) 2004 by Andras Mantia + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +//kde includes +#include +#include +#include +#include +#include + +//app includes +#include "tdefilereplace.h" + +KFileReplace::KFileReplace() + : KParts::MainWindow(0L, "KFileReplace") +{ + KLibFactory *factory = KLibLoader::self()->factory("libtdefilereplacepart"); + if (factory) + { + m_part = static_cast(factory->create(TQT_TQOBJECT(this), + "tdefilereplace_part", "KParts::ReadOnlyPart" )); + + if (m_part) + { + setCentralWidget(m_part->widget()); + KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureToolbars()), actionCollection()); + setStandardToolBarMenuEnabled(true); + createGUI(m_part); + removeDuplicatedActions(); + } + } + else + { + KMessageBox::error(this, i18n("Could not find the KFileReplace part.")); + close(); + return; + } +} + + +KFileReplace::~KFileReplace() +{ +} + +void KFileReplace::openURL(const KURL &url) +{ + m_part->openURL(url); +} + +void KFileReplace::slotConfigureKeys() +{ + KKeyDialog dlg( false, this ); + TQPtrList clients = guiFactory()->clients(); + for( TQPtrListIterator it( clients ); + it.current(); ++it ) + { + dlg.insert( (*it)->actionCollection() ); + } + dlg.configure(); +} + +void KFileReplace::slotConfigureToolbars() +{ + saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); + KEditToolbar dlg(factory()); + connect(&dlg, TQT_SIGNAL(newToolbarConfig()), + this, TQT_SLOT(applyNewToolbarConfig())); + dlg.exec(); +} + +void KFileReplace::applyNewToolbarConfig() +{ + applyMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); +} + + +void KFileReplace::removeDuplicatedActions() +{ + KActionCollection* part_action_collection = m_part->actionCollection(); + KAction* part_about_action = part_action_collection->action("help_about_tdefilereplace"); + KAction* part_report_action = part_action_collection->action("report_bug"); + KAction* part_help_action= part_action_collection->action("help_tdefilereplace"); + + if (!part_about_action || !part_report_action || !part_help_action || !part_action_collection) + return; + + TQWidget* container = part_about_action->container(0); + part_about_action->unplug(container); + part_report_action->unplug(container); + part_help_action->unplug(container); + part_action_collection->remove(part_about_action); + part_action_collection->remove(part_report_action); + part_action_collection->remove(part_help_action); +} + +#include "tdefilereplace.moc" diff --git a/tdefilereplace/tdefilereplace.desktop b/tdefilereplace/tdefilereplace.desktop new file mode 100644 index 00000000..d5ae92ca --- /dev/null +++ b/tdefilereplace/tdefilereplace.desktop @@ -0,0 +1,55 @@ +[Desktop Entry] +Name=KFileReplace +Name[hi]=के-फ़ाइल-रिप्लेस +Name[ne]=बदल्ने केडीई फाइल +Name[pa]=ਕੇ-ਫਾਇਲ-ਬਦਲੋ +Name[sk]=KFile zameniť +Name[sv]=Kfilereplace +Name[ta]=Kகோப்பு இடமாற்று +Name[tg]=KФайлро ҷойгузор кардан +Name[tr]=K Dosya Değiştirme +Exec=tdefilereplace %i %m -caption "%c" +Icon=tdefilereplace +Type=Application +DocPath=tdefilereplace/index.html +Terminal=false +GenericName=Search & Replace Tool +GenericName[bg]=Търсене и замяна +GenericName[br]=Ostilh klask hag erlec'hiañ +GenericName[ca]=Eina cerca i substitueix +GenericName[cs]=Nástroj pro vyhledání a nahrazení +GenericName[da]=Søg og erstat-værktøj +GenericName[de]=Suchen & Ersetzen Werkzeug +GenericName[el]=Εργαλείο αναζήτησης & αντικατάστασης +GenericName[es]=Herramienta de búsqueda y reemplazo +GenericName[et]=Otsimise ja asendamise tööriist +GenericName[eu]=Bilaketa eta ordezkapen tresna +GenericName[fa]=ابزار جستجو و جایگزینی +GenericName[fi]=Etsi & korvaa työkalu +GenericName[fr]=Outil de recherche et de remplacement +GenericName[gl]=Ferramenta de busca e reemprazo +GenericName[hu]=Fájlkereső +GenericName[is]=Tól til að leita að texta og skipta út +GenericName[it]=Strumento di ricerca e sostituzione +GenericName[ja]=検索および置換ツール +GenericName[ka]=ძიების და ჩანაცვლების ხელსაწყო +GenericName[lt]=Paieškos ir keitimo įrankis +GenericName[ms]=Alatan Cari & Ganti +GenericName[nds]=Söök- un Utwesselwarktüüch +GenericName[ne]=खोजी गर्ने र बदल्ने उपरकरण +GenericName[nl]=Gereedschap voor zoeken en vervangen +GenericName[pa]=ਖੋਜ ਅਤੇ ਤਬਦੀਲ ਸੰਦ +GenericName[pl]=Narzędzie do wyszukiwania i zamiany +GenericName[pt]=Ferramenta de Procura e Substituição +GenericName[pt_BR]=Ferramenta de Procura & Substituição +GenericName[ru]=Поиск и замена +GenericName[sk]=Nájsť a zameniť +GenericName[sl]=Orodje za iskanje in zamenjavo +GenericName[sr]=Алат за претрагу и замену +GenericName[sr@Latn]=Alat za pretragu i zamenu +GenericName[sv]=Sök- och ersättningsverktyg +GenericName[uk]=Засіб пошуку та заміни +GenericName[zh_CN]=搜索替换工具 +GenericName[zh_HK]=搜尋及取代工具 +GenericName[zh_TW]=搜尋及取代工具 +Categories=Qt;TDE;Utility;X-TDE-Utilities-File; diff --git a/tdefilereplace/tdefilereplace.h b/tdefilereplace/tdefilereplace.h new file mode 100644 index 00000000..6dd154d9 --- /dev/null +++ b/tdefilereplace/tdefilereplace.h @@ -0,0 +1,46 @@ +/*************************************************************************** + tdefilereplace.h - KFileReplace header + ------------------- + begin : Thu Sep 16 14:14:09 2004 + copyright : (C) 2004 by Andras Mantia + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KFILEREPLACE_H +#define KFILEREPLACE_H + +#include + +/** +Shell application for the KFileReplace part. + +@author Andras Mantia +*/ +class KFileReplace : public KParts::MainWindow +{ + Q_OBJECT + +public: + KFileReplace(); + ~KFileReplace(); + void openURL(const KURL &url); + +private slots: + void slotConfigureKeys(); + void slotConfigureToolbars(); + void applyNewToolbarConfig(); + +private: + void removeDuplicatedActions(); + + KParts::ReadOnlyPart *m_part; +}; + +#endif diff --git a/tdefilereplace/tdefilereplace.tdevelop b/tdefilereplace/tdefilereplace.tdevelop new file mode 100644 index 00000000..14e5fe4a --- /dev/null +++ b/tdefilereplace/tdefilereplace.tdevelop @@ -0,0 +1,190 @@ + + + + + + $VERSION$ + KDevKDEAutoProject + C++ + + Qt + KDE + + . + false + + + + kdevcvsservice + + + + + + + + + false + false + + + false + false + *.o,*.lo,CVS + + + + + ada + ada_bugs_gcc + bash + bash_bugs + clanlib + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + opengl + pascal_bugs_fp + php + php_bugs + perl + perl_bugs + python + python_bugs + ruby + ruby_bugs + sdl + stl + sw + w3c-dom-level2-html + w3c-svg + w3c-uaag10 + wxwidgets_bugs + + + qmake User Guide + + + + + libtool + + + + + + true + false + false + + + false + true + 10 + + + + + + + + + + + + + + + + + true + 1 + false + + 0 + + + build + / + tdefilereplace/tdefilereplace + + false + true + + + + default + tdefilereplace + + + + + + + --enable-debug=full --prefix=/opt/trinity --enable-editors + /home/andris/development/build/kde-head/tdewebdev + /home/andris/development/sources/kde-head/tdewebdev + -DKDE_NO_COMPAT -DQT_NO_COMPAT -DDEBUG_PARSER + + kdevgccoptions + kdevgppoptions + kdevpgf77options + + + + + + + + + + + + .h + .cpp + + + + + true + true + true + false + true + true + true + 250 + 400 + 250 + + + + + set + m_,_ + theValue + true + true + + + + + + + + + + + true + true + true + true + -C + + diff --git a/tdefilereplace/tdefilereplaceiface.h b/tdefilereplace/tdefilereplaceiface.h new file mode 100644 index 00000000..515a330e --- /dev/null +++ b/tdefilereplace/tdefilereplaceiface.h @@ -0,0 +1,30 @@ +/*************************************************************************** + tdefilereplaceif.h - description + ------------------- + copyright : (C) 1999 by Franois Dupoux + (C) 2003 Andras Mantia + email : dupoux@dupoux.com, amantia@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KFILEREPLACEIFACE_H +#define KFILEREPLACEIFACE_H + +#include + +class KFileReplaceIface : virtual public DCOPObject +{ + K_DCOP + +k_dcop: + virtual void openURL(const TQString& url) = 0; +}; + +#endif // KFILEREPLACEIFACE_H diff --git a/tdefilereplace/tdefilereplacelib.cpp b/tdefilereplace/tdefilereplacelib.cpp new file mode 100644 index 00000000..0f396f85 --- /dev/null +++ b/tdefilereplace/tdefilereplacelib.cpp @@ -0,0 +1,381 @@ +/*************************************************************************** + tdefilereplacelib.cpp - File library + ------------------- + begin : lun mai 3 20:19:52 CEST 1999 + + copyright : (C) 1999 by Franois Dupoux + (C) 2003 Andras Mantia + (C) 2004 Emiliano Gulmini + 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 +#include +#include +#include + +//KDE +#include +#include +#include +#include + +//needed for malloc/free +#include + +// local +#include "tdefilereplacelib.h" + +const double kilo = 1024.0; +const double mega = 1048576.0;//1024^2 +const double giga = 1073741824.0;//1024^3 +const double tera = 1099511627776.0;//1024^4 + +/** + Format a path, from a path and a filename, or another sub-path (avoid double '/' risks) + Parameters::.....* basePath: fist path (can be "/" if root, or "/usr/bin/" or "/usr/bin" for example) + .................* fileName: second path (can be "/doc/html/", or "doc/html/" or "doc/html/index.html" for example) + Return values:...* Full valid path (without double "/") +*/ +TQString KFileReplaceLib::formatFullPath(const TQString& basePath, const TQString &fileName) +{ + TQString fullPath = basePath; + TQString fname = fileName; + + if (fname.startsWith("/")) // skip beginning '/' + fname = fname.remove(0,1); + + if (fullPath.endsWith("/")) + fullPath.append(fname); + else + fullPath.append("/"+fname); + + return fullPath; +} + +/** + Add an extension to a filename, or a filepath + Parameters::.....* fileName: filename or filepath (it can have already the extension) + .................* extension: extension to add without "." (ex: "html", "kfr") + Return values:...* Filename / Filepath with the extension +*/ +TQString KFileReplaceLib::addExtension(const TQString& fileName, const TQString& extension) +{ + TQString fullExtension = "."; + TQString fname = fileName; + + fullExtension.append(extension); + + // filename cannot contain ".ext" ==> Add it + if(fname.length() <= fullExtension.length()) + fname.append(fullExtension); + else // filename can contain ".ext" + { + if (fname.right(fullExtension.length()) != fullExtension) + fname.append(fullExtension); + } + + return fname; +} + +TQString KFileReplaceLib::formatFileSize(double size) +{ + TQString stringSize; + + if(size < kilo) + { + const int asInt = (int) size; + stringSize = i18n("1 byte", "%n bytes", asInt); + } + else + if(size >= kilo && size < mega) + { + double d = size / kilo; + stringSize = i18n("%1 KB").arg(TQString::number(d,'f',2)); + } + else + if(size >= mega && size < giga) + { + double d = size / mega; + stringSize = i18n("%1 MB").arg(TQString::number(d,'f',2)); + } + else + if(size >= giga) + { + double d = size / giga; + stringSize = i18n("%1 GB").arg(TQString::number(d,'f',2)); + } + return stringSize; +} + +void KFileReplaceLib::convertOldToNewKFRFormat(const TQString& fileName, KListView* stringView) +{ + //this method convert old format in new XML-based format + typedef struct + { + char pgm[13]; // Must be "KFileReplace" : 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 != "KFileReplace")) + { + KMessageBox::error(0, i18n("Cannot open the file %1 and load the string list. This file seems not to be a valid old kfr file or it is broken.").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 KFileReplaceLib::isAnAccessibleFile(const TQString& filePath, const TQString& fileName, RCOptions* info) +{ + TQString bkExt = info->m_backupExtension; + if(fileName == ".." || fileName == "." || (!bkExt.isEmpty() && fileName.right(bkExt.length()) == bkExt)) + return false; + + TQFileInfo fi; + if(filePath.isEmpty()) + fi.setFile(fileName); + else + fi.setFile(filePath+"/"+fileName); + + if(fi.isDir()) + return true; + + int minSize = info->m_minSize, + maxSize = info->m_maxSize; + TQString minDate = info->m_minDate, + maxDate = info->m_maxDate, + dateAccess = info->m_dateAccess; + + // Avoid files that not match access date requirements + TQString last = "unknown"; + if(dateAccess == "Last Writing Access") + last = fi.lastModified().toString(Qt::ISODate); + if(dateAccess == "Last Reading Access") + last = fi.lastRead().toString(Qt::ISODate); + + if(last != "unknown") + { + if(minDate != "unknown" && maxDate != "unknown") + { //If out of range then exit + if((minDate > last) || (maxDate < last)) + return false; + } + else + { + if(minDate != "unknown") + { //If out of range then exit + if(minDate > last) + return false; + } + else + { + if(maxDate != "unknown") + //If out of range then exit + if(maxDate < last) + return false; + } + } + } + // Avoid files that not match size requirements + int size = fi.size(); + if(maxSize != FileSizeOption && minSize != FileSizeOption) + if(size > (maxSize*1024) || size < (minSize*1024)) + return false; + + // Avoid files that not match ownership requirements + if(info->m_ownerUserIsChecked) + { + TQString fileOwnerUser; + if(info->m_ownerUserType == "Name") + fileOwnerUser = fi.owner(); + else + fileOwnerUser = TQString::number(fi.ownerId(),10); + + if(info->m_ownerUserBool == "Equals To") + { + if(info->m_ownerUserValue != fileOwnerUser) + return false; + } + else + { + if(info->m_ownerUserValue == fileOwnerUser) + return false; + } + } + + if(info->m_ownerGroupIsChecked) + { + TQString fileOwnerGroup; + if(info->m_ownerGroupType == "Name") + fileOwnerGroup = fi.group(); + else + fileOwnerGroup = TQString::number(fi.groupId(),10); + if(info->m_ownerGroupBool == "Equals To") + { + if(info->m_ownerGroupValue != fileOwnerGroup) + return false; + } + else + { + if(info->m_ownerGroupValue == fileOwnerGroup) + return false; + } + } + + //If we are here then all requirements have been verified + return true; +} + +void KFileReplaceLib::setIconForFileEntry(TQListViewItem* item, TQString path) +{ + TQFileInfo fi(path); + TQString extension = fi.extension(), + baseName = fi.baseName(); + + KeyValueMap extensionMap; + + extensionMap["a"] = "binary"; + extensionMap["am"] = "shellscript"; + extensionMap["bz"] = "zip"; + extensionMap["bz2"] = "zip"; + extensionMap["c"] = "source_c"; + extensionMap["cc"] = "source_cpp"; + extensionMap["cpp"] = "source_cpp"; + extensionMap["eml"] = "message"; + extensionMap["exe"] = "exec_wine"; + extensionMap["gz"] = "zip"; + extensionMap["h"] = "source_h"; + extensionMap["htm"] = "html"; + extensionMap["html"] = "html"; + extensionMap["in"] = "shellscript"; + extensionMap["java"] = "source_java"; + extensionMap["jpg"] = "image"; + extensionMap["kfr"] = "html"; + extensionMap["kmdr"] = "widget_doc"; + extensionMap["kwd"] = "kword_kwd"; + extensionMap["log"] = "log"; + extensionMap["moc"] = "source_moc"; + extensionMap["mp3"] = "sound"; + extensionMap["o"] = "source_o"; + extensionMap["pdf"] = "pdf"; + extensionMap["php"] = "source_php"; + extensionMap["py"] = "source_py"; + extensionMap["pl"] = "source_pl"; + extensionMap["p"] = "source_p"; + extensionMap["ps"] = "postscript"; + extensionMap["png"] = "image"; + extensionMap["sa"] = "binary"; + extensionMap["sh"] = "shellscript"; + extensionMap["so"] = "binary"; + extensionMap["tar"] = "tar"; + extensionMap["tex"] = "tex"; + extensionMap["tgz"] = "tgz"; + extensionMap["txt"] = "txt"; + extensionMap["ui"] = "widget_doc"; + extensionMap["uml"] = "umbrellofile"; + extensionMap["wav"] = "sound"; + extensionMap["xml"] = "html"; + extensionMap["xpm"] = "image"; + + KeyValueMap::Iterator itExtensionMap; + + for(itExtensionMap = extensionMap.begin(); itExtensionMap != extensionMap.end(); ++itExtensionMap) + { + if(extension == itExtensionMap.key()) + { + item->setPixmap(0,SmallIcon(itExtensionMap.data())); + return; + } + } + + KeyValueMap baseNameMap; + + baseNameMap["configure"] = "shellscript"; + baseNameMap["core"] = "core"; + baseNameMap["makefile"] = "make"; + baseNameMap["readme"] = "readme"; + baseNameMap["README"] = "readme"; + baseNameMap["Readme"] = "readme"; + baseNameMap["TODO"] = "txt"; + + KeyValueMap::Iterator itBaseNameMap; + + for(itBaseNameMap = baseNameMap.begin(); itBaseNameMap != baseNameMap.end(); ++itBaseNameMap) + { + if(baseName == itBaseNameMap.key()) + { + item->setPixmap(0,SmallIcon(itBaseNameMap.data())); + return; + } + } +} diff --git a/tdefilereplace/tdefilereplacelib.h b/tdefilereplace/tdefilereplacelib.h new file mode 100644 index 00000000..0810a992 --- /dev/null +++ b/tdefilereplace/tdefilereplacelib.h @@ -0,0 +1,65 @@ +/*************************************************************************** + tdefilereplacelib.h - File library, derived from filelib.h + ------------------- + begin : lun mai 3 20:19:52 CEST 1999 + + copyright : (C) 1999 by Franois Dupoux + (C) 2003 Andras Mantia + (C) 2004 Emiliano Gulmini + 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. * + * * + ***************************************************************************/ + +#ifndef KFILEREPLACELIB_H +#define KFILEREPLACELIB_H + +// KDE +#include +class KlistView; + +// local +#include "configurationclasses.h" + +class KFileReplaceLib +{ + public: + + /** + Format a path, from a path and a filename, or another sub-path (avoid double '/' risks) + Parameters::.....* basePath: fist path (can be "/" if root, or "/usr/bin/" or "/usr/bin" for example) + .................* filename: second path (can be "/doc/html/", or "doc/html/" or "doc/html/index.html" for example) + Return values:...* Full valid path (without double "/") + */ + static TQString formatFullPath(const TQString& basePath, const TQString& fileName); + + /** + Add an extension to a filename, or a filepath + Parameters::.....* filename: filename or filepath (it can have already the extension) + .................* extension: extension to add without "." (ex: "html", "kfr") + Return values:...* Filename / Filepath with the extension + */ + static TQString addExtension(const TQString& fileName, const TQString& extension); + + static TQString formatFileSize(double size); + + /** + converts the old kfr format file in the new xml-based format. + */ + static void convertOldToNewKFRFormat(const TQString& fileName, KListView* stringView); + /** + Verifies that files, which we are scanning, respect some + conditions + */ + static bool isAnAccessibleFile(const TQString& filePath, const TQString& fileName, RCOptions* info); + + static void setIconForFileEntry(TQListViewItem* item, TQString path); +}; +#endif // KFILEREPLACEFILELIB_H diff --git a/tdefilereplace/tdefilereplacepart.cpp b/tdefilereplace/tdefilereplacepart.cpp new file mode 100644 index 00000000..ab91ae47 --- /dev/null +++ b/tdefilereplace/tdefilereplacepart.cpp @@ -0,0 +1,1679 @@ +// +// +// C++ Implementation: tdefilereplacepart +// +// Description: +// +// +// Author: Andras Mantia , (C) 2003 +// Maintainer: Emiliano Gulmini , (C) 2004 +// +// Copyright: GPL v2. See COPYING file that comes with this distribution +// +// + +// QT +#include +#include +#include +#include +#include + +// KDE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// local +#include "tdefilereplacelib.h" +#include "tdefilereplacepart.h" +#include "tdefilereplaceview.h" +#include "koptionsdlg.h" +#include "knewprojectdlg.h" +#include "report.h" +#include "commandengine.h" +#include "whatthis.h" + +using namespace whatthisNameSpace; + +//PUBLIC CONSTRUCTORS +// Factory code for KDE 3 +typedef KParts::GenericFactory FileReplaceFactory; + +K_EXPORT_COMPONENT_FACTORY( libtdefilereplacepart, FileReplaceFactory ) + +KFileReplacePart::KFileReplacePart(TQWidget* parentWidget, const char* , TQObject* parent, const char* name, const TQStringList & ) : KParts::ReadOnlyPart(parent,name) +{ + setInstance(FileReplaceFactory::instance()); + TDEGlobal::locale()->insertCatalogue("tdefilereplace"); + m_parentWidget = parentWidget; + m_config = new TDEConfig("tdefilereplacerc"); + m_aboutDlg = 0; + m_stop = false; + m_optionMask = TQDir::Files; + m_w = widget(); + m_option = 0; + + loadOptionsFromRC(); + initView(); + initGUI(); + + whatsThis(); +} + +KFileReplacePart::~KFileReplacePart() +{ + m_view = 0; //it's already deleted, so set it to NULL + + saveOptionsToRC(); + + delete m_aboutDlg; + m_aboutDlg = 0; + delete m_config; + m_config = 0; + delete m_w; + m_w = 0; + delete m_option; +} + +//PRIVATE SLOTS +void KFileReplacePart::slotSetNewParameters() +{ + launchNewProjectDialog(KURL()); + m_view->changeView(m_option->m_searchingOnlyMode); + emit setStatusBarText(i18n("Ready.")); +} + +void KFileReplacePart::slotSearchingOperation() +{ + if(!checkBeforeOperation()) + return; + + KListView* rv = m_view->getResultsView(); + + rv->clear(); + + rv->setSorting(-1); + + // show wait cursor + TQApplication::setOverrideCursor( TQt::waitCursor ); + + freezeActions(); + + setOptionMask(); + + TQString currentDirectory = m_option->m_directories[0], + currentFilter = m_option->m_filters[0]; + + //m_currentDir = currentDirectory; + + m_view->showSemaphore("red"); + + uint filesNumber = 0; + + if(m_option->m_recursive) + recursiveFileSearch(currentDirectory, currentFilter, filesNumber); + else + fileSearch(currentDirectory, currentFilter); + + m_view->showSemaphore("yellow"); + + kapp->processEvents(); + + //disabling and enabling sorting... don't ask me why, but it works! + rv->setSorting(0); + rv->sort(); + rv->setSorting(-1); + + // restore false status for stop button + m_stop = false; + + TQApplication::restoreOverrideCursor(); + + emit setStatusBarText(i18n("Search completed.")); + + m_option->m_searchingOnlyMode = true; + + resetActions(); + + m_searchingOperation = true; + + m_view->showSemaphore("green"); +} + +void KFileReplacePart::slotReplacingOperation() +{ + if (KMessageBox::warningContinueCancel(m_w, i18n("You have selected %1 as the encoding of the files.
    Selecting the correct encoding is very important as if you have files that have some other encoding than the selected one, after a replace you may damage those files.

    In case you do not know the encoding of your files, select utf8 and enable the creation of backup files. This setting will autodetect utf8 and utf16 files, but the changed files will be converted to utf8.
    ").arg(m_option->m_encoding), i18n("File Encoding Warning"), KStdGuiItem::cont(), "ShowEncodingWarning") == KMessageBox::Cancel) + return; + if(!checkBeforeOperation()) + return; + + KListView* rv = m_view->getResultsView(); + + if(m_option->m_simulation) + { + emit setStatusBarText(i18n("Replacing files (simulation)...")); + rv->setColumnText(4,i18n("Replaced strings (simulation)")); + } + else + { + emit setStatusBarText(i18n("Replacing files...")); + rv->setColumnText(4,i18n("Replaced strings")); + } + // show wait cursor + TQApplication::setOverrideCursor( TQt::waitCursor ); + + freezeActions(); + + setOptionMask(); + + rv->setSorting(-1); + + m_view->showSemaphore("green"); + + TQString currentDirectory = m_option->m_directories[0]; + + m_view->showSemaphore("red"); + + if(m_option->m_recursive) + { + int filesNumber = 0; + recursiveFileReplace(currentDirectory, filesNumber); + } + else + { + fileReplace(); + } + + rv->setSorting(0); + rv->sort(); + rv->setSorting(-1); + + // restore false status for stop button + m_stop = false; + + TQApplication::restoreOverrideCursor(); + + m_option->m_searchingOnlyMode = false; + + resetActions(); + + m_searchingOperation = false; + + m_view->showSemaphore("green"); +} + +void KFileReplacePart::slotSimulatingOperation() +{ + m_option->m_simulation = true; + slotReplacingOperation(); + m_option->m_simulation = false; +} + +void KFileReplacePart::slotStop() +{ + emit setStatusBarText(i18n("Stopping...")); + m_stop = true; + TQApplication::restoreOverrideCursor(); + resetActions(); +} + +void KFileReplacePart::slotCreateReport() +{ + // Check there are results + KListView* rv = m_view->getResultsView(), + * sv = m_view->getStringsView(); + + if(rv->firstChild() == 0) + { + KMessageBox::error(m_w, i18n("There are no results to save: the result list is empty.")); + return ; + } + // Select the file where results will be saved + TQString documentName = KFileDialog::getSaveFileName(TQString(), "*.xml|XML " + i18n("Files") + " (*.xml)", m_w, i18n("Save Report")); + if (documentName.isEmpty()) + return ; + + // delete a spourious extension + documentName.truncate(documentName.length()-4); + + TQFileInfo fileInfo(documentName); + if(fileInfo.exists()) + { + KMessageBox::error(m_w, i18n("A folder or a file named %1 already exists.").arg(documentName)); + return ; + } + + TQDir directoryName; + + if(!directoryName.mkdir(documentName, true)) + { + KMessageBox::error(m_w, i18n("Cannot create the %1 folder.").arg(documentName)); + return ; + } + + directoryName.cd(documentName); + + TQString documentPath = documentName+"/"+directoryName.dirName(); + + Report report(m_option, rv, sv); + report.createDocument(documentPath); + + //resetActions(); +} + +void KFileReplacePart::slotStringsAdd() +{ + m_view->slotStringsAdd(); + resetActions(); +} + +void KFileReplacePart::slotQuickStringsAdd() +{ + //this slot handles a pair of strings that come from project dialog, + //if the control character 'N' is found at the position 0 of the two strings, + //then we start the search now. + TQString qs = m_option->m_quickSearchString; + TQStringList map; + + map.append(qs.left(1)); + map.append(qs.right(qs.length()-1)); + //in this case there is no string to search for, so return + if(map[1].isEmpty()) + return; + + //in this one instead, we must search for a string + qs = m_option->m_quickReplaceString; + map.append(qs.left(1)); + map.append(qs.right(qs.length()-1)); + + m_view->updateOptions(m_option); + + m_view->slotQuickStringsAdd(map[1],map[3]); + + //if search-only mode == true and search-now mode == true then + //search string + if(map[0] == "N") + if(m_option->m_searchingOnlyMode) + slotSearchingOperation(); + else + slotReplacingOperation(); +} + +void KFileReplacePart::slotStringsDeleteItem() +{ + m_view->slotStringsDeleteItem(); + resetActions(); +} + +void KFileReplacePart::slotStringsEmpty() +{ + m_view->slotStringsEmpty(); + resetActions(); +} + +void KFileReplacePart::slotStringsEdit() +{ + m_view->slotStringsEdit(); + resetActions(); +} + +void KFileReplacePart::slotStringsSave() +{ + m_view->slotStringsSave(); +} + +void KFileReplacePart::slotStringsLoad() +{ + // Selects the file to load from + TQString menu = "*.kfr|" + i18n("KFileReplace strings") + " (*.kfr)\n*|"+i18n("All Files") + " (*)"; + TQString fileName = KFileDialog::getOpenFileName(TQString(), menu, m_w, i18n("Load Strings From File")); + + if(!fileName.isEmpty()) + loadRulesFile(fileName); + + resetActions(); +} + +void KFileReplacePart::slotStringsInvertCur() +{ + m_view->stringsInvert(false); + resetActions(); +} + +void KFileReplacePart::slotStringsInvertAll() +{ + m_view->stringsInvert(true); + resetActions(); +} + +void KFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile) +{ + TQString fileName; + + // Downloads file if need (if url is "http://...") + if (!(TDEIO::NetAccess::download(urlFile, fileName, 0))) + return; + + // Checks it's not a directory + TQFileInfo fileInfo; + fileInfo.setFile(fileName); + if(fileInfo.isDir()) + { + KMessageBox::error(m_w, i18n("Cannot open folders.")); + return; + } + + loadRulesFile(fileName); + resetActions(); +} + +void KFileReplacePart::slotOptionRecursive() +{ + m_option->m_recursive = !m_option->m_recursive; + resetActions(); +} + +void KFileReplacePart::slotOptionBackup() +{ + m_option->m_backup = !m_option->m_backup; + resetActions(); +} + +void KFileReplacePart::slotOptionCaseSensitive() +{ + m_option->m_caseSensitive = !m_option->m_caseSensitive; + resetActions(); +} + +void KFileReplacePart::slotOptionVariables() +{ + m_option->m_variables = !m_option->m_variables; + resetActions(); +} + +void KFileReplacePart::slotOptionRegularExpressions() +{ + m_option->m_regularExpressions = !m_option->m_regularExpressions; + resetActions(); +} + +void KFileReplacePart::slotOptionPreferences() +{ + KOptionsDlg dlg(m_option, m_w, 0); + + if(!dlg.exec()) + return; + + //updating m_view + m_view->updateOptions(m_option); + + resetActions(); +} + +void KFileReplacePart::showAboutApplication() +{ + m_aboutDlg = new KAboutApplication(createAboutData(), (TQWidget *)0, (const char *)0, false); + if(m_aboutDlg == 0) + return; + + if(!m_aboutDlg->isVisible()) + m_aboutDlg->show(); + else + m_aboutDlg->raise(); +} + +void KFileReplacePart::appHelpActivated() +{ + kapp->invokeHelp(TQString(), "tdefilereplace"); +} + +void KFileReplacePart::reportBug() +{ + KBugReport dlg(m_w, true, createAboutData()); + dlg.exec(); +} + +void KFileReplacePart::resetActions() +{ + KListView* rv = m_view->getResultsView(), + * sv = m_view->getStringsView(); + + bool hasItems = (sv->firstChild() != 0), + searchOnlyMode = m_option->m_searchingOnlyMode; + + // File + actionCollection()->action("new_project")->setEnabled(true); + actionCollection()->action("search")->setEnabled(hasItems && searchOnlyMode); + actionCollection()->action("file_simulate")->setEnabled(hasItems && !searchOnlyMode); + actionCollection()->action("replace")->setEnabled(hasItems && !searchOnlyMode); + actionCollection()->action("save_results")->setEnabled(hasItems); + actionCollection()->action("stop")->setEnabled(false); + + // Strings + actionCollection()->action("strings_add")->setEnabled(true); + actionCollection()->action("strings_del")->setEnabled(hasItems); + actionCollection()->action("strings_empty")->setEnabled(hasItems); + actionCollection()->action("strings_edit")->setEnabled(hasItems); + actionCollection()->action("strings_save")->setEnabled(hasItems); + actionCollection()->action("strings_load")->setEnabled(true); + actionCollection()->action("strings_invert")->setEnabled(hasItems && !searchOnlyMode); + actionCollection()->action("strings_invert_all")->setEnabled(hasItems && !searchOnlyMode); + + // Options + actionCollection()->action("options_recursive")->setEnabled(true); + actionCollection()->action("options_backup")->setEnabled(!searchOnlyMode); + actionCollection()->action("options_case")->setEnabled(true); + actionCollection()->action("options_var")->setEnabled(!searchOnlyMode); + actionCollection()->action("options_regularexpressions")->setEnabled(true); + actionCollection()->action("configure_tdefilereplace")->setEnabled(true); + + hasItems = (rv->firstChild() != 0); + + // Results + actionCollection()->action("results_infos")->setEnabled(hasItems); + actionCollection()->action("results_openfile")->setEnabled(hasItems); + if (actionCollection()->action("results_editfile")) + actionCollection()->action("results_editfile")->setEnabled(hasItems); + actionCollection()->action("results_opendir")->setEnabled(hasItems); + actionCollection()->action("results_delete")->setEnabled(hasItems); + actionCollection()->action("results_treeexpand")->setEnabled(hasItems); + actionCollection()->action("results_treereduce")->setEnabled(hasItems); + + // Updates menus and toolbar + ((KToggleAction* ) actionCollection()->action("options_recursive"))->setChecked(m_option->m_recursive); + ((KToggleAction* ) actionCollection()->action("options_backup"))->setChecked(m_option->m_backup && !searchOnlyMode); + ((KToggleAction* ) actionCollection()->action("options_case"))->setChecked(m_option->m_caseSensitive); + ((KToggleAction* ) actionCollection()->action("options_var"))->setChecked(m_option->m_variables && !searchOnlyMode); + ((KToggleAction* ) actionCollection()->action("options_regularexpressions"))->setChecked(m_option->m_regularExpressions); +} + +//PUBLIC METHODS +TDEAboutData* KFileReplacePart::createAboutData() +{ + TDEAboutData * aboutData = new TDEAboutData("tdefilereplacepart", + I18N_NOOP("KFileReplacePart"), + KFR_VERSION, + I18N_NOOP( "Batch search and replace tool."), + TDEAboutData::License_GPL_V2, + "(C) 1999-2002 Fran�is Dupoux\n(C) 2003-2004 Andras Mantia\n(C) 2004 Emiliano Gulmini", I18N_NOOP("Part of the KDEWebDev module."), "http://www.tdewebdev.org"); + aboutData->addAuthor("Fran�is Dupoux", + I18N_NOOP("Original author of the KFileReplace tool"), + "dupoux@dupoux.com"); + aboutData->addAuthor("Emiliano Gulmini", + I18N_NOOP("Current maintainer, code cleaner and rewriter"), + "emi_barbarossa@yahoo.it"); + aboutData->addAuthor("Andras Mantia", + I18N_NOOP("Co-maintainer, KPart creator"), + "amantia@kde.org"); + aboutData->addCredit("Heiko Goller", + I18N_NOOP("Original german translator"), + "heiko.goller@tuebingen.mpg.de"); + return aboutData; +} + +//PROTECTED METHODS +bool KFileReplacePart::openURL(const KURL &url) +{ + if(!url.isEmpty() && (url.protocol() != "file")) + { + KMessageBox::sorry(m_w, i18n("Sorry, currently the KFileReplace part works only for local files."), i18n("Non Local File")); + emit canceled(""); + return false; + } + if(!url.isEmpty()) + return launchNewProjectDialog(url); + else + { + resetActions(); + return true; + } +} + +//PRIVATE METHODS +void KFileReplacePart::initGUI() +{ + setXMLFile("tdefilereplacepartui.rc"); + + actionCollection()->setHighlightingEnabled(true); + + DCOPClient *client = kapp->dcopClient(); + QCStringList appList = client->registeredApplications(); + bool quantaFound = false; + for(QCStringList::Iterator it = appList.begin(); it != appList.end(); ++it) + { + if((*it).left(6) == "quanta") + { + quantaFound = true; + break; + } + } + // File + (void)new KAction(i18n("Customize Search/Replace Session..."), "projectopen", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSetNewParameters()), actionCollection(), "new_project"); + (void)new KAction(i18n("&Search"), "filesearch", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSearchingOperation()), actionCollection(), "search"); + (void)new KAction(i18n("S&imulate"), "filesimulate", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSimulatingOperation()), actionCollection(), "file_simulate"); + (void)new KAction(i18n("&Replace"), "filereplace", 0, TQT_TQOBJECT(this), TQT_SLOT(slotReplacingOperation()), actionCollection(), "replace"); + (void)new KAction(i18n("Sto&p"), "stop", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStop()), actionCollection(), "stop"); + (void)new KAction(i18n("Cre&ate Report File..."), "filesaveas", 0, TQT_TQOBJECT(this), TQT_SLOT(slotCreateReport()), actionCollection(), "save_results"); + + // Strings + (void)new KAction(i18n("&Add String..."), "editadd", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsAdd()), actionCollection(), "strings_add"); + + (void)new KAction(i18n("&Delete String"), "editremove", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del"); + (void)new KAction(i18n("&Empty Strings List"), "editdelete", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEmpty()), actionCollection(), "strings_empty"); + (void)new KAction(i18n("Edit Selected String..."), "edit", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEdit()), actionCollection(), "strings_edit"); + (void)new KAction(i18n("&Save Strings List to File..."), "filesaveas", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsSave()), actionCollection(), "strings_save"); + (void)new KAction(i18n("&Load Strings List From File..."), "unsortedList", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsLoad()), actionCollection(), "strings_load"); + (void)new KRecentFilesAction(i18n("&Load Recent Strings Files"), "fileopen", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOpenRecentStringFile(const KURL&)), actionCollection(),"strings_load_recent"); + (void)new KAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert"); + (void)new KAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all"); + + // Options + (void)new KToggleAction(i18n("&Include Sub-Folders"), "recursive_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionRecursive()), actionCollection(), "options_recursive"); + (void)new KToggleAction(i18n("Create &Backup Files"), "backup_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionBackup()), actionCollection(), "options_backup"); + (void)new KToggleAction(i18n("Case &Sensitive"), "casesensitive_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionCaseSensitive()), actionCollection(), "options_case"); + (void)new KToggleAction(i18n("Enable Commands &in Replace String: [$command:option$]"), "command_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionVariables()), actionCollection(), "options_var"); + (void)new KToggleAction(i18n("Enable &Regular Expressions"), "regularexpression_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionRegularExpressions()), actionCollection(), "options_regularexpressions"); + (void)new KAction(i18n("Configure &KFileReplace..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionPreferences()), actionCollection(), "configure_tdefilereplace"); + + // Results + (void)new KAction(i18n("&Properties"), "informations", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultProperties()), actionCollection(), "results_infos"); + (void)new KAction(i18n("&Open"), "filenew", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile"); + + if(quantaFound) + { + (void)new KAction(i18n("&Edit in Quanta"), "quanta", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile"); + } + (void)new KAction(i18n("Open Parent &Folder"), "fileopen", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir"); + (void)new KAction(i18n("&Delete"), "editdelete", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDelete()), actionCollection(), "results_delete"); + (void)new KAction(i18n("E&xpand Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand"); + (void)new KAction(i18n("&Reduce Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce"); + (void)new KAction(i18n("&About KFileReplace"), "tdefilereplace", 0, TQT_TQOBJECT(this), TQT_SLOT(showAboutApplication()), actionCollection(), "help_about_tdefilereplace"); + (void)new KAction(i18n("KFileReplace &Handbook"), "help", 0, TQT_TQOBJECT(this), TQT_SLOT(appHelpActivated()), actionCollection(), "help_tdefilereplace"); + (void)new KAction(i18n("&Report Bug"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(reportBug()), actionCollection(), "report_bug"); + +} + +void KFileReplacePart::initView() +{ + m_view = new KFileReplaceView(m_option, m_parentWidget, "view"); + + setWidget(m_view); + + m_view->setAcceptDrops(false); + + m_view->showSemaphore("green"); +} + +void KFileReplacePart::freezeActions() +{ + //Disables actions during search/replace operation + actionCollection()->action("new_project")->setEnabled(false); + actionCollection()->action("stop")->setEnabled(true); + + actionCollection()->action("file_simulate")->setEnabled(false); + actionCollection()->action("replace")->setEnabled(false); + actionCollection()->action("search")->setEnabled(false); + actionCollection()->action("strings_add")->setEnabled(false); + actionCollection()->action("strings_del")->setEnabled(false); + actionCollection()->action("strings_empty")->setEnabled(false); + actionCollection()->action("strings_edit")->setEnabled(false); + actionCollection()->action("strings_save")->setEnabled(false); + actionCollection()->action("strings_load")->setEnabled(false); + actionCollection()->action("strings_invert")->setEnabled(false); + actionCollection()->action("strings_invert_all")->setEnabled(false); + actionCollection()->action("options_recursive")->setEnabled(false); + actionCollection()->action("options_backup")->setEnabled(false); + actionCollection()->action("options_case")->setEnabled(false); + actionCollection()->action("options_var")->setEnabled(false); + actionCollection()->action("options_regularexpressions")->setEnabled(false); + actionCollection()->action("configure_tdefilereplace")->setEnabled(false); + actionCollection()->action("results_infos")->setEnabled(false); + actionCollection()->action("results_openfile")->setEnabled(false); + if (actionCollection()->action("results_editfile")) + actionCollection()->action("results_editfile")->setEnabled(false); + actionCollection()->action("results_opendir")->setEnabled(false); + actionCollection()->action("results_delete")->setEnabled(false); + actionCollection()->action("results_treeexpand")->setEnabled(false); + actionCollection()->action("results_treereduce")->setEnabled(false); + ((KToggleAction* ) actionCollection()->action("options_recursive"))->setChecked(false); + ((KToggleAction* ) actionCollection()->action("options_backup"))->setChecked(false); + ((KToggleAction* ) actionCollection()->action("options_case"))->setChecked(false); + ((KToggleAction* ) actionCollection()->action("options_var"))->setChecked(false); + ((KToggleAction* ) actionCollection()->action("options_regularexpressions"))->setChecked(false); +} + +void KFileReplacePart::loadOptionsFromRC() +{ + m_option = new RCOptions(); + + loadOptions(); + loadFileSizeOptions(); + loadDateAccessOptions(); + loadOwnerOptions(); + loadLocationsList(); + loadFiltersList(); + loadBackupExtensionOptions(); +} + +void KFileReplacePart::loadOptions() +{ + m_config->setGroup("General Options"); + + m_option->m_recentStringFileList = m_config->readListEntry(rcRecentFiles); + + m_option->m_searchingOnlyMode = m_config->readBoolEntry(rcSearchMode,SearchModeOption); + + m_config->setGroup("Options"); + + m_option->m_encoding = m_config->readEntry(rcEncoding, EncodingOption); + m_option->m_recursive = m_config->readBoolEntry(rcRecursive, RecursiveOption); + + m_option->m_caseSensitive = m_config->readBoolEntry(rcCaseSensitive, CaseSensitiveOption); + m_option->m_variables = m_config->readBoolEntry(rcVariables, VariablesOption); + m_option->m_regularExpressions = m_config->readBoolEntry(rcRegularExpressions, RegularExpressionsOption); + m_option->m_followSymLinks = m_config->readBoolEntry(rcFollowSymLinks, FollowSymbolicLinksOption); + + m_option->m_haltOnFirstOccur = m_config->readBoolEntry(rcHaltOnFirstOccur, StopWhenFirstOccurenceOption); + + m_option->m_ignoreHidden = m_config->readBoolEntry(rcIgnoreHidden, IgnoreHiddenOption); + m_option->m_ignoreFiles = m_config->readBoolEntry(rcIgnoreFiles, IgnoreFilesOption); + + m_config->setGroup("Notification Messages"); + + m_option->m_notifyOnErrors = m_config->readBoolEntry(rcNotifyOnErrors, true); + + m_option->m_askConfirmReplace = m_config->readBoolEntry(rcAskConfirmReplace, AskConfirmReplaceOption); + + TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); + + if(dontAskAgain == "yes") + m_option->m_askConfirmReplace = false; +} + +void KFileReplacePart::loadFileSizeOptions() +{ + m_config->setGroup("Size options"); + + m_option->m_minSize = m_config->readNumEntry(rcMinFileSize, FileSizeOption); + m_option->m_maxSize = m_config->readNumEntry(rcMaxFileSize, FileSizeOption); +} + +void KFileReplacePart::loadDateAccessOptions() +{ + m_config->setGroup("Access options"); + + m_option->m_dateAccess = m_config->readEntry(rcValidAccessDate, ValidAccessDateOption); + m_option->m_minDate = m_config->readEntry(rcMinDate, AccessDateOption); + m_option->m_maxDate = m_config->readEntry(rcMaxDate, AccessDateOption); +} + +void KFileReplacePart::loadOwnerOptions() +{ + m_config->setGroup("Owner options"); + + TQStringList ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerUser, OwnerOption),true); + if(ownerList[0] == "true") + m_option->m_ownerUserIsChecked = true; + else + m_option->m_ownerUserIsChecked = false; + + m_option->m_ownerUserType = ownerList[1]; + m_option->m_ownerUserBool = ownerList[2]; + m_option->m_ownerUserValue = ownerList[3]; + + ownerList = TQStringList::split(',',m_config->readEntry(rcOwnerGroup, OwnerOption),true); + + if(ownerList[0] == "true") + m_option->m_ownerGroupIsChecked = true; + else + m_option->m_ownerGroupIsChecked = false; + + m_option->m_ownerGroupType = ownerList[1]; + m_option->m_ownerGroupBool = ownerList[2]; + m_option->m_ownerGroupValue = ownerList[3]; +} + +void KFileReplacePart::loadLocationsList() +{ + m_config->setGroup("Directories"); + TQStringList locationsEntryList; + #if KDE_IS_VERSION(3,1,3) + locationsEntryList = m_config->readPathListEntry(rcDirectoriesList); + #else + locationsEntryList = m_config->readListEntry(rcDirectoriesList); + #endif + + if(locationsEntryList.isEmpty()) + locationsEntryList.append(TQDir::current().path()); + + m_option->m_directories = locationsEntryList; +} + +void KFileReplacePart::loadFiltersList() +{ + TQStringList filtersEntryList; + + m_config->setGroup("Filters"); + #if KDE_IS_VERSION(3,1,3) + filtersEntryList = m_config->readPathListEntry(rcFiltersList); + #else + filtersEntryList = m_config->readListEntry(rcFiltersList); + #endif + + if(filtersEntryList.isEmpty()) + filtersEntryList.append("*.htm;*.html;*.xml;*.xhtml;*.css;*.js;*.php"); + + m_option->m_filters = filtersEntryList; +} + +void KFileReplacePart::loadBackupExtensionOptions() +{ + m_config->setGroup("Options"); + TQStringList bkList = TQStringList::split(',', + m_config->readEntry(rcBackupExtension, BackupExtensionOption), + true); + if(bkList[0] == "true") + m_option->m_backup = true; + else + m_option->m_backup = false; + + m_option->m_backupExtension = bkList[1]; +} + +void KFileReplacePart::saveOptionsToRC() +{ + saveOptions(); + saveFileSizeOptions(); + saveDateAccessOptions(); + saveOwnerOptions(); + saveLocationsList(); + saveFiltersList(); + saveBackupExtensionOptions(); +} + +void KFileReplacePart::saveOptions() +{ + m_config->setGroup("General Options"); + + m_config->writeEntry(rcRecentFiles, m_option->m_recentStringFileList); + m_config->writeEntry(rcSearchMode,m_option->m_searchingOnlyMode); + + m_config->setGroup("Options"); + + m_config->writeEntry(rcEncoding, m_option->m_encoding); + m_config->writeEntry(rcRecursive, m_option->m_recursive); + m_config->writeEntry(rcCaseSensitive, m_option->m_caseSensitive); + m_config->writeEntry(rcVariables, m_option->m_variables); + m_config->writeEntry(rcRegularExpressions, m_option->m_regularExpressions); + + m_config->writeEntry(rcFollowSymLinks, m_option->m_followSymLinks); + m_config->writeEntry(rcHaltOnFirstOccur, m_option->m_haltOnFirstOccur); + + m_config->writeEntry(rcIgnoreHidden, m_option->m_ignoreHidden); + m_config->writeEntry(rcIgnoreFiles, m_option->m_ignoreFiles); + + m_config->setGroup("Notification Messages"); + m_config->writeEntry(rcNotifyOnErrors, m_option->m_notifyOnErrors); + if(m_config->readEntry(rcDontAskAgain,"no") == "yes") + m_config->writeEntry(rcAskConfirmReplace, false); + else + m_config->writeEntry(rcAskConfirmReplace, m_option->m_askConfirmReplace); + + m_config->sync(); +} + +void KFileReplacePart::saveFileSizeOptions() +{ + m_config->setGroup("Size options"); + + m_config->writeEntry(rcMaxFileSize, m_option->m_maxSize); + m_config->writeEntry(rcMinFileSize, m_option->m_minSize); + + m_config->sync(); +} + +void KFileReplacePart::saveDateAccessOptions() +{ + m_config->setGroup("Access options"); + + m_config->writeEntry(rcValidAccessDate, m_option->m_dateAccess); + m_config->writeEntry(rcMinDate, m_option->m_minDate); + m_config->writeEntry(rcMaxDate, m_option->m_maxDate); + + m_config->sync(); +} + +void KFileReplacePart::saveOwnerOptions() +{ + m_config->setGroup("Owner options"); + + TQString list; + if(m_option->m_ownerUserIsChecked) + list = "true,"; + else + list = "false,"; + + list += m_option->m_ownerUserType + + "," + + m_option->m_ownerUserBool; + if(!m_option->m_ownerUserValue.isEmpty()) + list += "," + m_option->m_ownerUserValue; + + m_config->writeEntry(rcOwnerUser,list); + + if(m_option->m_ownerGroupIsChecked) + list = "true,"; + else + list = "false,"; + + list += m_option->m_ownerGroupType + + "," + + m_option->m_ownerGroupBool; + if(!m_option->m_ownerGroupValue.isEmpty()) + list += "," + m_option->m_ownerGroupValue; + + m_config->writeEntry(rcOwnerGroup,list); + m_config->sync(); +} + +void KFileReplacePart::saveLocationsList() +{ + m_config->setGroup("Directories"); + #if KDE_IS_VERSION(3,1,3) + m_config->writePathEntry(rcDirectoriesList, m_option->m_directories); + #else + m_config->writeEntry(rcDirectoriesList, m_option->m_directories); + #endif + m_config->sync(); +} + +void KFileReplacePart::saveFiltersList() +{ + m_config->setGroup("Filters"); + m_config->writeEntry(rcFiltersList, m_option->m_filters); + m_config->sync(); +} + +void KFileReplacePart::saveBackupExtensionOptions() +{ + m_config->setGroup("Options"); + TQString bkOptions; + if(m_option->m_backup) + bkOptions = "true," + m_option->m_backupExtension; + else + bkOptions = "false," + m_option->m_backupExtension; + + m_config->writeEntry(rcBackupExtension, bkOptions); + m_config->sync(); +} + +void KFileReplacePart::fileReplace() +{ + TQString directoryName = m_option->m_directories[0]; + TQDir d(directoryName); + d.setMatchAllDirs(true); + d.setFilter(m_optionMask); + + TQString currentFilter = m_option->m_filters[0]; + TQStringList filesList = d.entryList(currentFilter); + TQStringList::iterator filesIt; + int filesNumber = 0; + + m_view->displayScannedFiles(filesNumber); + + for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt) + { + TQString fileName = (*filesIt); + + // m_stop == true means that we pushed the stop button + if(m_stop) + break; + + // Avoids files that not match requirements + if(!KFileReplaceLib::isAnAccessibleFile(d.canonicalPath(), fileName, m_option)) + continue; + kapp->processEvents(); + if(m_option->m_backup) + replaceAndBackup(d.canonicalPath(), fileName); + else + replaceAndOverwrite(d.canonicalPath(), fileName); + + filesNumber++; + m_view->displayScannedFiles(filesNumber); + } +} + +void KFileReplacePart::recursiveFileReplace(const TQString& directoryName, int& filesNumber) +{ + //if m_stop == true then interrupts recursion + if(m_stop) + return; + else + { + TQDir d(directoryName); + + d.setMatchAllDirs(true); + d.setFilter(m_optionMask); + + TQString currentFilter = m_option->m_filters[0]; + TQStringList filesList = d.entryList(currentFilter); + TQStringList::iterator filesIt; + + for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) + { + //if m_stop == true then end for-loop + if(m_stop) + break; + + TQString fileName = (*filesIt); + + // Avoids files that not match requirements + if(!KFileReplaceLib::isAnAccessibleFile(d.canonicalPath(),fileName, m_option)) + continue; + + TQString filePath = d.canonicalPath()+"/"+fileName; + + TQFileInfo qi(filePath); + + m_view->displayScannedFiles(filesNumber); + + //if filePath is a directory then recursion + if(qi.isDir()) + recursiveFileReplace(filePath, filesNumber); + else + { + kapp->processEvents(); + if(m_option->m_backup) + replaceAndBackup(d.canonicalPath(), fileName); + else + replaceAndOverwrite(d.canonicalPath(), fileName); + + filesNumber++; + m_view->displayScannedFiles(filesNumber); + } + } + } +} + +void KFileReplacePart::replaceAndBackup(const TQString& currentDir, const TQString& oldFileName) +{ + //Creates a path string + TQString oldPathString = currentDir+"/"+oldFileName; + + TQFile currentFile(oldPathString); + if(!currentFile.open(IO_ReadOnly)) + { + KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(oldFileName),TQString(), rcNotifyOnErrors); + return ; + } + TQTextStream currentStream(¤tFile); + if (m_option->m_encoding == "utf8") + currentStream.setEncoding(TQTextStream::UnicodeUTF8); + else + currentStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); + TQString line = currentStream.read(), + backupLine = line; + + TQString backupSize = KFileReplaceLib::formatFileSize(currentFile.size()); + + currentFile.close(); + + TQString backupExtension = m_option->m_backupExtension; + + bool atLeastOneStringFound = false; + KListViewItem *item = 0; + int occurrence = 0; + + replacingLoop(line, &item, atLeastOneStringFound, occurrence, m_option->m_regularExpressions, m_option->m_askConfirmReplace); + + //If we are not performing a simulation creates a backup file + if(!m_option->m_simulation) + { + if(atLeastOneStringFound) + { + TDEIO::NetAccess::file_copy(KURL::fromPathOrURL(oldPathString), KURL::fromPathOrURL(oldPathString + backupExtension), -1, true); + } + } + + if(!m_option->m_simulation) + { + if(atLeastOneStringFound) + { + TQFile newFile(oldPathString); + if(!newFile.open(IO_WriteOnly)) + { + KMessageBox::information(m_w, i18n("Cannot open file %1 for writing.").arg(oldFileName),TQString(), rcNotifyOnErrors); + return ; + } + TQTextStream newStream(&newFile); + if (m_option->m_encoding == "utf8") + newStream.setEncoding(TQTextStream::UnicodeUTF8); + else + newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); + newStream << line; + newFile.close(); + } + } + + if(!m_option->m_ignoreFiles) + atLeastOneStringFound = true; + + TQFileInfo oldFileInfo(oldPathString); + + if(atLeastOneStringFound && item/* && atLeastOneStringConfirmed*/) + { + KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+oldFileName); + item->setText(0,oldFileName); + item->setText(1,currentDir); + TQString newSize = KFileReplaceLib::formatFileSize(oldFileInfo.size()); + if(!m_option->m_simulation) + { + item->setText(2, backupSize); + item->setText(3, newSize); + } + else + { + item->setText(2, backupSize); + item->setText(3, "-"); + } + + item->setText(4,TQString::number(occurrence,10)); + item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); + item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); + } +} + +void KFileReplacePart::replaceAndOverwrite(const TQString& currentDir, const TQString& oldFileName) +{ + TQString oldPathString = currentDir+"/"+oldFileName; + TQFile oldFile(oldPathString); + TQFileInfo oldFileInfo(oldPathString); + + if (!oldFile.open(IO_ReadOnly)) + { + KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(oldFile.name()),TQString(), rcNotifyOnErrors); + return ; + } + + TQString fileSizeBeforeReplacing = KFileReplaceLib::formatFileSize(oldFileInfo.size()); + KListViewItem *item = 0; + + TQTextStream oldStream( &oldFile ); + if (m_option->m_encoding == "utf8") + oldStream.setEncoding(TQTextStream::UnicodeUTF8); + else + oldStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); + TQString line = oldStream.read(); + + oldFile.close(); + + bool atLeastOneStringFound = false; + int occurrence = 0; + + replacingLoop(line, &item, atLeastOneStringFound, occurrence, m_option->m_regularExpressions, m_option->m_askConfirmReplace); + + + if(!m_option->m_simulation) + { + if(atLeastOneStringFound) + { + TQFile newFile(oldPathString); + if(!newFile.open(IO_WriteOnly)) + { + KMessageBox::information(m_w, i18n("Cannot open file %1 for writing.").arg(newFile.name()),TQString(), rcNotifyOnErrors); + return ; + } + TQTextStream newStream( &newFile ); + if (m_option->m_encoding == "utf8") + newStream.setEncoding(TQTextStream::UnicodeUTF8); + else + newStream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); + newStream << line; + newFile.close(); + } + } + + TQFileInfo nf(oldPathString); + TQString fileSizeAfterReplacing = KFileReplaceLib::formatFileSize(nf.size()); + + //if ignoreFiles == false then every files must be show + if(!m_option->m_ignoreFiles) + atLeastOneStringFound = true; + + if(atLeastOneStringFound && item/*&& atLeastOneStringConfirmed*/) + { + KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+oldFileName); + item->setText(0,oldFileName); + item->setText(1,currentDir); + item->setText(2,fileSizeBeforeReplacing); + if(!m_option->m_simulation) + item->setText(3,fileSizeAfterReplacing); + else + item->setText(3,"-"); + + item->setText(4,TQString::number(occurrence,10)); + item->setText(5,TQString("%1[%2]").arg(oldFileInfo.owner()).arg(oldFileInfo.ownerId())); + item->setText(6,TQString("%1[%2]").arg(oldFileInfo.group()).arg(oldFileInfo.groupId())); + } +} + +void KFileReplacePart::replacingLoop(TQString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace) +{ + KeyValueMap tempMap = m_replacementMap; + KeyValueMap::Iterator it; + KListView* rv = m_view->getResultsView(); + + for(it = tempMap.begin(); it != tempMap.end(); ++it) + { + if(m_stop) + break; + + ResultViewEntry entry(it.key(), it.data(), regularExpression, m_option->m_caseSensitive); + while(entry.pos(line) != -1) + { + if(m_stop) + break; + + if(askConfirmReplace) + { + int answer = KMessageBox::questionYesNo(0, + i18n("Do you want to replace the string %1 with the string %2?").arg(it.key()).arg(it.data()), + i18n("Confirm Replace"), + i18n("Replace"), + i18n("Do Not Replace"), + rcDontAskAgain); + if(answer == KMessageBox::Yes) + { + atLeastOneStringFound = true; + TQString msg = entry.message(entry.capturedText(line), + entry.lineNumber(line), + entry.columnNumber(line)); + + if(!*item) + *item = new KListViewItem(rv); + KListViewItem* tempItem = new KListViewItem(*item); + tempItem->setMultiLinesEnabled(true); + tempItem->setText(0,msg); + occur ++; + entry.updateLine(line); + entry.incPos(); + } + else + { + entry.incPos(); + } + if(dontAskAgain()) askConfirmReplace = false; + } + else + { + atLeastOneStringFound = true; + TQString msg = entry.message(entry.capturedText(line), + entry.lineNumber(line), + entry.columnNumber(line)); + + if(!*item) + *item = new KListViewItem(rv); + KListViewItem* tempItem = new KListViewItem(*item); + tempItem->setMultiLinesEnabled(true); + tempItem->setText(0,msg); + occur ++; + entry.updateLine(line); + entry.incPos(); + } + + } + } +} + +void KFileReplacePart::fileSearch(const TQString& directoryName, const TQString& filters) +{ + TQDir d(directoryName); + + d.setMatchAllDirs(true); + d.setFilter(m_optionMask); + + TQStringList filesList = d.entryList(filters); + TQString filePath = d.canonicalPath(); + TQStringList::iterator filesIt; + uint filesNumber = 0; + + m_view->displayScannedFiles(filesNumber); + + for (filesIt = filesList.begin(); filesIt != filesList.end() ; ++filesIt) + { + // We pushed stop button + if(m_stop) + break; + + TQString fileName = (*filesIt); + + // Avoids files that not match + if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) + continue; + + TQFileInfo fileInfo(filePath+"/"+fileName); + if(fileInfo.isDir()) + continue; + kapp->processEvents(); + search(filePath, fileName); + filesNumber++; + m_view->displayScannedFiles(filesNumber); + } +} + +void KFileReplacePart::recursiveFileSearch(const TQString& directoryName, const TQString& filters, uint& filesNumber) +{ + // if m_stop == true then interrupt recursion + if(m_stop) + return; + else + { + TQDir d(directoryName); + + d.setMatchAllDirs(true); + d.setFilter(m_optionMask); + + TQStringList filesList = d.entryList(filters); + TQString filePath = d.canonicalPath(); + TQStringList::iterator filesIt; + + for(filesIt = filesList.begin(); filesIt != filesList.end(); ++filesIt) + { + // stop polling + if(m_stop) + break; + + TQString fileName = (*filesIt); + // Avoids files that not match + if(!KFileReplaceLib::isAnAccessibleFile(filePath, fileName, m_option)) + continue; + + // Composes file path string + TQFileInfo fileInfo(filePath+"/"+fileName); + + m_view->displayScannedFiles(filesNumber); + + // Searchs recursively if "filePath" is a directory + if(fileInfo.isDir()) + recursiveFileSearch(filePath+"/"+fileName, filters, filesNumber); + else + { + kapp->processEvents(); + search(filePath, fileName); + filesNumber++; + m_view->displayScannedFiles(filesNumber); + } + } + } +} + +void KFileReplacePart::search(const TQString& currentDir, const TQString& fileName) +{ + TQFile file(currentDir+"/"+fileName); + + if(!file.open(IO_ReadOnly)) + { + KMessageBox::information(m_w, i18n("Cannot open file %1 for reading.").arg(fileName), TQString(), rcNotifyOnErrors); + return ; + } + // Creates a stream with the file + TQTextStream stream( &file ); + if (m_option->m_encoding == "utf8") + stream.setEncoding(TQTextStream::UnicodeUTF8); + else + stream.setCodec(TQTextCodec::codecForName(m_option->m_encoding.ascii())); + TQString line = stream.read(); + file.close(); + + TQFileInfo fileInfo(currentDir+"/"+fileName); + + KListViewItem *item = 0; + + //Counts occurrences + int occurrence = 0; + + //This map contains strings to search + KeyValueMap tempMap = m_replacementMap; + //If no strings has been found, then no lines will be added to the result view + bool atLeastOneStringFound = false; + + KeyValueMap::Iterator it = tempMap.begin(); + + KListView* rv = m_view->getResultsView(); + + while(it != tempMap.end()) + { + //stop polling + if(m_stop) + break; + + TQString key = it.key(); + TQString strKey; + TQRegExp rxKey; + + if(m_option->m_regularExpressions) + rxKey = TQRegExp("("+key+")", m_option->m_caseSensitive, false); + else + strKey = key; + /* If this option is true then for any string in + * the map we search for the first match*/ + if(m_option->m_haltOnFirstOccur) + { + int pos; + + if(m_option->m_regularExpressions) + pos = line.find(rxKey); + else + pos = line.find(strKey, 0 ,m_option->m_caseSensitive); + + if(pos != -1) + { + atLeastOneStringFound = true; + int lineNumber = line.mid(0,pos).contains('\n')+1; + int columnNumber = pos - line.findRev('\n',pos); + + if (!item) + item = new KListViewItem(rv); + + KListViewItem* tempItem= new KListViewItem(item); + TQString msg, + capturedText; + + if(m_option->m_regularExpressions) + capturedText = rxKey.cap(1); + else + capturedText = line.mid(pos,strKey.length()); + + msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); + tempItem->setMultiLinesEnabled(true); + tempItem->setText(0,msg); + occurrence = 1; + } + }// ends m_option->m_haltOnFirstOccur if-block + else + { + /* This point of the code is reached when we must search for all + * occurrences of all the strings*/ + + int pos = 0; + if(m_option->m_regularExpressions) + pos = rxKey.search(line,pos); + else + pos = line.find(strKey, pos ,m_option->m_caseSensitive); + + while(pos != -1) + { + //stop polling + if(m_stop) + break; + + atLeastOneStringFound = true; + TQString msg, + capturedText; + int lineNumber = line.mid(0,pos).contains('\n')+1; + int columnNumber = pos - line.findRev('\n',pos); + + if(m_option->m_regularExpressions) + { + capturedText = rxKey.cap(1); + pos = rxKey.search(line, pos+rxKey.matchedLength()); + } + else + { + capturedText = line.mid(pos,strKey.length()); + pos = line.find(strKey,pos+strKey.length()); + } + + msg = i18n(" Line:%2, Col:%3 - \"%1\"").arg(capturedText).arg(TQString::number(lineNumber,10)).arg(TQString::number(columnNumber,10)); + + if(!item) + item = new KListViewItem(rv); + KListViewItem* tempItem = new KListViewItem(item); + tempItem->setMultiLinesEnabled(true); + tempItem->setText(0,msg); + occurrence++; + //we push stop button + if(m_stop) + break; + } + } + //Advances of one position in the strings map + ++it; + + //we push stop button + if(m_stop) + break; + } + + //if ignoreFiles == false then every files must be show + if(!m_option->m_ignoreFiles) + atLeastOneStringFound = true; + + if(atLeastOneStringFound && item) + { + KFileReplaceLib::setIconForFileEntry(item,currentDir+"/"+fileName); + item->setText(0,fileName); + item->setText(1,currentDir); + item->setText(2,KFileReplaceLib::formatFileSize(fileInfo.size())); + item->setText(3,TQString::number(occurrence,10)); + item->setText(4,TQString("%1[%2]").arg(fileInfo.owner()).arg(fileInfo.ownerId())); + item->setText(5,TQString("%1[%2]").arg(fileInfo.group()).arg(fileInfo.groupId())); + } +} + +void KFileReplacePart::loadViewContent() +{ + /* Maps the content of the strings view to a TQMap */ + KeyValueMap tempMap; + CommandEngine command; + + TQListViewItemIterator itlv(m_view->getStringsView()); + while(itlv.current()) + { + TQListViewItem *item = itlv.current(); + if(m_option->m_variables) + tempMap[item->text(0)] = command.variableValue(item->text(1)); + else + tempMap[item->text(0)] = item->text(1); + ++itlv; + } + m_replacementMap = tempMap; +} + +void KFileReplacePart::loadRulesFile(const TQString& fileName) +{ + /* Loads a file with kfr extension. + * creates a xml document and browses it*/ + TQDomDocument doc("mydocument"); + TQFile file(fileName); + KListView* sv = m_view->getStringsView(); + + if(!file.open(IO_ReadOnly)) + { + KMessageBox::error(m_w, i18n("Cannot open the file %1 and load the string list.").arg(fileName)); + return ; + } + + if(!doc.setContent(&file)) + { + file.close(); + + KMessageBox::information(m_w, i18n("File %1 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.").arg(fileName),i18n("Warning")); + + KFileReplaceLib::convertOldToNewKFRFormat(fileName, sv); + + return; + } + else + file.close(); + + //clears view + sv->clear(); + + TQDomElement docElem = doc.documentElement(); + TQDomNode n = docElem.firstChild(); + TQString searchAttribute = n.toElement().attribute("search").latin1(); + + KeyValueMap docMap; + + if(searchAttribute.isNull() || searchAttribute.isEmpty()) + { + int answer = KMessageBox::warningYesNo(m_w, i18n("The format of kfr files has been changed; attempting to load %1. Please see the KFilereplace manual for details. Do you want to load a search-and-replace list of strings?").arg(fileName),i18n("Warning"),i18n("Load"),i18n("Do Not Load")); + + if(answer == KMessageBox::Yes) + searchAttribute = "false"; + else + searchAttribute = "true"; + } + //Verifies the search mode + if(searchAttribute == "true") + m_option->m_searchingOnlyMode = true; + else + m_option->m_searchingOnlyMode = false; + + //Refreshes the view appearances + m_view->changeView(m_option->m_searchingOnlyMode); + //Goes to next tag + n = n.nextSibling(); + //Reads the string list + while(!n.isNull()) + { + TQDomElement e = n.toElement(); // tries to convert the node to an element. + if(!e.isNull()) + { + TQString oldString = e.firstChild().toElement().text(), + newString = e.lastChild().toElement().text(); + docMap[oldString] = newString; + } + n = n.nextSibling(); + } + + // Adds file to "load strings form file" menu + TQStringList fileList = m_option->m_recentStringFileList; + if(!fileList.contains(fileName)) + { + fileList.append(fileName); + ((KRecentFilesAction* ) actionCollection()->action("strings_load_recent"))->setItems(fileList); + m_option->m_recentStringFileList = fileList; + } + + m_view->changeView(m_option->m_searchingOnlyMode); + + m_view->loadMap(docMap); + + //resetActions(); +} + +bool KFileReplacePart::launchNewProjectDialog(const KURL & startURL) +{ + if(!startURL.isEmpty()) + m_option->m_directories.prepend(startURL.path()); + + /* This dlg reads options from m_option, then execs, finally returns options.*/ + KNewProjectDlg dlg(m_option); + + if(!dlg.exec()) + return false; + + dlg.saveRCOptions(); + + m_config->sync(); + + slotQuickStringsAdd(); + + m_view->updateOptions(m_option); + + resetActions(); + + return true; +} + +void KFileReplacePart::setOptionMask() +{ + m_optionMask |= TQDir::Dirs; + + if(!m_option->m_ignoreHidden) + m_optionMask |= TQDir::Hidden; + + if(!m_option->m_followSymLinks) + m_optionMask |= TQDir::NoSymLinks; +} + +bool KFileReplacePart::checkBeforeOperation() +{ + loadViewContent(); + KListView* sv = m_view->getStringsView(); + + // Checks if there are strings to replace (not need in search operation) + if (sv->childCount() == 0) + { + KMessageBox::error(m_w, i18n("There are no strings to search and replace.")); + return false; + } + + // Checks if the main directory can be accessed + TQString currentDirectory = m_option->m_directories[0]; + TQDir dir; + + dir.setPath(currentDirectory); + TQString directory = dir.absPath(); + + if(!dir.exists()) + { + KMessageBox::error(m_w, i18n("The main folder of the project %1 does not exist.").arg(directory)); + return false; + } + + TQFileInfo dirInfo(directory); + if(!(dirInfo.isReadable() && dirInfo.isExecutable()) + || (!m_option->m_searchingOnlyMode && !m_option->m_simulation && !(dirInfo.isWritable()))) + { + KMessageBox::error(m_w, i18n("Access denied in the main folder of the project:
    %1
    ").arg(directory)); + return false; + } + + // Clears the list view + m_view->getResultsView()->clear(); + + return true; +} + +bool KFileReplacePart::dontAskAgain() +{ + m_config->setGroup("Notification Messages"); + TQString dontAskAgain = m_config->readEntry(rcDontAskAgain, "no"); + if(dontAskAgain == "yes") + return true; + else + return false; +} + +void KFileReplacePart::whatsThis() +{ + actionCollection()->action("options_backup")->setWhatsThis(optionsBackupWhatthis); + actionCollection()->action("options_case")->setWhatsThis(optionsCaseWhatthis); + actionCollection()->action("options_var")->setWhatsThis(optionsVarWhatthis); + actionCollection()->action("options_recursive")->setWhatsThis(optionsRecursiveWhatthis); + actionCollection()->action("options_regularexpressions")->setWhatsThis(optionsRegularExpressionsWhatthis); +} + +#include "tdefilereplacepart.moc" diff --git a/tdefilereplace/tdefilereplacepart.desktop b/tdefilereplace/tdefilereplacepart.desktop new file mode 100644 index 00000000..de5ba1ee --- /dev/null +++ b/tdefilereplace/tdefilereplacepart.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +Type=Service +MimeType=inode/directory +Icon=tdefilereplace.png +ServiceTypes=KParts/ReadOnlyPart +X-TDE-Library=libtdefilereplacepart +Comment=A batch search and replace tool +Comment[bg]=Търсене и замяна във фонов режим +Comment[ca]=Una eina per a la cerca i substitució per lots +Comment[cs]=Dávkový nástroj pro hledání a nahrazování +Comment[da]=Søg- og erstat-gruppekørselsværktøj +Comment[de]=Ein Werkzeug zum Suchen und Ersetzen im Stapelbetrieb +Comment[el]= Εργαλείο πολλαπλής αναζήτησης και αντικατάστασης +Comment[es]=Una herramienta de búsqueda y reemplazo por lotes +Comment[et]=Otsimise ja asendamise tööriist +Comment[eu]=Bilaketa eta ordezkapen tresna +Comment[fa]=ابزار جستجو و جایگزینی دسته‌ای +Comment[fi]=Batchien etsintä- ja korvaustyökalu +Comment[fr]=Un outil de recherche et de remplacement de texte en série. +Comment[gl]=Unha utilidade de busca e reemprazo por lotes +Comment[hi]=एक खोज तथा बदल उपकरण +Comment[hu]=Sok fájl kezelésére alkalmas kereső- és cserélőprogram +Comment[is]=Tól til að leita að texta og skipta út +Comment[it]=Uno strumento per la ricerca e la sostituzione in sequenza +Comment[ja]=バッチ検索および置換ツール +Comment[ka]=ჯგუფური ძიების და ჩანაცვლების ხელსაწყო +Comment[lt]=Paketinis paieškos ir keitimo įrankis +Comment[ms]=Gugusan alatan cari dan ganti +Comment[nds]=En Söök- un Utwesselwarktüüch för Stapelbedrief +Comment[ne]=एउटा समूह खोजी गर्ने र बदल्ने उपकरण +Comment[nl]=Een gereedschap voor zoeken en vervangen +Comment[pl]=Narzędzie do wyszukiwania i zamiany +Comment[pt]=Uma ferramenta de procura e substituição por atacado +Comment[pt_BR]=Uma ferramenta de substituição e pesquisa batch +Comment[ru]=Пакетный поиск и замена +Comment[sk]=Dávkovací nástroj pre nájsť a zameniť +Comment[sl]=Orodje serijskega iskanja in zamenjevanja +Comment[sr]=Алат за пакетну претрагу и замену +Comment[sr@Latn]=Alat za paketnu pretragu i zamenu +Comment[sv]=Ett sök- och ersättningsverktyg +Comment[ta]=தொகுதி தேடல் மற்றும் கருவி இடமாற்றல் +Comment[tg]=Ҷустуҷӯи пакет ва ивази асбоб +Comment[tr]=Bir toplu arama ve değiştirme aracı +Comment[uk]=Засіб пакетного пошуку та заміни +Comment[zh_CN]=批量搜索替换工具 +Comment[zh_HK]=批次搜尋及取代工具 +Comment[zh_TW]=批次搜尋及取代工具 +Name=KFileReplace +Name[hi]=के-फ़ाइल-रिप्लेस +Name[ne]=बदल्ने केडीई फाइल +Name[pa]=ਕੇ-ਫਾਇਲ-ਬਦਲੋ +Name[sk]=KFile zameniť +Name[sv]=Kfilereplace +Name[ta]=Kகோப்பு இடமாற்று +Name[tg]=KФайлро ҷойгузор кардан +Name[tr]=K Dosya Değiştirme +GenericName=File Replace View +GenericName[bg]=Преглед на файловете за замяна +GenericName[ca]=Vista per a substituir fitxers +GenericName[cs]=Nahrazení souborů +GenericName[da]=Filerstatningsvisning +GenericName[de]=KFileReplace +GenericName[el]=Προβολή αντικατάστασης αρχείου +GenericName[es]=Vista de reemplazo de archivo +GenericName[et]=Failide asendamise vaade +GenericName[eu]=Fitxategi ordezkapen ikuspegia +GenericName[fa]=نمای جایگزینی پرونده +GenericName[fi]=Tiedoston korvausnäyttö +GenericName[fr]=Remplacement de fichiers +GenericName[gl]=Vista de reemprazo de ficheiro +GenericName[hu]=Fájlcserélő nézet +GenericName[is]=Texta útskiptingarsýn +GenericName[it]=Vista di sostituzione file +GenericName[ja]=ファイル置換ビュー +GenericName[ka]=ფაილის ჩანაცვლების ხედი +GenericName[lt]=Keitimų bylose vaizdas +GenericName[ms]=Paparan Ganti Fail +GenericName[nds]=Datei-Utwesselansicht +GenericName[ne]=फाइल बदल्ने दृश्य +GenericName[nl]=Weergave van bestanden vervangen +GenericName[pa]=ਫਾਇਲ ਤਬਦੀਲ ਝਲਕ +GenericName[pl]=Widok zamiany w plikach +GenericName[pt]=Vista de Substituição de Ficheiros +GenericName[pt_BR]=Visão de Substituição de Arquivos +GenericName[ru]=Средство поиска и замены в файлах +GenericName[sk]=Pohľad zámeny súboru +GenericName[sl]=Prikaz zamenjave datotek +GenericName[sr]=Приказ замена у фајловима +GenericName[sr@Latn]=Prikaz zamena u fajlovima +GenericName[sv]=Filersättningsvy +GenericName[ta]=கோப்பு இடமாற்று காட்சி +GenericName[uk]=Перегляд заміни в файлах +GenericName[zh_CN]=文件替换视图 +GenericName[zh_HK]=檔案取代檢視模式 +GenericName[zh_TW]=檔案取代檢視 diff --git a/tdefilereplace/tdefilereplacepart.h b/tdefilereplace/tdefilereplacepart.h new file mode 100644 index 00000000..d4f84b77 --- /dev/null +++ b/tdefilereplace/tdefilereplacepart.h @@ -0,0 +1,160 @@ +// +// +// C++ Interface: tdefilereplacepart +// +// Description: +// +// +// Author: Andras Mantia , (C) 2003 +// Maintainer: Emiliano Gulmini , (C) 2004 +// +// Copyright: GPL v2. See COPYING file that comes with this distribution +// +// + +#ifndef KFILEREPLACEPART_H +#define KFILEREPLACEPART_H + +// QT + +// KDE +#include +class KAboutApplication; +class TDEAboutData; +class TDEConfig; + +// local +#include "configurationclasses.h" +class KFileReplaceView; + +#define KFR_VERSION "0.8.1" + +class KFileReplacePart: public KParts::ReadOnlyPart +{ + Q_OBJECT + + + private: //MEMBERS + KFileReplaceView* m_view; + TQWidget* m_parentWidget, + * m_w; + TDEConfig* m_config; + KAboutApplication* m_aboutDlg; + KeyValueMap m_replacementMap; + RCOptions* m_option; + bool m_stop, + m_searchingOperation; + int m_optionMask; + + public://Constructors + KFileReplacePart(TQWidget *parentWidget, + const char *widgetName, + TQObject *parent, + const char *name, + const TQStringList &args); + ~KFileReplacePart(); + + //SLOTS + private slots: + void slotSetNewParameters(); + void slotSearchingOperation(); + void slotReplacingOperation(); + void slotSimulatingOperation(); + void slotStop(); + void slotCreateReport(); + void slotStringsAdd(); + void slotQuickStringsAdd(); + void slotStringsDeleteItem(); + void slotStringsEmpty(); + void slotStringsEdit(); + void slotStringsSave(); + void slotStringsLoad(); + void slotStringsInvertCur(); + void slotStringsInvertAll(); + void slotOpenRecentStringFile(const KURL& urlFile); + void slotOptionRecursive(); + void slotOptionBackup(); + void slotOptionCaseSensitive(); + void slotOptionVariables(); + void slotOptionRegularExpressions(); + void slotOptionPreferences(); + void showAboutApplication(void); + void appHelpActivated(); + void reportBug(); + void resetActions(); + void slotSearchMode(bool b){ m_option->m_searchingOnlyMode = b; } + + //METHODS + public: + static TDEAboutData* createAboutData(); + TDEConfig *config(){ return m_config; } + + protected: + virtual bool openFile() { return false; } + virtual bool openURL (const KURL &url); + + private: + /** + * Initialization methods + */ + void initGUI(); + void initView(); + + /** + * This method freezes the GUI of tdefilereplace during searching + */ + void freezeActions(); + + /** + * These methods load the resources from tdefilereplacerc + */ + void loadOptionsFromRC(); + void loadOptions(); + void loadFileSizeOptions(); + void loadDateAccessOptions(); + void loadOwnerOptions(); + void loadLocationsList(); + void loadFiltersList(); + void loadBackupExtensionOptions(); + + /** + * These methods save the resources to tdefilereplacerc + */ + void saveOptionsToRC(); + void saveOptions(); + void saveFileSizeOptions(); + void saveDateAccessOptions(); + void saveOwnerOptions(); + void saveLocationsList(); + void saveFiltersList(); + void saveBackupExtensionOptions(); + + /** + * Replacing methods + */ + void fileReplace(); + void recursiveFileReplace(const TQString& dirName, int& filesNumber); + void replaceAndBackup(const TQString& currentDir, const TQString& oldFileName); + void replaceAndOverwrite(const TQString& currentDir, const TQString& oldFileName); + void replacingLoop(TQString& line, KListViewItem** item, bool& atLeastOneStringFound, int& occur, bool regularExpression, bool& askConfirmReplace); + + /** + * Searching methods + */ + void fileSearch(const TQString& dirName, const TQString& filters); + void recursiveFileSearch(const TQString& dirName, const TQString& filters, uint& filesNumber); + void search(const TQString& currentDir, const TQString& fileName); + + /** + * Others methods + */ + void loadViewContent(); + void loadRulesFile(const TQString& fileName); + bool launchNewProjectDialog(const KURL& startURL); + void setOptionMask(); + bool checkBeforeOperation(); + bool dontAskAgain(); + void whatsThis(); +}; + +#endif// KFileReplacePart diff --git a/tdefilereplace/tdefilereplacepartui.rc b/tdefilereplace/tdefilereplacepartui.rc new file mode 100644 index 00000000..797809c6 --- /dev/null +++ b/tdefilereplace/tdefilereplacepartui.rc @@ -0,0 +1,75 @@ + + + + Search/&Replace + + + + + + + &Strings + + + + + + + + + + + + + &Results + + + + + + + + + + + + &Options + + + + + + + + &Settings + + + &Help + + + + + + + +KFileReplace Main Toolbar + + + + + + + + + + + + + + + + + + + + diff --git a/tdefilereplace/tdefilereplaceui.rc b/tdefilereplace/tdefilereplaceui.rc new file mode 100644 index 00000000..e70165ae --- /dev/null +++ b/tdefilereplace/tdefilereplaceui.rc @@ -0,0 +1,10 @@ + + + + &File + + + Search/&Replace + + + diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp new file mode 100644 index 00000000..b7a8c6be --- /dev/null +++ b/tdefilereplace/tdefilereplaceview.cpp @@ -0,0 +1,672 @@ +/***************************************************************************** + tdefilereplaceview.cpp - description + ------------------- + begin : sam oct 16 15:28:00 CEST 1999 + copyright : (C) 1999 by Fran�is Dupoux + (C) 2004 Emiliano Gulmini +*****************************************************************************/ + +/***************************************************************************** + * * + * 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. * + * * + *****************************************************************************/ + +// TQt +#include +#include +#include + +// KDE +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +// local +#include "tdefilereplaceview.h" +#include "tdefilereplacelib.h" +#include "kaddstringdlg.h" +#include "whatthis.h" + +using namespace whatthisNameSpace; + +KFileReplaceView::KFileReplaceView(RCOptions* info, TQWidget *parent,const char *name):KFileReplaceViewWdg(parent,name) +{ + m_option = info; + + initGUI(); + + // connect events + connect(m_lvResults, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); + connect(m_lvResults_2, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); + connect(m_lvStrings, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); + connect(m_lvStrings_2, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); + + whatsThis(); +} + +TQString KFileReplaceView::currentPath() +{ + TQListViewItem *lvi; + + if(! m_lviCurrent) lvi = m_rv->currentItem(); + else lvi = (TQListViewItem*) m_lviCurrent; + + while (lvi->parent()) + lvi = lvi->parent(); + + return TQString(lvi->text(1)+"/"+lvi->text(0)); +} + +void KFileReplaceView::showSemaphore(TQString s) +{ + if(s == "green") + { + m_ledGo->setState(KLed::On); + m_ledWait->setState(KLed::Off); + m_ledStop->setState(KLed::Off); + } + else + if(s == "yellow") + { + m_ledGo->setState(KLed::Off); + m_ledWait->setState(KLed::On); + m_ledStop->setState(KLed::Off); + } + else + if(s == "red") + { + m_ledGo->setState(KLed::Off); + m_ledWait->setState(KLed::Off); + m_ledStop->setState(KLed::On); + } +} + +void KFileReplaceView::stringsInvert(bool invertAll) +{ + TQListViewItem* lviCurItem, + * lviFirst; + KListView* sv = getStringsView(); + + if(invertAll) + lviCurItem = lviFirst = sv->firstChild(); + else + lviCurItem = lviFirst = sv->currentItem(); + + if(lviCurItem == 0) + return ; + + do + { + TQString searchText = lviCurItem->text(0), + replaceText = lviCurItem->text(1); + + // Cannot invert the string when search string is empty + if (replaceText.isEmpty()) + { + KMessageBox::error(0, i18n("Cannot invert string %1, because the search string would be empty.").arg(searchText)); + return; + } + + lviCurItem->setText(0, replaceText); + lviCurItem->setText(1, searchText); + + lviCurItem = lviCurItem->nextSibling(); + if(!invertAll) + break; + } while(lviCurItem && lviCurItem != lviFirst); + setCurrentStringsViewMap(); +} + +void KFileReplaceView::changeView(bool searchingOnlyMode) +{ + if(searchingOnlyMode) + { + m_stackResults->raiseWidget(m_lvResults_2); + m_stackStrings->raiseWidget(m_lvStrings_2); + m_rv = m_lvResults_2; + m_sv = m_lvStrings_2; + } + else + { + m_stackResults->raiseWidget(m_lvResults); + m_stackStrings->raiseWidget(m_lvStrings); + m_rv = m_lvResults; + m_sv = m_lvStrings; + } +} + +KListView* KFileReplaceView::getResultsView() +{ + if(m_option->m_searchingOnlyMode) + m_rv = m_lvResults_2; + else + m_rv = m_lvResults; + + return m_rv; +} + +KListView* KFileReplaceView::getStringsView() +{ + if(m_option->m_searchingOnlyMode) + m_sv = m_lvStrings_2; + else + m_sv = m_lvStrings; + return m_sv; +} + +//PUBLIC SLOTS +void KFileReplaceView::slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos) +{ + if (lvi == 0) // No item selected + return; + + // RIGHT BUTTON + if (button == Qt::RightButton) + { + m_lviCurrent = static_cast(lvi); + m_menuResult->popup(pos); + } +} + +void KFileReplaceView::slotResultProperties() +{ + TQString currItem = currentPath(); + if(! currItem.isEmpty()) + { + KURL url(currItem); + (void) new KPropertiesDialog(url); + m_lviCurrent = 0; + } +} + +void KFileReplaceView::slotResultOpen() +{ + TQString currItem = currentPath(); + if(!currItem.isEmpty()) + { + (void) new KRun(KURL(currItem), 0, true, true); + m_lviCurrent = 0; + } +} + +void KFileReplaceView::slotResultOpenWith() +{ + TQString currItem = currentPath(); + if(!currItem.isEmpty()) + { + KURL::List kurls; + kurls.append(KURL(currItem)); + KRun::displayOpenWithDialog(kurls); + m_lviCurrent = 0; + } +} + +void KFileReplaceView::slotResultDirOpen() +{ + TQString currItem = currentPath(); + if(!currItem.isEmpty()) + { + TQFileInfo fi; + fi.setFile(currItem); + (void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true); + m_lviCurrent = 0; + } +} + +void KFileReplaceView::slotResultEdit() +{ + TQListViewItem *lvi = m_rv->firstChild(); + + while (lvi) + { + DCOPClient *client = kapp->dcopClient(); + DCOPRef quanta(client->appId(),"WindowManagerIf"); + TQString path = TQString(lvi->text(1)+"/"+lvi->text(0)); + TQListViewItem *lviChild = lvi; + + while(lviChild) + { + if(lviChild->isSelected()) + { + coord c; + if(lviChild == lvi) + { + c.line = 0; + c.column = 0; + } + else + { + c= extractWordCoordinates(lviChild); + } + bool success = quanta.send("openFile", path, c.line, c.column); + + if(!success) + { + TQString message = i18n("File %1 cannot be opened. Might be a DCOP problem.").arg(path); + KMessageBox::error(parentWidget(), message); + } + } + if (lviChild == lvi) + lviChild = lviChild->firstChild(); + else + lviChild = lviChild->nextSibling(); + } + + lvi = lvi->nextSibling(); + } + + m_lviCurrent = 0; +} + +void KFileReplaceView::slotResultDelete() +{ + TQString currItem = currentPath(); + if (!currItem.isEmpty()) + { + TQFile fi; + int answer = KMessageBox::warningContinueCancel(this, i18n("Do you really want to delete %1?").arg(currItem), + TQString(),KStdGuiItem::del()); + + if(answer == KMessageBox::Continue) + { + fi.setName(currItem); + fi.remove(); + + delete m_lviCurrent; + m_lviCurrent = 0; + } + } +} + +void KFileReplaceView::slotResultTreeExpand() +{ + TQListViewItem *lviRoot = getResultsView()->firstChild(); + + if(lviRoot) + expand(lviRoot, true); +} + +void KFileReplaceView::slotResultTreeReduce() +{ + TQListViewItem *lviRoot = getResultsView()->firstChild(); + + if(lviRoot) + expand(lviRoot, false); +} + +void KFileReplaceView::slotStringsAdd() +{ + KeyValueMap oldMap(m_option->m_mapStringsView); + + KAddStringDlg addStringDlg(m_option, false); + + if(!addStringDlg.exec()) + return; + + KeyValueMap addedStringsMap(m_option->m_mapStringsView); + KeyValueMap::Iterator itMap; + + for(itMap = oldMap.begin(); itMap != oldMap.end(); ++itMap) + addedStringsMap.insert(itMap.key(),itMap.data()); + + m_option->m_mapStringsView = addedStringsMap; + + raiseResultsView(); + raiseStringsView(); + + loadMapIntoView(addedStringsMap); +} + +void KFileReplaceView::slotQuickStringsAdd(const TQString& quickSearch, const TQString& quickReplace) +{ + if(!quickSearch.isEmpty()) + { + KeyValueMap map; + if(quickReplace.isEmpty()) + { + map[quickSearch] = TQString(); + m_option->m_searchingOnlyMode = true; + } + else + { + map[quickSearch] = quickReplace; + m_option->m_searchingOnlyMode = false; + } + + m_option->m_mapStringsView = map; + + raiseResultsView(); + raiseStringsView(); + + loadMapIntoView(map); + } +} + +void KFileReplaceView::slotStringsEdit() +{ + KeyValueMap oldMap(m_option->m_mapStringsView); + if(oldMap.isEmpty()) return; + bool oldSearchFlagValue = m_option->m_searchingOnlyMode; + + oldMap.remove(m_sv->currentItem()->text(0)); + + m_option->m_mapStringsView.clear(); + + m_option->m_mapStringsView.insert(m_sv->currentItem()->text(0), m_sv->currentItem()->text(1)); + + KAddStringDlg addStringDlg(m_option, true); + + if(!addStringDlg.exec()) + return; + + KeyValueMap newMap(m_option->m_mapStringsView); + if(oldSearchFlagValue == m_option->m_searchingOnlyMode) + { + KeyValueMap::Iterator itMap; + + //merges the two maps + for(itMap = oldMap.begin(); itMap != oldMap.end(); ++itMap) + newMap.insert(itMap.key(),itMap.data()); + } + + m_option->m_mapStringsView = newMap; + + raiseResultsView(); + raiseStringsView(); + + loadMapIntoView(newMap); +} + +void KFileReplaceView::slotStringsSave() +{ + // Check there are strings in the list + KListView* sv = getStringsView(); + + if (sv->firstChild() == 0) + { + KMessageBox::error(0, i18n("No strings to save as the list is empty.")); + return ; + } + + TQString header("\n"), + footer("\n"), + body; + if(m_option->m_searchingOnlyMode) + header += "\n\t"; + else + header += "\n\t"; + + TQListViewItem* lvi = sv->firstChild(); + + while( lvi ) + { + body += TQString("\n\t" + "\n\t\t" + "\n\t\t" + "\n\t").arg(lvi->text(0)).arg(lvi->text(1)); + lvi = lvi->nextSibling(); + } + + // Selects the file where strings will be saved + TQString menu = "*.kfr|" + i18n("KFileReplace 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" == KFileReplace extension + + fileName = KFileReplaceLib::addExtension(fileName, "kfr"); + + TQFile file( fileName ); + if(!file.open( IO_WriteOnly )) + { + KMessageBox::error(0, i18n("File %1 cannot be saved.").arg(fileName)); + return ; + } + TQTextStream oTStream( &file ); + oTStream.setEncoding(TQTextStream::UnicodeUTF8); + oTStream << header + << body + << footer; + file.close(); +} + +void KFileReplaceView::slotStringsDeleteItem() +{ + TQListViewItem* item = m_sv->currentItem(); + if(item != 0) + { + KeyValueMap m = m_option->m_mapStringsView; + m.remove(item->text(0)); + m_option->m_mapStringsView = m; + delete item; + } +} + +void KFileReplaceView::slotStringsEmpty() +{ + TQListViewItem * myChild = m_sv->firstChild(); + while( myChild ) + { + TQListViewItem* item = myChild; + myChild = myChild->nextSibling(); + delete item; + } + KeyValueMap m; + m_option->m_mapStringsView = m; +} + +//PRIVATE +void KFileReplaceView::initGUI() +{ + m_option->m_searchingOnlyMode = true; + + m_stackResults->addWidget(m_lvResults); + m_stackResults->addWidget(m_lvResults_2); + m_stackStrings->addWidget(m_lvStrings); + m_stackStrings->addWidget(m_lvStrings_2); + + DCOPClient *client = kapp->dcopClient(); + QCStringList appList = client->registeredApplications(); + bool quantaFound = false; + + + for(QCStringList::Iterator it = appList.begin(); it != appList.end(); ++it) + { + if((*it).left(6) == "quanta") + { + quantaFound = true; + break; + } + } + + m_menuResult = new KPopupMenu(this, "ResultPopup"); + + + + m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("fileopen")), + i18n("&Open"), + this, + TQT_SLOT(slotResultOpen())); + if(!quantaFound) + { + m_menuResult->insertItem(i18n("Open &With..."), + this, + TQT_SLOT(slotResultOpenWith())); + } + + if(quantaFound) + { + m_menuResult->insertItem(SmallIconSet("quanta"), + i18n("&Edit in Quanta"), + this, + TQT_SLOT(slotResultEdit())); + } + + m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("up")), + i18n("Open Parent &Folder"), + this, + TQT_SLOT(slotResultDirOpen())); + m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("editdelete")), + i18n("&Delete"), + this, + TQT_SLOT(slotResultDelete())); + m_menuResult->insertSeparator(); + m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("info")), + i18n("&Properties"), + this, + TQT_SLOT(slotResultProperties())); + raiseResultsView(); + raiseStringsView(); +} + +void KFileReplaceView::raiseStringsView() +{ + if(m_option->m_searchingOnlyMode) + m_sv = m_lvStrings_2; + else + m_sv = m_lvStrings; + + m_stackStrings->raiseWidget(m_sv); +} + +void KFileReplaceView::raiseResultsView() +{ + if(m_option->m_searchingOnlyMode) + m_rv = m_lvResults_2; + else + m_rv = m_lvResults; + + m_stackResults->raiseWidget(m_rv); +} + +coord KFileReplaceView::extractWordCoordinates(TQListViewItem* lvi) +{ + //get coordinates of the first string of the current selected file + coord c; + c.line = 0; + c.column = 0; + TQString s = lvi->text(0); + //tqWarning("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW=%s",s.latin1()); + /* if(lvi->parent()) s = lvi->text(0); + else return c;*/ + + TQString temp; + int i = 0; + + //extracts line and column from lvi->text(0) + //FIXME: Don't get the line and column number from the text as it's translated and it will + //fail for non-English languages! + + //EMILIANO: This is not a good fixing but for now it should reduce the problems + while(true) + { + if(s[i] < '0' || s[i] > '9') + i++; + else + break; + } + while(true) + { + if(s[i] >= '0' && s[i] <= '9') + { + temp += s[i]; + i++; + } + else + break; + } + c.line = temp.toInt(); + temp = TQString(); + + while(true) + { + if(s[i] < '0' || s[i] > '9') + i++; + else + break; + } + while(true) + { + if(s[i] >= '0' && s[i] <= '9') + { + temp += s[i]; + i++; + } + else + break; + } + c.column = temp.toInt(); + + if(c.line > 0) c.line--; + if(c.column > 0) c.column--; + + return c; +} + +void KFileReplaceView::expand(TQListViewItem *lviCurrent, bool b) +{ + // current item + lviCurrent->setOpen(b); + + // recursivity + while((lviCurrent = lviCurrent->nextSibling()) != 0) + { + lviCurrent->setOpen(b); + + if (lviCurrent->firstChild()) + expand(lviCurrent->firstChild(), b); + } +} + +void KFileReplaceView::setMap() +{ + KeyValueMap map; + TQListViewItem* i = m_sv->firstChild(); + while(i != 0) + { + if(m_option->m_searchingOnlyMode) + map[i->text(0)] = TQString(); + else + map[i->text(0)] = i->text(1); + i = i->nextSibling(); + } + m_option->m_mapStringsView = map; +} + +void KFileReplaceView::loadMapIntoView(KeyValueMap map) +{ + m_sv->clear(); + KeyValueMap::Iterator itMap; + + for(itMap = map.begin(); itMap != map.end(); ++itMap) + { + TQListViewItem* lvi = new TQListViewItem(m_sv); + lvi->setMultiLinesEnabled(true); + lvi->setText(0,itMap.key()); + if(!m_option->m_searchingOnlyMode) + lvi->setText(1,itMap.data()); + } + +} + +void KFileReplaceView::whatsThis() +{ + TQWhatsThis::add(getResultsView(), lvResultWhatthis); + TQWhatsThis::add(getStringsView(), lvStringsWhatthis); +} +#include "tdefilereplaceview.moc" diff --git a/tdefilereplace/tdefilereplaceview.h b/tdefilereplace/tdefilereplaceview.h new file mode 100644 index 00000000..adb77f6b --- /dev/null +++ b/tdefilereplace/tdefilereplaceview.h @@ -0,0 +1,117 @@ +/*************************************************************************** + tdefilereplaceview.h - description + ------------------- + begin : sam oct 16 15:28:00 CEST 1999 + copyright : (C) 1999 by Franois Dupoux + (C) 2004 Emiliano Gulmini + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KFILEREPLACEVIEW_H +#define KFILEREPLACEVIEW_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +//QT +#include +#include +class TQPixMap; + +//KDE +class KPopupMenu; +class KListView; + +//local +#include "tdefilereplaceviewwdg.h" +#include "configurationclasses.h" + +class coord +{ + public: + int line, + column; + public: + coord(){ line = 1; + column = 1;} + coord(const coord& c) { line = c.line; + column = c.column;} + coord operator=(const coord& c) { line = c.line; + column = c.column; + return (*this);} +}; + + +/** + * The view of KFilereplace. + */ +class KFileReplaceView : public KFileReplaceViewWdg +{ + Q_OBJECT + + private: + KPopupMenu* m_menuResult; + RCOptions* m_option; + KListViewItem* m_lviCurrent; + KListView* m_rv, + * m_sv; + + public://Constructors + KFileReplaceView(RCOptions* info, TQWidget *parent,const char *name); + + public: + TQString currentPath(); + void showSemaphore(TQString s); + void displayScannedFiles(int filesNumber) { m_lcdFilesNumber->display(TQString::number(filesNumber,10)); } + void stringsInvert(bool invertAll); + void changeView(bool searchingOnlyMode); + KListView* getResultsView(); + KListView* getStringsView(); + void updateOptions(RCOptions* info) { m_option = info; } + void loadMap(KeyValueMap extMap){ loadMapIntoView(extMap); } + KeyValueMap getStringsViewMap()const { return m_option->m_mapStringsView;} + void setCurrentStringsViewMap(){ setMap(); } + //void emitSearchingOnlyMode(bool b) { emit searchingOnlyMode(b); } + + public slots: + void slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos); + void slotResultProperties(); + void slotResultOpen(); + void slotResultOpenWith(); + void slotResultDirOpen(); + void slotResultEdit(); + void slotResultDelete(); + void slotResultTreeExpand(); + void slotResultTreeReduce(); + void slotStringsAdd(); + void slotQuickStringsAdd(const TQString& quickSearch, const TQString& quickReplace); + void slotStringsDeleteItem(); + void slotStringsEmpty(); + void slotStringsEdit(); + void slotStringsSave(); + + private: + void initGUI(); + void raiseStringsView(); + void raiseResultsView(); + coord extractWordCoordinates(TQListViewItem* lvi); + void expand(TQListViewItem *lviCurrent, bool b); + void setMap(); + void loadMapIntoView(KeyValueMap map); + void whatsThis(); + + /*signals: + void resetActions(); + void searchingOnlyMode(bool);*/ +}; + +#endif // KFILEREPLACEVIEW_H diff --git a/tdefilereplace/tdefilereplaceviewwdg.ui b/tdefilereplace/tdefilereplaceviewwdg.ui new file mode 100644 index 00000000..c8fca48d --- /dev/null +++ b/tdefilereplace/tdefilereplaceviewwdg.ui @@ -0,0 +1,555 @@ + +KFileReplaceViewWdg + + + KFileReplaceViewWdg + + + + 0 + 0 + 635 + 370 + + + + + unnamed + + + 0 + + + + splitter3 + + + Vertical + + + + m_stackResults + + + + 7 + 7 + 0 + 0 + + + + + WStackPage + + + 0 + + + + unnamed + + + 0 + + + + + Name + + + true + + + true + + + + + Folder + + + true + + + true + + + + + Old Size + + + true + + + true + + + + + New Size + + + true + + + true + + + + + Replaced Strings + + + true + + + true + + + + + Owner User + + + true + + + true + + + + + Owner Group + + + true + + + true + + + + m_lvResults + + + Extended + + + true + + + true + + + true + + + LastColumn + + + false + + + + 238 + 246 + 255 + + + + + + + + WStackPage + + + 1 + + + + unnamed + + + 0 + + + + + Name + + + true + + + true + + + + + Folder + + + true + + + true + + + + + Size + + + true + + + true + + + + + Found Strings + + + true + + + true + + + + + Owner User + + + true + + + true + + + + + Owner Group + + + true + + + true + + + + m_lvResults_2 + + + Extended + + + true + + + true + + + true + + + LastColumn + + + false + + + + 238 + 246 + 255 + + + + + + + + + m_stackStrings + + + + 7 + 7 + 0 + 0 + + + + + WStackPage + + + 0 + + + + unnamed + + + 0 + + + + + Search For + + + true + + + true + + + + + Replace With + + + true + + + true + + + + m_lvStrings + + + true + + + false + + + AllColumns + + + false + + + + + + + WStackPage + + + 1 + + + + unnamed + + + 0 + + + + + Search For + + + true + + + true + + + + m_lvStrings_2 + + + true + + + false + + + AllColumns + + + false + + + + + + + + + layout7 + + + + unnamed + + + + layout6 + + + + unnamed + + + + m_ledGo + + + + 20 + 20 + + + + On + + + + 170 + 255 + 0 + + + + Green means ready + + + Ready + + + + + m_ledWait + + + + 20 + 20 + + + + On + + + + 255 + 255 + 0 + + + + Yellow means wait while sorting list + + + Please wait while sorting list + + + + + m_ledStop + + + + 20 + 20 + + + + + 255 + 0 + 0 + + + + Red means scanning files + + + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 354 + 20 + + + + + + layout1 + + + + unnamed + + + + m_tlFilesNumber + + + Scanned files: + + + + + m_lcdFilesNumber + + + LineEditPanel + + + Raised + + + 7 + + + Dec + + + Flat + + + 0 + + + + + + + + + + + klistview.h + klistview.h + klistview.h + klistview.h + kled.h + kled.h + kled.h + + diff --git a/tdefilereplace/toolbar/CMakeLists.txt b/tdefilereplace/toolbar/CMakeLists.txt new file mode 100644 index 00000000..95cdbd9f --- /dev/null +++ b/tdefilereplace/toolbar/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + + +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/tdefilereplacepart/icons ) diff --git a/tdefilereplace/toolbar/Makefile.am b/tdefilereplace/toolbar/Makefile.am new file mode 100644 index 00000000..fb5c86b8 --- /dev/null +++ b/tdefilereplace/toolbar/Makefile.am @@ -0,0 +1,3 @@ +appdir = $(kde_datadir)/tdefilereplacepart/icons +app_ICON = AUTO + diff --git a/tdefilereplace/toolbar/cr22-action-back.png b/tdefilereplace/toolbar/cr22-action-back.png new file mode 100644 index 00000000..3e8f12fe Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-back.png differ diff --git a/tdefilereplace/toolbar/cr22-action-backup_option.png b/tdefilereplace/toolbar/cr22-action-backup_option.png new file mode 100644 index 00000000..a0e1e02f Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-backup_option.png differ diff --git a/tdefilereplace/toolbar/cr22-action-casesensitive_option.png b/tdefilereplace/toolbar/cr22-action-casesensitive_option.png new file mode 100644 index 00000000..6302c0f2 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-casesensitive_option.png differ diff --git a/tdefilereplace/toolbar/cr22-action-command_option.png b/tdefilereplace/toolbar/cr22-action-command_option.png new file mode 100644 index 00000000..1da3688b Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-command_option.png differ diff --git a/tdefilereplace/toolbar/cr22-action-editadd.png b/tdefilereplace/toolbar/cr22-action-editadd.png new file mode 100644 index 00000000..5eb6f503 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-editadd.png differ diff --git a/tdefilereplace/toolbar/cr22-action-editremove.png b/tdefilereplace/toolbar/cr22-action-editremove.png new file mode 100644 index 00000000..50117f6d Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-editremove.png differ diff --git a/tdefilereplace/toolbar/cr22-action-filereplace.png b/tdefilereplace/toolbar/cr22-action-filereplace.png new file mode 100644 index 00000000..c3692e11 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-filereplace.png differ diff --git a/tdefilereplace/toolbar/cr22-action-filesearch.png b/tdefilereplace/toolbar/cr22-action-filesearch.png new file mode 100644 index 00000000..1be59c49 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-filesearch.png differ diff --git a/tdefilereplace/toolbar/cr22-action-filesimulate.png b/tdefilereplace/toolbar/cr22-action-filesimulate.png new file mode 100644 index 00000000..7cc5b284 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-filesimulate.png differ diff --git a/tdefilereplace/toolbar/cr22-action-informations.png b/tdefilereplace/toolbar/cr22-action-informations.png new file mode 100644 index 00000000..daeb5b80 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-informations.png differ diff --git a/tdefilereplace/toolbar/cr22-action-invert.png b/tdefilereplace/toolbar/cr22-action-invert.png new file mode 100644 index 00000000..f3ab8be6 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-invert.png differ diff --git a/tdefilereplace/toolbar/cr22-action-next.png b/tdefilereplace/toolbar/cr22-action-next.png new file mode 100644 index 00000000..cfab7cfb Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-next.png differ diff --git a/tdefilereplace/toolbar/cr22-action-projectopen.png b/tdefilereplace/toolbar/cr22-action-projectopen.png new file mode 100644 index 00000000..607e6aa8 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-projectopen.png differ diff --git a/tdefilereplace/toolbar/cr22-action-recursive_option.png b/tdefilereplace/toolbar/cr22-action-recursive_option.png new file mode 100644 index 00000000..bc98df90 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-recursive_option.png differ diff --git a/tdefilereplace/toolbar/cr22-action-regularexpression_option.png b/tdefilereplace/toolbar/cr22-action-regularexpression_option.png new file mode 100644 index 00000000..f74c7b56 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-regularexpression_option.png differ diff --git a/tdefilereplace/toolbar/cr22-action-unsortedList.png b/tdefilereplace/toolbar/cr22-action-unsortedList.png new file mode 100644 index 00000000..bed281f1 Binary files /dev/null and b/tdefilereplace/toolbar/cr22-action-unsortedList.png differ diff --git a/tdefilereplace/tutorial.kwd b/tdefilereplace/tutorial.kwd new file mode 100644 index 00000000..2183e53b Binary files /dev/null and b/tdefilereplace/tutorial.kwd differ diff --git a/tdefilereplace/whatthis.h b/tdefilereplace/whatthis.h new file mode 100644 index 00000000..6692d373 --- /dev/null +++ b/tdefilereplace/whatthis.h @@ -0,0 +1,101 @@ +/*************************************************************************** + whatthis.h - description + ------------------- + begin : fri 12 march CEST 2004 + copyright : (C) 2004 Emiliano Gulmini + email : + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 WHATTHIS_H +#define WHATTHIS_H + +// QT +#include + +// KDE +#include + +namespace whatthisNameSpace +{ + //KFileReplaceView messages + const TQString lvResultWhatthis = i18n("Shows the statistics of your operations. Note that the columns content changes depending on what kind of operation you are performing."); + + const TQString lvStringsWhatthis = i18n("Shows a list of strings to search for (and if you specified it, a list of strings to replace with). Use the \"add strings\" dialog to edit your string list or double click on a string."); + + //KNewProjectDlg messages + const TQString cbLocationWhatthis = i18n("Base folder for operations of search/replace. Insert path string here by hand or use the search button."); + + const TQString cbFilterWhatthis = i18n("Shell-like wildcards. Example: \"*.html;*.txt;*.xml\"."); + + const TQString edSizeMinWhatthis = i18n("Insert the minimum file size you want to search, or leave it unchecked if you don't want minimum size limit."); + + const TQString edSizeMaxWhatthis = i18n("Insert the maximum file size you want to search, or leave it unchecked if you don't want maximum size limit."); + + const TQString edDateMinWhatthis = i18n("Insert the minimum value for file access date that you want to search, or leave it unchecked if you don't a minimum limit."); + + const TQString edDateMaxWhatthis = i18n("Insert the maximum value for file access date that you want to search, or leave it unchecked if you don't a maximum limit."); + + const TQString cbDateValidWhatthis = i18n("Select \"writing\" if you want to use the date of the last modification, or \"reading\" to use the the date of the last access."); + + const TQString chbDateMinWhatthis = i18n("Minimum value for access date."); + + const TQString chbDateMaxWhatthis = i18n("Maximum value for access date."); + + const TQString leSearchWhatthis = i18n("Insert here the string to search for."); + + const TQString leReplaceWhatthis = i18n("Insert here the string to replace with."); + + //KOptionsDlg messages + const TQString chbCaseSensitiveWhatthis = i18n("Enable this option if your search is case sensitive."); + + const TQString chbRecursiveWhatthis = i18n("Enable this option to search in sub folders too."); + + const TQString chbHaltOnFirstOccurrenceWhatthis = i18n("Enable this option when you are searching for a string and you are only interested to know if the string is present or not in the current file."); + + const TQString chbIgnoreWhitespacesWhatthis =""; + + const TQString chbFollowSymLinksWhatthis = i18n("If tdefilereplace encounters a symbolic link treats it like a normal folder or file."); + + const TQString chbIgnoreHiddenWhatthis = i18n("Enable this option to ignore hidden files or folders."); + + const TQString chbIgnoreFilesWhatthis = i18n("If this option is enabled, KFR will show even the names of the files in which no string has been found or replaced."); + + const TQString chbRegularExpressionsWhatthis = i18n("Allows you to apply QT-like regular expressions on the search string. Note that a complex regular expression could affect speed performance"); + + const TQString chbVariablesWhatthis = i18n("Enable \"commands\". For example: if search string is \"user\" and replace string is the command \"[$user:uid$]\", KFR will substitute \"user\" with the uid of the user."); + + const TQString chbBackupWhatthis = i18n("Enable this option if you want leave original files untouched."); + + const TQString chbConfirmStringsWhatthis = i18n("Enable this option if you want to be asked for single string replacement confirmation."); + + //KFileReplacePart + const TQString fileSimulateWhatthis = i18n("Enable this option to perform replacing as a simulation, i.e. without make any changes in files."); + + const TQString optionsRegularExpressionsWhatthis = chbRegularExpressionsWhatthis; + + const TQString optionsBackupWhatthis = chbBackupWhatthis; + + const TQString optionsCaseWhatthis = chbCaseSensitiveWhatthis; + + const TQString optionsVarWhatthis = chbVariablesWhatthis; + + const TQString optionsRecursiveWhatthis = chbRecursiveWhatthis; + + //KAddStringDlg + const TQString rbSearchOnlyWhatthis = i18n("Select search-only mode."); + + const TQString rbSearchReplaceWhatthis = i18n("Select search-and-replace mode."); + + const TQString edSearchWhatthis = i18n("Insert here a string you want search for."); + + const TQString edReplaceWhatthis = i18n("Insert here the string that KFR will use to replace the search string."); +} +#endif -- cgit v1.2.3