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 13 years ago
parent 185b99383f
commit 99be31af98

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

@ -109,7 +109,7 @@ class Knowit : public KMainWindow
/** Finds and shows next occurence of currently sought text
- 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 */
bool modified();
/** Reimplemented from TQWidget to prevent from closing when docked */

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

@ -81,7 +81,7 @@ public:
TQListViewItem* item;
TQString text;
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);
void destroy();
void updateView();

Loading…
Cancel
Save