summaryrefslogtreecommitdiffstats
path: root/tdefilereplace/kaddstringdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdefilereplace/kaddstringdlg.cpp')
-rw-r--r--tdefilereplace/kaddstringdlg.cpp72
1 files changed, 25 insertions, 47 deletions
diff --git a/tdefilereplace/kaddstringdlg.cpp b/tdefilereplace/kaddstringdlg.cpp
index 0e3c5f0..70f4f4e 100644
--- a/tdefilereplace/kaddstringdlg.cpp
+++ b/tdefilereplace/kaddstringdlg.cpp
@@ -2,7 +2,7 @@
KAddStringDlg.cpp - description
-------------------
begin : Sat Oct 16 1999
- copyright : (C) 1999 by Fran�ois Dupoux
+ copyright : (C) 1999 by François Dupoux
(C) 2004 Emiliano Gulmini <emi_barbarossa@yahoo.it>
email : dupoux@dupoux.com
***************************************************************************/
@@ -37,20 +37,19 @@
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();
- 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()));
+ connect(m_pbOK, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotOK()));
+ connect(m_rbSearchOnly, TQ_SIGNAL(pressed()), this, TQ_SLOT(slotSearchOnly()));
+ connect(m_rbSearchReplace, TQ_SIGNAL(pressed()), this, TQ_SLOT(slotSearchReplace()));
+ connect(m_pbAdd, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotAddStringToView()));
+ connect(m_pbDel, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotDeleteStringFromView()));
+ connect(m_pbHelp, TQ_SIGNAL(clicked()), this ,TQ_SLOT(slotHelp()));
whatsThis();
}
@@ -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);