summaryrefslogtreecommitdiffstats
path: root/tdefilereplace/kaddstringdlg.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-06-20 23:02:54 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-06-20 23:02:54 +0900
commita58ed210742d83bf1ce96194083eb925298b02c5 (patch)
tree41e71ce333b6de55c702ef0f59ae06e0b8e3f958 /tdefilereplace/kaddstringdlg.cpp
parent281f1ab591a1321cfd700f5a8e54da3541498a52 (diff)
downloadtdeutils-a58ed210742d83bf1ce96194083eb925298b02c5.tar.gz
tdeutils-a58ed210742d83bf1ce96194083eb925298b02c5.zip
tdefilereplace: improved logic for string add/edit/remove dialog.
Removed the string edit action which is now no longer required. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdefilereplace/kaddstringdlg.cpp')
-rw-r--r--tdefilereplace/kaddstringdlg.cpp58
1 files changed, 18 insertions, 40 deletions
diff --git a/tdefilereplace/kaddstringdlg.cpp b/tdefilereplace/kaddstringdlg.cpp
index 0e3c5f0..6aa29c6 100644
--- a/tdefilereplace/kaddstringdlg.cpp
+++ b/tdefilereplace/kaddstringdlg.cpp
@@ -37,10 +37,9 @@
using namespace whatthisNameSpace;
-KAddStringDlg::KAddStringDlg(RCOptions* info, bool wantEdit, TQWidget *parent, const char *name) : KAddStringDlgS(parent,name,true)
+KAddStringDlg::KAddStringDlg(RCOptions* info, TQWidget *parent, const char *name) : KAddStringDlgS(parent,name,true)
{
m_option = info;
- m_wantEdit = wantEdit;
m_currentMap = m_option->m_mapStringsView;
initGUI();
@@ -64,53 +63,33 @@ void KAddStringDlg::initGUI()
m_stack->addWidget(m_stringView);
m_stack->addWidget(m_stringView_2);
+ if (m_option->m_searchingOnlyMode)
+ {
+ m_rbSearchOnly->setChecked(true);
+ }
+ else
+ {
+ m_rbSearchReplace->setChecked(true);
+ }
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;
- }
- }
+ loadMapIntoView();
}
void KAddStringDlg::raiseView()
{
- if(m_option->m_searchingOnlyMode)
+ if (m_option->m_searchingOnlyMode)
m_sv = m_stringView_2;
else
m_sv = m_stringView;
@@ -175,38 +154,37 @@ void KAddStringDlg::slotOK()
void KAddStringDlg::slotSearchOnly()
{
m_option->m_searchingOnlyMode = true;
+ m_currentMap.clear();
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();
+
+ m_sv->clear();
}
void KAddStringDlg::slotSearchReplace()
{
m_option->m_searchingOnlyMode = false;
+ m_currentMap.clear();
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();
+ m_sv->clear();
}
void KAddStringDlg::slotAddStringToView()
{
- if(m_option->m_searchingOnlyMode)
+ if (m_option->m_searchingOnlyMode)
{
TQString text = m_edSearch->text();
if(!(text.isEmpty() || columnContains(m_sv, text, 0)))
@@ -223,7 +201,7 @@ void KAddStringDlg::slotAddStringToView()
TQString searchText = m_edSearch->text(),
replaceText = m_edReplace->text();
- if(!(searchText.isEmpty() || replaceText.isEmpty() || columnContains(m_sv,searchText,0) || columnContains(m_sv,replaceText,1)))
+ if (!searchText.isEmpty() && !columnContains(m_sv, searchText, 0))
{
TQListViewItem* lvi = new TQListViewItem(m_sv);
lvi->setMultiLinesEnabled(true);