rename the following methods:

tqfind find
tqreplace replace
tqcontains contains


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knowit@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 185b99383f
commit 99be31af98

@ -362,7 +362,7 @@ bool Knowit::open(const KURL& fname)
} }
prevdepth = depth; prevdepth = depth;
Notes.addNote(current); Notes.addNote(current);
Notes.tqfind(current)->open(ts); Notes.find(current)->open(ts);
if (s.left(13) == "\\CurrentEntry") if (s.left(13) == "\\CurrentEntry")
active = current; active = current;
} }
@ -401,7 +401,7 @@ bool Knowit::save(const KURL& fname)
TQTextStream ts(&file); TQTextStream ts(&file);
ts.setEncoding(TQTextStream::UnicodeUTF8); ts.setEncoding(TQTextStream::UnicodeUTF8);
for (TQListViewItemIterator it(Items); it.current(); it++) for (TQListViewItemIterator it(Items); it.current(); it++)
Notes.tqfind(it.current())->save(ts, it.current() == Items->currentItem()); Notes.find(it.current())->save(ts, it.current() == Items->currentItem());
filename = fname; filename = fname;
setCaption(fname.fileName()); setCaption(fname.fileName());
Notes.modified = false; Notes.modified = false;
@ -472,20 +472,20 @@ bool Knowit::queryExit()
} }
void Knowit::tqfind(TQListViewItem* start) void Knowit::find(TQListViewItem* start)
{ {
if (soughtText.isEmpty() || !Items->firstChild()) return; if (soughtText.isEmpty() || !Items->firstChild()) return;
if (start && lastSought == start && if (start && lastSought == start &&
Edit->tqfind(soughtText, FindDlg.case_sensitive(), false)) Edit->find(soughtText, FindDlg.case_sensitive(), false))
return; return;
if (!start) start = Items->firstChild(); if (!start) start = Items->firstChild();
TQListViewItemIterator it(start); TQListViewItemIterator it(start);
while (it.current()) { while (it.current()) {
TQString s = Notes.text(it.current()); TQString s = Notes.text(it.current());
if (lastSought != it.current() && if (lastSought != it.current() &&
s.tqcontains(soughtText, FindDlg.case_sensitive())) { s.contains(soughtText, FindDlg.case_sensitive())) {
slotNoteChanged(it.current()); slotNoteChanged(it.current());
Edit->tqfind(soughtText, FindDlg.case_sensitive(), false); Edit->find(soughtText, FindDlg.case_sensitive(), false);
lastSought = it.current(); lastSought = it.current();
return; return;
} }
@ -585,7 +585,7 @@ void Knowit::applyOptions(const KnowitOptions& O, bool store)
TNote* Knowit::currentNote() const TNote* Knowit::currentNote() const
{ {
if (!Items->currentItem()) return 0; if (!Items->currentItem()) return 0;
return Notes.tqfind(Items->currentItem()); return Notes.find(Items->currentItem());
} }
@ -708,7 +708,7 @@ void Knowit::slotItemChanged(TQListViewItem* i)
Edit->setText(s); Edit->setText(s);
Edit->setModified(false); Edit->setModified(false);
Links->clear(); Links->clear();
TNote* note = Notes.tqfind(i); TNote* note = Notes.find(i);
if (note) if (note)
for (int j=0; j<note->linkCount(); j++) for (int j=0; j<note->linkCount(); j++)
Links->insertItem(note->link(j).icon(), note->link(j).text(Options.linkFormat)); Links->insertItem(note->link(j).icon(), note->link(j).text(Options.linkFormat));
@ -760,7 +760,7 @@ void Knowit::slotNoteMoveBegin()
Items->takeNode(elt); Items->takeNode(elt);
Items->insertItem(elt); Items->insertItem(elt);
if (tqparent) if (tqparent)
Notes.tqfind(tqparent)->updateView(); Notes.find(tqparent)->updateView();
slotNoteChanged(elt); slotNoteChanged(elt);
Notes.modified = true; Notes.modified = true;
} }
@ -780,7 +780,7 @@ void Knowit::slotNoteMoveEnd()
Items->insertNode(0, elt, last); Items->insertNode(0, elt, last);
slotNoteChanged(elt); slotNoteChanged(elt);
if (tqparent) if (tqparent)
Notes.tqfind(tqparent)->updateView(); Notes.find(tqparent)->updateView();
Notes.modified = true; Notes.modified = true;
} }
} }
@ -792,7 +792,7 @@ void Knowit::slotNoteMoveLeft()
if (elt && tqparent) { if (elt && tqparent) {
Items->takeNode(elt); Items->takeNode(elt);
Items->insertNode(tqparent->tqparent(), elt, tqparent); Items->insertNode(tqparent->tqparent(), elt, tqparent);
Notes.tqfind(tqparent)->updateView(); Notes.find(tqparent)->updateView();
slotNoteChanged(elt); slotNoteChanged(elt);
Notes.modified = true; Notes.modified = true;
} }
@ -815,7 +815,7 @@ void Knowit::slotNoteMoveRight()
Items->takeNode(elt); Items->takeNode(elt);
Items->insertNode(above->tqparent(), elt, above); Items->insertNode(above->tqparent(), elt, above);
} }
Notes.tqfind(above)->updateView(); Notes.find(above)->updateView();
slotNoteChanged(elt); slotNoteChanged(elt);
Notes.modified = true; Notes.modified = true;
} }
@ -879,7 +879,7 @@ void Knowit::slotFileSaveAs()
KURL url=KFileDialog::getSaveURL(TQDir::currentDirPath(), KURL url=KFileDialog::getSaveURL(TQDir::currentDirPath(),
i18n("*.kno|KnowIt files (*.kno)\n*|All files"), this, i18n("Save as...")); i18n("*.kno|KnowIt files (*.kno)\n*|All files"), this, i18n("Save as..."));
if (!url.isEmpty()) { if (!url.isEmpty()) {
if (!url.fileName().tqcontains('.')) if (!url.fileName().contains('.'))
url = KURL(url.path() + ".kno"); url = KURL(url.path() + ".kno");
TQFileInfo fileinfo(url.path()); TQFileInfo fileinfo(url.path());
if (fileinfo.exists() && KMessageBox::questionYesNo(0, if (fileinfo.exists() && KMessageBox::questionYesNo(0,
@ -971,7 +971,7 @@ void Knowit::slotFileExport()
KURL url=KFileDialog::getSaveURL(htmlfile, KURL url=KFileDialog::getSaveURL(htmlfile,
i18n("*.html|HTML files (*.html)\n*|All files"), this, i18n("Export to HTML")); i18n("*.html|HTML files (*.html)\n*|All files"), this, i18n("Export to HTML"));
if (!url.isEmpty()) { if (!url.isEmpty()) {
if (!url.fileName().tqcontains('.')) if (!url.fileName().contains('.'))
url = KURL(url.path() + ".html"); url = KURL(url.path() + ".html");
TQFileInfo fileinfo(url.path()); TQFileInfo fileinfo(url.path());
if (fileinfo.exists() && KMessageBox::questionYesNo(0, if (fileinfo.exists() && KMessageBox::questionYesNo(0,
@ -987,7 +987,7 @@ void Knowit::slotFileExport()
style = TQString("body {font-family: \"%1\"; color: %2; background-color: %3}") style = TQString("body {font-family: \"%1\"; color: %2; background-color: %3}")
.tqarg(Edit->family()).tqarg(Edit->paletteForegroundColor().name()) .tqarg(Edit->family()).tqarg(Edit->paletteForegroundColor().name())
.tqarg(Edit->paletteBackgroundColor().name()); .tqarg(Edit->paletteBackgroundColor().name());
Notes.tqfind(start)->saveHTML(url, origname, style, choice); Notes.find(start)->saveHTML(url, origname, style, choice);
Options.exportFlags = choice; Options.exportFlags = choice;
} }
} }
@ -1079,16 +1079,16 @@ void Knowit::slotEditFind()
if (soughtText != FindDlg.getText()) { if (soughtText != FindDlg.getText()) {
soughtText = FindDlg.getText(); soughtText = FindDlg.getText();
lastSought = 0; lastSought = 0;
tqfind(); find();
} }
else else
tqfind(Items->currentItem()); find(Items->currentItem());
} }
void Knowit::slotEditFindNext() void Knowit::slotEditFindNext()
{ {
if (soughtText.isEmpty()) FindDlg.exec(); if (soughtText.isEmpty()) FindDlg.exec();
tqfind(Items->currentItem()); find(Items->currentItem());
} }
void Knowit::slotEditGoTo() void Knowit::slotEditGoTo()
@ -1097,9 +1097,9 @@ void Knowit::slotEditGoTo()
TQString page = KInputDialog::getText(i18n("Go to"), TQString page = KInputDialog::getText(i18n("Go to"),
i18n("Go to page with given title"), "", &Ok); i18n("Go to page with given title"), "", &Ok);
if (Ok && !page.isEmpty()) { if (Ok && !page.isEmpty()) {
TQListViewItem* item = Items->tqfindItem(page, 0); TQListViewItem* item = Items->findItem(page, 0);
if (!item) item = Items->tqfindItem(page, 0, TQt::ExactMatch); if (!item) item = Items->findItem(page, 0, TQt::ExactMatch);
if (!item) item = Items->tqfindItem(page, 0, TQt::Contains); if (!item) item = Items->findItem(page, 0, TQt::Contains);
slotNoteChanged(item); slotNoteChanged(item);
} }
} }
@ -1292,9 +1292,9 @@ void Knowit::slotLinkOpen()
TNoteLink link = currentNote()->link(Links->currentItem()); TNoteLink link = currentNote()->link(Links->currentItem());
if (link.isLocalReference()) { if (link.isLocalReference()) {
TQString s = link.link.remove(0, 9); TQString s = link.link.remove(0, 9);
TQListViewItem* item = Items->tqfindItem(s, 0); TQListViewItem* item = Items->findItem(s, 0);
if (!item) Items->tqfindItem(s, 0, TQt::BeginsWith); if (!item) Items->findItem(s, 0, TQt::BeginsWith);
if (!item) Items->tqfindItem(s, 0, TQt::Contains); if (!item) Items->findItem(s, 0, TQt::Contains);
slotNoteChanged(item); slotNoteChanged(item);
} }
else else

@ -109,7 +109,7 @@ class Knowit : public KMainWindow
/** Finds and shows next occurence of currently sought text /** Finds and shows next occurence of currently sought text
- or show message that it couldn't be found */ - or show message that it couldn't be found */
void tqfind(TQListViewItem* start = 0); void find(TQListViewItem* start = 0);
/** Returns true if notes or current text were modified */ /** Returns true if notes or current text were modified */
bool modified(); bool modified();
/** Reimplemented from TQWidget to prevent from closing when docked */ /** Reimplemented from TQWidget to prevent from closing when docked */

@ -102,7 +102,7 @@ void TNotesCollection::addNote(TQListViewItem* item)
{ {
insert(item, new TNote(item, this)); insert(item, new TNote(item, this));
TQListViewItem* tqparent = item->tqparent(); TQListViewItem* tqparent = item->tqparent();
if (tqparent) tqfind(tqparent)->updateView(); if (tqparent) find(tqparent)->updateView();
modified = true; modified = true;
} }
@ -110,28 +110,28 @@ void TNotesCollection::addNote(TQListViewItem* item, const TQString& s)
{ {
insert(item, new TNote(item, this, s)); insert(item, new TNote(item, this, s));
TQListViewItem* tqparent = item->tqparent(); TQListViewItem* tqparent = item->tqparent();
if (tqparent) tqfind(tqparent)->updateView(); if (tqparent) find(tqparent)->updateView();
modified = true; modified = true;
} }
void TNotesCollection::removeNote(TQListViewItem* item) void TNotesCollection::removeNote(TQListViewItem* item)
{ {
TNote* note = tqfind(item); TNote* note = find(item);
if (!note) qWarning("Internal error while removing note\n"); if (!note) qWarning("Internal error while removing note\n");
else { else {
TQListViewItem* tqparent = item->tqparent(); TQListViewItem* tqparent = item->tqparent();
for (TQListViewItemIterator it(item); it.current() && for (TQListViewItemIterator it(item); it.current() &&
(it.current() == item || it.current()->depth() > item->depth()); ++it) (it.current() == item || it.current()->depth() > item->depth()); ++it)
tqfind(it.current())->destroy(); find(it.current())->destroy();
delete item; delete item;
if (tqparent) tqfind(tqparent)->updateView(); if (tqparent) find(tqparent)->updateView();
modified = true; modified = true;
} }
} }
bool TNotesCollection::changeNote(TQListViewItem* item, const TQString& s) bool TNotesCollection::changeNote(TQListViewItem* item, const TQString& s)
{ {
TNote* changed = tqfind(item); TNote* changed = find(item);
if (!changed) { if (!changed) {
qWarning("Internal error while changing note\n"); qWarning("Internal error while changing note\n");
return false; return false;
@ -151,7 +151,7 @@ void TNotesCollection::clearNotes()
const TQString& TNotesCollection::text(TQListViewItem* item) const TQString& TNotesCollection::text(TQListViewItem* item)
{ {
TNote* note = tqfind(item); TNote* note = find(item);
if (!note) if (!note)
qFatal("Internal error while accessing note text\n"); qFatal("Internal error while accessing note text\n");
return note->text; return note->text;
@ -187,9 +187,9 @@ bool TNote::isEmpty()
return !text.length(); return !text.length();
} }
bool TNote::tqcontains(const TQString& sought, bool case_sensitive) bool TNote::contains(const TQString& sought, bool case_sensitive)
{ {
return text.tqcontains(sought, case_sensitive); return text.contains(sought, case_sensitive);
} }
@ -279,9 +279,9 @@ bool TNote::saveHTMLBuf(TQTextStream& ts, TQValueVector<int>& depths,
ts << TQString("<h%1 id=\"S%2\">%3%4</h%5>").tqarg(hlevel).tqarg(id).tqarg(number) ts << TQString("<h%1 id=\"S%2\">%3%4</h%5>").tqarg(hlevel).tqarg(id).tqarg(number)
.tqarg(item->text(0)).tqarg(hlevel); .tqarg(item->text(0)).tqarg(hlevel);
TQString htmltext = text; TQString htmltext = text;
int begin = htmltext.tqfind("<body"); int begin = htmltext.find("<body");
if (begin >= 0) begin = htmltext.tqfind(">", begin); if (begin >= 0) begin = htmltext.find(">", begin);
int end = htmltext.tqfind("</body>"); int end = htmltext.find("</body>");
if (begin < 0) begin = 0; if (begin < 0) begin = 0;
if (end <= begin) end = htmltext.length(); if (end <= begin) end = htmltext.length();
ts << htmltext.mid(begin+1, end-begin-1); ts << htmltext.mid(begin+1, end-begin-1);
@ -299,10 +299,10 @@ bool TNote::saveHTMLBuf(TQTextStream& ts, TQValueVector<int>& depths,
/* save tqchildren */ /* save tqchildren */
if ((SaveSubnotes | SaveAll) & flags && item->childCount()) { if ((SaveSubnotes | SaveAll) & flags && item->childCount()) {
depths.append(0); depths.append(0);
collection->tqfind(item->firstChild())->saveHTMLBuf(ts, depths, flags); collection->find(item->firstChild())->saveHTMLBuf(ts, depths, flags);
} }
if ((SaveSubnotes | SaveAll) & flags && item->nextSibling()) if ((SaveSubnotes | SaveAll) & flags && item->nextSibling())
collection->tqfind(item->nextSibling())->saveHTMLBuf(ts, depths, flags); collection->find(item->nextSibling())->saveHTMLBuf(ts, depths, flags);
if (!item->nextSibling()) depths.pop_back(); if (!item->nextSibling()) depths.pop_back();
return true; return true;
@ -329,10 +329,10 @@ bool TNote::saveHTMLTocEntry(TQTextStream& ts, TQValueVector<int>& depths, int f
arg(item->text(0)); arg(item->text(0));
if ((SaveSubnotes | SaveAll) & flags && item->childCount()) { if ((SaveSubnotes | SaveAll) & flags && item->childCount()) {
depths.append(0); depths.append(0);
collection->tqfind(item->firstChild())->saveHTMLTocEntry(ts, depths, flags); collection->find(item->firstChild())->saveHTMLTocEntry(ts, depths, flags);
} }
if ((SaveSubnotes | SaveAll) & flags && item->nextSibling()) if ((SaveSubnotes | SaveAll) & flags && item->nextSibling())
collection->tqfind(item->nextSibling())->saveHTMLTocEntry(ts, depths, flags); collection->find(item->nextSibling())->saveHTMLTocEntry(ts, depths, flags);
if (!item->nextSibling()) { if (!item->nextSibling()) {
depths.pop_back(); depths.pop_back();
ts << space; ts << space;

@ -81,7 +81,7 @@ public:
TQListViewItem* item; TQListViewItem* item;
TQString text; TQString text;
bool isEmpty(); bool isEmpty();
bool tqcontains(const TQString& sought, bool case_sensitive = false); bool contains(const TQString& sought, bool case_sensitive = false);
bool change(const TQString& s); bool change(const TQString& s);
void destroy(); void destroy();
void updateView(); void updateView();

Loading…
Cancel
Save