aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Noldor2010-03-24 12:57:49 +0000
committerGravatar Noldor2010-03-24 12:57:49 +0000
commit0223626eb9410ab3490b3f80985599b71d665c8d (patch)
treef4b081b65a9fb47203fdd5629c535a5ecb893cc7 /src
parentMore worl on classeditor (diff)
downloadKVIrc-0223626eb9410ab3490b3f80985599b71d665c8d.tar.gz
KVIrc-0223626eb9410ab3490b3f80985599b71d665c8d.tar.bz2
KVIrc-0223626eb9410ab3490b3f80985599b71d665c8d.zip
More work on classeditor
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4211 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/modules/classeditor/classeditor.cpp68
-rw-r--r--src/modules/classeditor/classeditor.h5
2 files changed, 42 insertions, 31 deletions
diff --git a/src/modules/classeditor/classeditor.cpp b/src/modules/classeditor/classeditor.cpp
index 31d7849a7..284682413 100644
--- a/src/modules/classeditor/classeditor.cpp
+++ b/src/modules/classeditor/classeditor.cpp
@@ -826,46 +826,54 @@ void KviClassEditor::recursiveSearchReplace(const QString &szSearch,KviClassEdit
}
}
-
+*/
+void KviClassEditor::searchReplace(const QString &szSearch,bool bReplace,const QString &szReplace)
+{
+ KviPointerHashTableIterator<QString,KviClassEditorTreeWidgetItem> it (*m_pClasses);
+ while(it.current())
+ {
+ KviClassEditorTreeWidgetItem *pItem=it.current();
+ for(int j=0;j<pItem->childCount();j++)
+ {
+ if(((KviClassEditorTreeWidgetItem *)pItem->child(j))->buffer().indexOf(szSearch,0,Qt::CaseInsensitive) != -1)
+ {
+ pItem->child(j)->setBackground(0, QColor(255,0,0,128));
+ if (bReplace){
+ QString &buffer=(QString &)((KviClassEditorTreeWidgetItem *)pItem->child(j))->buffer();
+ buffer.replace(szSearch,szReplace,Qt::CaseInsensitive);
+ }
+ openParentItems(pItem);
+ } else {
+ pItem->child(j)->setBackground(0, QColor(255,255,255));
+ }
+ }
+ ++it;
+ }
+}
void KviClassEditor::slotFind()
{
- g_pClassEditorModule->lock();
- bool bOk;
-
- QString szSearch = QInputDialog::getText(this,
- __tr2qs_ctx("Find In Classes","editor"),
- __tr2qs_ctx("Please enter the text to be searched for. The matching classes will be highlighted.","editor"),
- QLineEdit::Normal,
- "",
- &bOk);
+ g_pClassEditorModule->lock();
+ bool bOk;
+ QString szSearch = QInputDialog::getText(this,
+ __tr2qs_ctx("Find In Classes","editor"),
+ __tr2qs_ctx("Please enter the text to be searched for. The matching function will be highlighted.","editor"),
+ QLineEdit::Normal,
+ "",
+ &bOk);
- g_pClassEditorModule->unlock();
- if(!bOk)return;
- if(szSearch.isEmpty())return;
- m_pEditor->setFindText(szSearch);
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- if(((KviClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->isClass())
- {
- if(((KviClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->buffer().indexOf(szSearch,0,Qt::CaseInsensitive) != -1)
- {
- m_pTreeWidget->topLevelItem(i)->setIcon(0,QIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIASHIGHLIGHTED))));
- } else {
- m_pTreeWidget->topLevelItem(i)->setIcon(0,QIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS))));
- }
- } else {
- recursiveSearchReplace(szSearch,(KviClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i));
- }
- }
+ g_pClassEditorModule->unlock();
+ if(!bOk)return;
+ if(szSearch.isEmpty())return;
+ m_pEditor->setFindText(szSearch);
+ searchReplace(szSearch);
}
-
void KviClassEditor::slotFindWord(const QString &szSearch)
{
m_pEditor->setFindText(szSearch);
}
-
+/*
void KviClassEditor::recursiveCollapseNamespaces(KviClassEditorTreeWidgetItem * it)
{
if(!it)return;
diff --git a/src/modules/classeditor/classeditor.h b/src/modules/classeditor/classeditor.h
index db217723c..579d116bf 100644
--- a/src/modules/classeditor/classeditor.h
+++ b/src/modules/classeditor/classeditor.h
@@ -162,6 +162,9 @@ protected slots:
void exportAll();
void exportSelectedSepFiles();
void exportSelected();
+ void slotFind();
+ void slotFindWord(const QString &);
+ void searchReplace(const QString &szSearch,bool bReplace=false,const QString &szReplace="n");
/*
@@ -169,7 +172,7 @@ protected slots:
void slotFind();
void slotCollapseNamespaces();
- void slotFindWord(const QString &);
+
void slotReplaceAll(const QString &before,const QString &after);
void classRefresh(const QString &szName);
*/