rename the following methods:

tqfind find
tqreplace replace
tqcontains contains


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 14284db4df
commit 33f08e9313

@ -49,7 +49,7 @@ bool BasketThumbCreator::create(const TQString &path, int /*width*/, int /*heigh
while (!stream.atEnd()) {
// Get Key/Value Pair From the Line to Read:
line = stream.readLine();
int index = line.tqfind(':');
int index = line.find(':');
TQString key;
TQString value;
if (index >= 0) {

@ -102,7 +102,7 @@ void Archive::save(Basket *basket, bool withSubBaskets, const TQString &destinat
TQPixmap icon = kapp->iconLoader()->loadIcon(state->emblem(), KIcon::Small, 16, KIcon::DefaultState, /*path_store=*/0L, /*canReturnNull=*/true);
if (!icon.isNull()) {
icon.save(tempIconFile, "PNG");
TQString iconFileName = state->emblem().tqreplace('/', '_');
TQString iconFileName = state->emblem().replace('/', '_');
tar.addLocalFile(tempIconFile, "tag-emblems/" + iconFileName);
}
}
@ -196,13 +196,13 @@ void Archive::saveBasketToArchive(Basket *basket, bool recursive, KTar *tar, TQS
TQPixmap icon = kapp->iconLoader()->loadIcon(basket->icon(), KIcon::Small, 16, KIcon::DefaultState, /*path_store=*/0L, /*canReturnNull=*/true);
if (!icon.isNull()) {
icon.save(tempIconFile, "PNG");
TQString iconFileName = basket->icon().tqreplace('/', '_');
TQString iconFileName = basket->icon().replace('/', '_');
tar->addLocalFile(tempIconFile, "basket-icons/" + iconFileName);
}
}
// Save basket backgorund image:
TQString imageName = basket->backgroundImageName();
if (!basket->backgroundImageName().isEmpty() && !backgrounds.tqcontains(imageName)) {
if (!basket->backgroundImageName().isEmpty() && !backgrounds.contains(imageName)) {
TQString backgroundPath = Global::backgroundManager->pathForImageName(imageName);
if (!backgroundPath.isEmpty()) {
// Save the background image:
@ -267,7 +267,7 @@ void Archive::open(const TQString &path)
while (!stream.atEnd()) {
// Get Key/Value Pair From the Line to Read:
line = stream.readLine();
int index = line.tqfind(':');
int index = line.find(':');
TQString key;
TQString value;
if (index >= 0) {
@ -306,7 +306,7 @@ void Archive::open(const TQString &path)
delete buffer;
// }
} else if (key == "archive*") {
if (version != "0.6.1" && readCompatibleVersions.tqcontains("0.6.1") && !writeCompatibleVersions.tqcontains("0.6.1")) {
if (version != "0.6.1" && readCompatibleVersions.contains("0.6.1") && !writeCompatibleVersions.contains("0.6.1")) {
KMessageBox::information(
0,
i18n("This file was created with a recent version of %1. "
@ -317,7 +317,7 @@ void Archive::open(const TQString &path)
i18n("Basket Archive Error")
);
}
if (version != "0.6.1" && !readCompatibleVersions.tqcontains("0.6.1") && !writeCompatibleVersions.tqcontains("0.6.1")) {
if (version != "0.6.1" && !readCompatibleVersions.contains("0.6.1") && !writeCompatibleVersions.contains("0.6.1")) {
KMessageBox::error(
0,
i18n("This file was created with a recent version of %1. Please upgrade to a newer version to be able to open that file.")
@ -437,9 +437,9 @@ void Archive::importTagEmblems(const TQString &extractionFolder)
if (emblem.isNull()) {
// Of the emblem path was eg. "/home/seb/emblem.png", it was exported as "tag-emblems/_home_seb_emblem.png".
// So we need to copy that image to "~/.kde/share/apps/basket/tag-emblems/emblem.png":
int slashIndex = emblemName.tqfindRev("/");
int slashIndex = emblemName.findRev("/");
TQString emblemFileName = (slashIndex < 0 ? emblemName : emblemName.right(slashIndex - 2));
TQString source = extractionFolder + "tag-emblems/" + emblemName.tqreplace('/', '_');
TQString source = extractionFolder + "tag-emblems/" + emblemName.replace('/', '_');
TQString destination = Global::savesFolder() + "tag-emblems/" + emblemFileName;
if (!dir.exists(destination))
copier.copyFolder(source, destination);
@ -555,9 +555,9 @@ void Archive::importBasketIcon(TQDomElement properties, const TQString &extracti
FormatImporter copier; // Only used to copy files synchronously
// Of the icon path was eg. "/home/seb/icon.png", it was exported as "basket-icons/_home_seb_icon.png".
// So we need to copy that image to "~/.kde/share/apps/basket/basket-icons/icon.png":
int slashIndex = iconName.tqfindRev("/");
int slashIndex = iconName.findRev("/");
TQString iconFileName = (slashIndex < 0 ? iconName : iconName.right(slashIndex - 2));
TQString source = extractionFolder + "basket-icons/" + iconName.tqreplace('/', '_');
TQString source = extractionFolder + "basket-icons/" + iconName.replace('/', '_');
TQString destination = Global::savesFolder() + "basket-icons/" + iconFileName;
if (!dir.exists(destination))
copier.copyFolder(source, destination);
@ -584,7 +584,7 @@ void Archive::renameMergedStates(TQDomNode notes, TQMap<TQString, TQString> &mer
TQStringList tagNames = TQStringList::split(";", tags);
for (TQStringList::Iterator it = tagNames.begin(); it != tagNames.end(); ++it) {
TQString &tag = *it;
if (mergedStates.tqcontains(tag)) {
if (mergedStates.contains(tag)) {
tag = mergedStates[tag];
}
}

@ -400,7 +400,7 @@ void RestoreThread::run()
tar.open(IO_ReadOnly);
if (tar.isOpened()) {
const KArchiveDirectory *directory = tar.directory();
if (directory->entries().tqcontains(backupMagicFolder)) {
if (directory->entries().contains(backupMagicFolder)) {
const KArchiveEntry *entry = directory->entry(backupMagicFolder);
if (entry->isDirectory()) {
((const KArchiveDirectory*) entry)->copyTo(m_destFolder);

@ -179,7 +179,7 @@ TQValueList<Note*> NoteSelection::parentGroups()
// For each tqparent groups of the note:
for (Note *note = node->note->parentNote(); note; note = note->parentNote())
// Add it (if it was not already in the list):
if (!note->isColumn() && !groups.tqcontains(note))
if (!note->isColumn() && !groups.contains(note))
groups.append(note);
return groups;
@ -1505,7 +1505,7 @@ void Basket::contentsMousePressEvent(TQMouseEvent *event)
if (zone == Note::Handle || zone == Note::Group || (zone == Note::GroupExpander && (controlPressed || shiftPressed))) {
Note *end = clicked;
if (clicked->isGroup() && shiftPressed) {
if (clicked->tqcontains(m_startOfShiftSelectionNote)) {
if (clicked->contains(m_startOfShiftSelectionNote)) {
m_startOfShiftSelectionNote = clicked->firstRealChild();
end = clicked->lastRealChild();
} else if (clicked->firstRealChild()->isAfter(m_startOfShiftSelectionNote))
@ -1904,7 +1904,7 @@ void Basket::contentsDragMoveEvent(TQDragMoveEvent *event)
}
/* Note *hoveredNote = noteAt(event->pos().x(), event->pos().y());
if ( (isColumnsLayout() && !hoveredNote) || (draggedNotes().tqcontains(hoveredNote)) ) {
if ( (isColumnsLayout() && !hoveredNote) || (draggedNotes().contains(hoveredNote)) ) {
event->acceptAction(false);
event->accept(false);
} else
@ -2683,7 +2683,7 @@ void Basket::doHoverEffects(const TQPoint &pos)
// Ending the drag INSIDE the basket area will make NO hoverEffects() because m_underMouse is false.
// User need to leave the area and re-enter it to get effects.
// This hack solve that by dismissing the m_underMouse variable:
bool underMouse = Global::bnpView->currentBasket() == this && TQRect(contentsX(), contentsY(), visibleWidth(), visibleHeight()).tqcontains(pos);
bool underMouse = Global::bnpView->currentBasket() == this && TQRect(contentsX(), contentsY(), visibleWidth(), visibleHeight()).contains(pos);
// Don't do hover effects when a popup menu is opened.
// Primarily because the basket area will only receive mouseEnterEvent and mouveLeaveEvent.
@ -2807,7 +2807,7 @@ void Basket::maybeTip(const TQPoint &pos)
TQRect itRect;
for (TQValueList<TQRect>::iterator it = m_blankAreas.begin(); it != m_blankAreas.end(); ++it) {
itRect = TQRect(0, 0, visibleWidth(), visibleHeight()).intersect(*it);
if (itRect.tqcontains(contentPos)) {
if (itRect.contains(contentPos)) {
rect = itRect;
rect.moveLeft(rect.left() - contentsX());
rect.moveTop( rect.top() - contentsY());
@ -2949,7 +2949,7 @@ Note* Basket::noteAt(int x, int y)
while (note) {
possibleNote = note->noteAt(x, y);
if (possibleNote) {
if (draggedNotes().tqcontains(possibleNote))
if (draggedNotes().contains(possibleNote))
return 0;
else
return possibleNote;
@ -5130,7 +5130,7 @@ void Basket::removeWatchedFile(const TQString &fullPath)
void Basket::watchedFileModified(const TQString &fullPath)
{
if (!m_modifiedFiles.tqcontains(fullPath))
if (!m_modifiedFiles.contains(fullPath))
m_modifiedFiles.append(fullPath);
// If a big file is saved by an application, notifications are send several times.
// We wait they are not sent anymore to considere the file complete!
@ -5594,7 +5594,7 @@ void Basket::computeInsertPlace(const TQPoint &cursorPosition)
// Code for rectangular notes :
/*TQRect globalRect = it->rect();
globalRect.moveTopLeft(it->pos() + contentsY());
if ( globalRect.tqcontains(curPos) ) {
if ( globalRect.contains(curPos) ) {
it->doInterestingThing();
}*/
}

@ -105,7 +105,7 @@ TQString BasketListViewItem::escapedName(const TQString &string)
{
// Underlining the Alt+Letter shortcut (and escape all other '&' characters), if any:
TQString basketName = string;
basketName.tqreplace('&', "&&"); // First escape all the amperstamp
basketName.replace('&', "&&"); // First escape all the amperstamp
TQString letter; // Find the letter
TQString altKey = /*i18n(*/"Alt"/*)*/; //i18n("The [Alt] key, as shown in shortcuts like Alt+C...", "Alt");
TQString shiftKey = /*i18n(*/"Shift"/*)*/; //i18n("The [Shift] key, as shown in shortcuts like Alt+Shift+1...", "Shift");
@ -116,7 +116,7 @@ TQString BasketListViewItem::escapedName(const TQString &string)
if (letter.isEmpty() && altShiftLetterExp.search(m_basket->shortcut().toStringInternal()) != -1)
letter = altShiftLetterExp.cap(1);
if (!letter.isEmpty()) {
int index = basketName.tqfind(letter, /*index=*/0, /*caseSensitive=*/false);
int index = basketName.find(letter, /*index=*/0, /*caseSensitive=*/false);
if (index != -1)
basketName.insert(index, '&');
}
@ -261,7 +261,7 @@ TQPixmap BasketListViewItem::circledTextPixmap(const TQString &text, int height,
{
TQString key = TQString("BLI-%1.%2.%3.%4")
.tqarg(text).tqarg(height).tqarg(font.toString()).tqarg(color.rgb());
if (TQPixmap* cached=TQPixmapCache::tqfind(key)) {
if (TQPixmap* cached=TQPixmapCache::find(key)) {
return *cached;
}
@ -467,7 +467,7 @@ void BasketListViewItem::paintCell(TQPainter *painter, const TQColorGroup &/*tqc
.tqarg(m_isUnderDrag)
.tqarg(m_basket->basketName())
.tqarg(m_basket->icon());
if (TQPixmap* cached = TQPixmapCache::tqfind(key)) {
if (TQPixmap* cached = TQPixmapCache::find(key)) {
// TQt's documentation recommends copying the pointer
// into a TQPixmap immediately
TQPixmap cachedBuffer = *cached;
@ -580,7 +580,7 @@ void BasketListViewItem::paintCell(TQPainter *painter, const TQColorGroup &/*tqc
effectiveWidth += countPixmap.width() + MARGIN;
}
if (showLoadingIcon) {
TQPixmap icon = kapp->iconLoader()->loadIcon("tqfind", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false);
TQPixmap icon = kapp->iconLoader()->loadIcon("find", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false);
thePainter.drawPixmap(effectiveWidth, 0, icon);
effectiveWidth += BASKET_ICON_SIZE + MARGIN;
}

@ -145,12 +145,12 @@ void BasketStatusBar::setLocktqStatus(bool isLocked)
if (isLocked) {
m_locktqStatus->setPixmap(SmallIcon("encrypted.png"));
TQToolTip::add(m_locktqStatus, i18n(
"<p>This basket is <b>locked</b>.<br>Click to unlock it.</p>").tqreplace(" ", "&nbsp;") );
"<p>This basket is <b>locked</b>.<br>Click to unlock it.</p>").replace(" ", "&nbsp;") );
// TQToolTip::add(m_locktqStatus, i18n("This basket is locked.\nClick to unlock it."));
} else {
m_locktqStatus->clear();
TQToolTip::add(m_locktqStatus, i18n(
"<p>This basket is <b>unlocked</b>.<br>Click to lock it.</p>").tqreplace(" ", "&nbsp;") );
"<p>This basket is <b>unlocked</b>.<br>Click to lock it.</p>").replace(" ", "&nbsp;") );
// TQToolTip::add(m_locktqStatus, i18n("This basket is unlocked.\nClick to lock it."));
}
}

@ -597,7 +597,7 @@ void BNPView::setupActions()
actionCollection(), "edit_filter" );
connect( m_actShowFilter, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(showHideFilterBar(bool)) );
m_actFilterAllBaskets = new KToggleAction( i18n("Filter all &Baskets"), "tqfind", "Ctrl+Shift+F",
m_actFilterAllBaskets = new KToggleAction( i18n("Filter all &Baskets"), "find", "Ctrl+Shift+F",
actionCollection(), "edit_filter_all_baskets" );
connect( m_actFilterAllBaskets, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(toggleFilterAllBaskets(bool)) );
@ -1796,7 +1796,7 @@ void BNPView::saveAsArchive()
KConfig *config = KGlobal::config();
config->setGroup("Basket Archive");
TQString folder = config->readEntry("lastFolder", TQDir::homeDirPath()) + "/";
TQString url = folder + TQString(basket->basketName()).tqreplace("/", "_") + ".baskets";
TQString url = folder + TQString(basket->basketName()).replace("/", "_") + ".baskets";
TQString filter = "*.baskets|" + i18n("Basket Archives") + "\n*|" + i18n("All Files");
TQString destination = url;

@ -144,21 +144,21 @@
/// clean up
bt.remove( "(no debugging symbols found)..." );
bt.remove( "(no debugging symbols found)\n" );
bt.tqreplace( TQRegExp("\n{2,}"), "\n" ); //clean up multiple \n characters
bt.replace( TQRegExp("\n{2,}"), "\n" ); //clean up multiple \n characters
bt.stripWhiteSpace();
/// analyze usefulness
bool useful = true;
const TQString fileCommandOutput = runCommand( "file `which basket`" );
if( fileCommandOutput.tqfind( "not stripped", false ) == -1 )
if( fileCommandOutput.find( "not stripped", false ) == -1 )
subject += "[___stripped]"; //same length as below
else
subject += "[NOTstripped]";
if( !bt.isEmpty() ) {
const int invalidFrames = bt.tqcontains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in \\?\\?") );
const int validFrames = bt.tqcontains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in [^?]") );
const int invalidFrames = bt.contains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in \\?\\?") );
const int validFrames = bt.contains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in [^?]") );
const int totalFrames = invalidFrames + validFrames;
if( totalFrames > 0 ) {
@ -168,7 +168,7 @@
}
subject += TQString("[frames: %1]").tqarg( totalFrames, 3 /*padding*/ );
if( bt.tqfind( TQRegExp(" at \\w*\\.cpp:\\d+\n") ) >= 0 )
if( bt.find( TQRegExp(" at \\w*\\.cpp:\\d+\n") ) >= 0 )
subject += "[line numbers]";
}
else

@ -82,7 +82,7 @@ void ExporterDialog::show()
KDialogBase::show();
TQString lineEditText = m_url->lineEdit()->text();
int selectionStart = lineEditText.tqfindRev("/") + 1;
int selectionStart = lineEditText.findRev("/") + 1;
m_url->lineEdit()->setSelection(selectionStart, lineEditText.length() - selectionStart - TQString(".html").length());
}
@ -92,7 +92,7 @@ void ExporterDialog::load()
config->setGroup("HTML Export");
TQString folder = config->readEntry("lastFolder", TQDir::homeDirPath()) + "/";
TQString url = folder + TQString(m_basket->basketName()).tqreplace("/", "_") + ".html";
TQString url = folder + TQString(m_basket->basketName()).replace("/", "_") + ".html";
m_url->setURL(url);
m_embedLinkedFiles->setChecked( config->readBoolEntry("embedLinkedFiles", true) );

@ -52,7 +52,7 @@ FilterBar::FilterBar(TQWidget *tqparent, const char *name)
// Create every widgets:
TQIconSet resetIconSet = kapp->iconLoader()->loadIconSet("locationbar_erase", KIcon::Toolbar);
TQIconSet inAllIconSet = kapp->iconLoader()->loadIconSet("tqfind", KIcon::Toolbar);
TQIconSet inAllIconSet = kapp->iconLoader()->loadIconSet("find", KIcon::Toolbar);
m_resetButton = new TQToolButton(this);
@ -282,13 +282,13 @@ void FilterBar::tagChanged(int index)
break;
default:
// Try to find if we are filtering a tag:
TQMapIterator<int, Tag*> it = m_tagsMap.tqfind(index);
TQMapIterator<int, Tag*> it = m_tagsMap.find(index);
if (it != m_tagsMap.end()) {
m_data->tagFilterType = FilterData::TagFilter;
m_data->tag = *it;
} else {
// If not, try to find if we are filtering a state:
TQMapIterator<int, State*> it2 = m_statesMap.tqfind(index);
TQMapIterator<int, State*> it2 = m_statesMap.find(index);
if (it2 != m_statesMap.end()) {
m_data->tagFilterType = FilterData::StateFilter;
m_data->state = *it2;

@ -114,7 +114,7 @@ void FocusedTextEdit::adaptClipboardText(TQClipboard::Mode mode)
if ( (textFormat() == TQt::RichText) && (!clipboard->data(mode)->provides("application/x-qrichtext")) ) {
TQString text = clipboard->text(mode);
if (text) {
text = text.tqreplace("\n", TQChar(0x2028));
text = text.replace("\n", TQChar(0x2028));
clipboard->setText(text, mode);
}
}

@ -114,8 +114,8 @@ void FormatImporter::importBaskets()
if (list.count() > 2) // Pass "." and ".."
for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) // For each folder
if (*it != "." && *it != ".." && dir.exists(Global::savesFolder() + *it + "/.basket")) // If it can be a basket folder
if ( baskets.tqfind((*it) + "/") == baskets.end() &&
baskets.tqfind(*it) == baskets.end() ) // And if it is not already in the imported baskets list
if ( baskets.find((*it) + "/") == baskets.end() &&
baskets.find(*it) == baskets.end() ) // And if it is not already in the imported baskets list
baskets.append(*it);
std::cout << "Import Baskets: Found " << baskets.count() << " baskets to import." << std::endl;
@ -137,7 +137,7 @@ void FormatImporter::importBaskets()
TQString newFolderName = folderName;
if (newFolderName.endsWith("/"))
newFolderName = newFolderName.left(newFolderName.length() - 1);
newFolderName = newFolderName.mid(newFolderName.tqfindRev('/') + 1);
newFolderName = newFolderName.mid(newFolderName.findRev('/') + 1);
newFolderName = Tools::fileNameForNewFile(newFolderName, Global::basketsFolder());
FormatImporter f;
f.copyFolder(folderName, Global::basketsFolder() + newFolderName);

@ -47,7 +47,7 @@ HTMLExporter::HTMLExporter(Basket *basket)
KConfig *config = KGlobal::config();
config->setGroup("Export to HTML");
TQString folder = config->readEntry("lastFolder", TQDir::homeDirPath()) + "/";
TQString url = folder + TQString(basket->basketName()).tqreplace("/", "_") + ".html";
TQString url = folder + TQString(basket->basketName()).replace("/", "_") + ".html";
// Ask a file name & path to the user:
TQString filter = "*.html *.htm|" + i18n("HTML Documents") + "\n*|" + i18n("All Files");
@ -525,8 +525,8 @@ TQString HTMLExporter::copyIcon(const TQString &iconName, int size)
return "";
// Sometimes icon can be "favicons/www.kde.org", we replace the '/' with a '_'
TQString fileName = iconName; // TQString::tqreplace() isn't const, so I must copy the string before
fileName = "ico" + TQString::number(size) + "_" + fileName.tqreplace("/", "_") + ".png";
TQString fileName = iconName; // TQString::replace() isn't const, so I must copy the string before
fileName = "ico" + TQString::number(size) + "_" + fileName.replace("/", "_") + ".png";
TQString fullPath = iconsFolderPath + fileName;
if (!TQFile::exists(fullPath))
DesktopIcon(iconName, size).save(fullPath, "PNG");

@ -685,7 +685,7 @@ bool KColorCombo2::eventFilter(TQObject */*object*/, TQEvent *event)
case TQEvent::MouseButtonDblClick:
case TQEvent::MouseButtonPress:
mouseEvent = (TQMouseEvent*)event;
if ( !TQT_TQRECT_OBJECT(m_popup->rect()).tqcontains(mouseEvent->pos()) ) {
if ( !TQT_TQRECT_OBJECT(m_popup->rect()).contains(mouseEvent->pos()) ) {
TQPoint globalPos = m_popup->mapToGlobal(mouseEvent->pos());
if (TQApplication::widgetAt(globalPos, /*child=*/true) == this) {
// The popup is being closed by a click on the KColorCombo2 widget.

@ -155,18 +155,18 @@ TQString KGpgMe::checkForUtf8(TQString txt)
for(s = txt.ascii(); *s && !(*s & 0x80); s++)
;
if (*s && !strchr (txt.ascii(), 0xc3) && (txt.tqfind("\\x")==-1))
if (*s && !strchr (txt.ascii(), 0xc3) && (txt.find("\\x")==-1))
return txt;
// The string is not in UTF-8
//if (strchr (txt.ascii(), 0xc3)) return (txt+" +++");
if (txt.tqfind("\\x")==-1)
if (txt.find("\\x")==-1)
return TQString::fromUtf8(txt.ascii());
// if (!strchr (txt.ascii(), 0xc3) || (txt.tqfind("\\x")!=-1)) {
for(int idx = 0 ; (idx = txt.tqfind( "\\x", idx )) >= 0 ; ++idx) {
// if (!strchr (txt.ascii(), 0xc3) || (txt.find("\\x")!=-1)) {
for(int idx = 0 ; (idx = txt.find( "\\x", idx )) >= 0 ; ++idx) {
char str[2] = "x";
str[0] = (char)TQString(txt.mid(idx + 2, 2)).toShort(0, 16);
txt.tqreplace(idx, 4, str);
txt.replace(idx, 4, str);
}
if (!strchr (txt.ascii(), 0xc3))
return TQString::fromUtf8(txt.ascii());
@ -361,7 +361,7 @@ bool KGpgMe::isGnuPGAgentAvailable()
{
TQString agent_info = getenv("GPG_AGENT_INFO");
if (agent_info.tqfind(':') > 0)
if (agent_info.find(':') > 0)
return true;
return false;
}
@ -375,7 +375,7 @@ void KGpgMe::setPassphraseCb()
if(m_useGnuPGAgent)
{
if (agent_info.tqfind(':'))
if (agent_info.find(':'))
agent = true;
if(agent_info.startsWith("disable:"))
setenv("GPG_AGENT_INFO", agent_info.mid(8), 1);

@ -323,7 +323,7 @@ void KIconDialog::slotOk()
TQString key = !d->custom.isEmpty() ? d->custom : d->ui->iconCanvas->getCurrent();
// Append to list of recent icons
if (!d->recentList.tqcontains(key))
if (!d->recentList.contains(key))
{
d->recentList.push_back(key);

@ -568,11 +568,11 @@ void LikeBack::askEmailAddress()
// FIXME: Should be moved to KAboutData? Cigogne will also need it.
bool LikeBack::isDevelopmentVersion(const TQString &version)
{
return version.tqfind("alpha", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.tqfind("beta", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.tqfind("rc", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.tqfind("svn", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.tqfind("cvs", /*index=*/0, /*caseSensitive=*/false) != -1;
return version.find("alpha", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.find("beta", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.find("rc", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.find("svn", /*index=*/0, /*caseSensitive=*/false) != -1 ||
version.find("cvs", /*index=*/0, /*caseSensitive=*/false) != -1;
}
/**

@ -445,7 +445,7 @@ bool Note::isAfter(Note *note)
return true;
}
bool Note::tqcontains(Note *note)
bool Note::contains(Note *note)
{
// if (this == note)
// return true;
@ -457,7 +457,7 @@ bool Note::tqcontains(Note *note)
note = note->parentNote();
// FOR_EACH_CHILD (child)
// if (child->tqcontains(note))
// if (child->contains(note))
// return true;
return false;
}
@ -959,7 +959,7 @@ void Note::toggleFolded(bool animate)
{
// Close the editor if it was editing a note that we are about to hide after collapsing:
if (!m_isFolded && basket() && basket()->isDuringEdit()) {
if (tqcontains(basket()->editedNote()) && firstRealChild() != basket()->editedNote())
if (contains(basket()->editedNote()) && firstRealChild() != basket()->editedNote())
basket()->closeEditor();
}
@ -1031,7 +1031,7 @@ Note* Note::noteAt(int x, int y)
recomputeAreas();
for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) {
TQRect &rect = *it;
if (rect.tqcontains(x, y))
if (rect.contains(x, y))
return this;
}
}
@ -1043,7 +1043,7 @@ Note* Note::noteAt(int x, int y)
recomputeAreas();
for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) {
TQRect &rect = *it;
if (rect.tqcontains(x, y))
if (rect.contains(x, y))
return this;
}
return NULL;
@ -1065,7 +1065,7 @@ Note* Note::noteAt(int x, int y)
recomputeAreas();
for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) {
TQRect &rect = *it;
if (rect.tqcontains(x, y))
if (rect.contains(x, y))
return this;
}
return NULL;
@ -1667,7 +1667,7 @@ void substractRectOnAreas(const TQRect &rectToSubstract, TQValueList<TQRect> &ar
rect.setRight(rectToSubstract.right());
}
// Remove the rectangle if it's entirely contained:
if (andRemove && rectToSubstract.tqcontains(rect))
if (andRemove && rectToSubstract.contains(rect))
it = areas.remove(it);
else
++it;
@ -2181,7 +2181,7 @@ bool Note::removedStates(const TQValueList<State*> &deletedStates)
void Note::addTag(Tag *tag)
{
addState(tag->states().first(), /*but do not tqreplace:*/false);
addState(tag->states().first(), /*but do not replace:*/false);
}
void Note::removeState(State *state)
@ -2454,7 +2454,7 @@ void Note::listUsedTags(TQValueList<Tag*> &list)
{
for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it) {
Tag *tag = (*it)->parentTag();
if (!list.tqcontains(tag))
if (!list.contains(tag))
list.append(tag);
}
@ -2467,7 +2467,7 @@ void Note::usedStates(TQValueList<State*> &states)
{
if (content())
for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it)
if (!states.tqcontains(*it))
if (!states.contains(*it))
states.append(*it);
FOR_EACH_CHILD (child)

@ -131,7 +131,7 @@ class Note
Note* lastSibling();
int yExpander();
bool isAfter(Note *note);
bool tqcontains(Note *note);
bool contains(Note *note);
/// NOTES VARIOUS PROPERTIES: // CONTENT MANAGEMENT?
private:

@ -309,16 +309,16 @@ TQString LauncherContent::saveAsFilters() { return "application/x-desktop"; }
TQString ColorContent::saveAsFilters() { return ""; }
TQString UnknownContent::saveAsFilters() { return ""; }
bool TextContent::match(const FilterData &data) { return (text().tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool HtmlContent::match(const FilterData &data) { return (m_textEquivalent/*toText("")*/.tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); } //OPTIM_FILTER
bool TextContent::match(const FilterData &data) { return (text().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool HtmlContent::match(const FilterData &data) { return (m_textEquivalent/*toText("")*/.find(data.string, /*index=*/0, /*cs=*/false) != -1); } //OPTIM_FILTER
bool ImageContent::match(const FilterData &/*data*/) { return false; }
bool AnimationContent::match(const FilterData &/*data*/) { return false; }
bool SoundContent::match(const FilterData &data) { return (fileName().tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool FileContent::match(const FilterData &data) { return (fileName().tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool LinkContent::match(const FilterData &data) { return (title().tqfind(data.string, 0, false) != -1 || url().prettyURL().tqfind(data.string, 0, false) != -1); }
bool LauncherContent::match(const FilterData &data) { return (exec().tqfind(data.string, 0, false) != -1 || name().tqfind(data.string, 0, false) != -1); }
bool ColorContent::match(const FilterData &data) { return (TQString(color().name()).tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool UnknownContent::match(const FilterData &data) { return (mimeTypes().tqfind(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool SoundContent::match(const FilterData &data) { return (fileName().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool FileContent::match(const FilterData &data) { return (fileName().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool LinkContent::match(const FilterData &data) { return (title().find(data.string, 0, false) != -1 || url().prettyURL().find(data.string, 0, false) != -1); }
bool LauncherContent::match(const FilterData &data) { return (exec().find(data.string, 0, false) != -1 || name().find(data.string, 0, false) != -1); }
bool ColorContent::match(const FilterData &data) { return (TQString(color().name()).find(data.string, /*index=*/0, /*cs=*/false) != -1); }
bool UnknownContent::match(const FilterData &data) { return (mimeTypes().find(data.string, /*index=*/0, /*cs=*/false) != -1); }
TQString TextContent::editToolTipText() { return i18n("Edit this plain text"); }
TQString HtmlContent::editToolTipText() { return i18n("Edit this text"); }
@ -600,8 +600,8 @@ void TextContent::exportToHTML(HTMLExporter *exporter, int indent)
{
TQString spaces;
TQString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" +
Tools::tagURLs(Tools::textToHTMLWithoutP(text().tqreplace("\t", " "))); // Don't collapse multiple spaces!
exporter->stream << html.tqreplace(" ", " &nbsp;").tqreplace("\n", "\n" + spaces.fill(' ', indent + 1));
Tools::tagURLs(Tools::textToHTMLWithoutP(text().replace("\t", " "))); // Don't collapse multiple spaces!
exporter->stream << html.replace(" ", " &nbsp;").replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class HtmlContent:
@ -708,9 +708,9 @@ void HtmlContent::setHtml(const TQString &html, bool lazyLoad)
void HtmlContent::exportToHTML(HTMLExporter *exporter, int indent)
{
TQString spaces;
exporter->stream << Tools::htmlToParagraph(Tools::tagURLs(html().tqreplace("\t", " ")))
.tqreplace(" ", " &nbsp;")
.tqreplace("\n", "\n" + spaces.fill(' ', indent + 1));
exporter->stream << Tools::htmlToParagraph(Tools::tagURLs(html().replace("\t", " ")))
.replace(" ", " &nbsp;")
.replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class ImageContent:
@ -1144,7 +1144,7 @@ void FileContent::exportToHTML(HTMLExporter *exporter, int indent)
{
TQString spaces;
TQString fileName = exporter->copyFile(fullPath(), true);
exporter->stream << m_linkDisplay.toHtml(exporter, KURL(exporter->dataFolderName + fileName), "").tqreplace("\n", "\n" + spaces.fill(' ', indent + 1));
exporter->stream << m_linkDisplay.toHtml(exporter, KURL(exporter->dataFolderName + fileName), "").replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class SoundContent:
@ -1388,7 +1388,7 @@ void LinkContent::exportToHTML(HTMLExporter *exporter, int indent)
*/
TQString spaces;
exporter->stream << m_linkDisplay.toHtml(exporter, linkURL, linkTitle).tqreplace("\n", "\n" + spaces.fill(' ', indent + 1));
exporter->stream << m_linkDisplay.toHtml(exporter, linkURL, linkTitle).replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class LauncherContent:
@ -1505,7 +1505,7 @@ void LauncherContent::exportToHTML(HTMLExporter *exporter, int indent)
{
TQString spaces;
TQString fileName = exporter->copyFile(fullPath(), /*createIt=*/true);
exporter->stream << m_linkDisplay.toHtml(exporter, KURL(exporter->dataFolderName + fileName), "").tqreplace("\n", "\n" + spaces.fill(' ', indent + 1));
exporter->stream << m_linkDisplay.toHtml(exporter, KURL(exporter->dataFolderName + fileName), "").replace("\n", "\n" + spaces.fill(' ', indent + 1));
}
/** class ColorContent:
@ -1907,7 +1907,7 @@ void UnknownContent::addAlternateDragObjects(KMultipleDrag *dragObject)
void UnknownContent::exportToHTML(HTMLExporter *exporter, int indent)
{
TQString spaces;
exporter->stream << "<div class=\"unknown\">" << mimeTypes().tqreplace("\n", "\n" + spaces.fill(' ', indent + 1 + 1)) << "</div>";
exporter->stream << "<div class=\"unknown\">" << mimeTypes().replace("\n", "\n" + spaces.fill(' ', indent + 1 + 1)) << "</div>";
}

@ -596,7 +596,7 @@ class UnknownContent : public NoteContent
// Open Content or File:
KURL urlToOpen(bool /*with*/) { return KURL(); }
// Content-Specific Methods:
TQString mimeTypes() { return m_mimeTypes; } /// << @return the list of MIME types this note-content tqcontains.
TQString mimeTypes() { return m_mimeTypes; } /// << @return the list of MIME types this note-content contains.
protected:
TQString m_mimeTypes;
static const int DECORATION_MARGIN;

@ -922,7 +922,7 @@ TQString NoteFactory::iconForCommand(const TQString &command)
// 1. Use first word as icon (typically the program without argument)
icon = TQStringList::split(' ', command).first();
// 2. If the command is a full path, take only the program file name
icon = icon.mid(icon.tqfindRev('/') + 1); // strip path if given [But it doesn't care of such
icon = icon.mid(icon.findRev('/') + 1); // strip path if given [But it doesn't care of such
// "myprogram /my/path/argument" -> return "argument". Would
// must first strip first word and then strip path... Useful ??
// 3. Use characters before any '-' (e.g. use "gimp" icon if run command is "gimp-1.3")

@ -60,7 +60,7 @@ TQString PasswordDlg::key() const
TQString s = w->keyCombo->currentText();
if(s.length() < 16)
return "";
int n = s.tqfindRev(' ');
int n = s.findRev(' ');
if(n < 0)
return "";
return s.mid(n+1);
@ -75,7 +75,7 @@ void PasswordDlg::setKey(const TQString& key)
{
for(int i = 0; i < w->keyCombo->count(); ++i)
{
if(w->keyCombo->text(i).tqfind(key) >= 0)
if(w->keyCombo->text(i).find(key) >= 0)
{
w->keyCombo->setCurrentItem(i);
return;

@ -62,7 +62,7 @@ void SizeTip::positionTip( const TQRect &rect )
TQRect deskR = KGlobalSettings::desktopGeometry( TQPoint( 0, 0 ) );
tipRect.moveCenter( TQPoint( deskR.width()/2, deskR.height()/2 ) );
if ( !rect.tqcontains( tipRect, true ) && rect.intersects( tipRect ) )
if ( !rect.contains( tipRect, true ) && rect.intersects( tipRect ) )
tipRect.moveBottomRight( tqgeometry().bottomRight() );
}

@ -132,15 +132,15 @@ TQString SoftwareImporters::fromICS(const TQString &ics)
// Remove escaped '\' characters and append the text to the body
int pos = 0;
while ( (pos = result.tqfind('\\', pos)) != -1 ) {
while ( (pos = result.find('\\', pos)) != -1 ) {
if ((uint)pos == result.length() - 1) // End of string
break;
if (result[pos+1] == 'n') {
result.tqreplace(pos, 2, '\n');
result.replace(pos, 2, '\n');
} else if (result[pos+1] == 'r') {
result.tqreplace(pos, 2, '\r');
result.replace(pos, 2, '\r');
} else if (result[pos+1] == 't') {
result.tqreplace(pos, 2, '\t');
result.replace(pos, 2, '\t');
} else if (result[pos] == '\\') {
result.remove(pos, 1); // Take care of "\\", "\,", "\;" and other escaped characters I haven't noticed
++pos;
@ -153,34 +153,34 @@ TQString SoftwareImporters::fromICS(const TQString &ics)
TQString SoftwareImporters::fromTomboy(TQString tomboy)
{
// The first line is the note title, and we already have it, so we remove it (yes, that's pretty stupid to duplicate it in the content...):
tomboy = tomboy.mid(tomboy.tqfind("\n")).stripWhiteSpace();
tomboy = tomboy.mid(tomboy.find("\n")).stripWhiteSpace();
// Font styles and decorations:
tomboy.tqreplace("<bold>", "<b>");
tomboy.tqreplace("</bold>", "</b>");
tomboy.tqreplace("<italic>", "<i>");
tomboy.tqreplace("</italic>", "</i>");
tomboy.tqreplace("<strikethrough>", "<span style='text-decoration: line-through'>");
tomboy.tqreplace("</strikethrough>", "</span>");
tomboy.replace("<bold>", "<b>");
tomboy.replace("</bold>", "</b>");
tomboy.replace("<italic>", "<i>");
tomboy.replace("</italic>", "</i>");
tomboy.replace("<strikethrough>", "<span style='text-decoration: line-through'>");
tomboy.replace("</strikethrough>", "</span>");
// Highlight not supported by TQTextEdit:
tomboy.tqreplace("<highlight>", "<span style='color:#ff0080'>");
tomboy.tqreplace("</highlight>", "</span>");
tomboy.replace("<highlight>", "<span style='color:#ff0080'>");
tomboy.replace("</highlight>", "</span>");
// Font sizes:
tomboy.tqreplace("<size:small>", "<span style='font-size: 7pt'>");
tomboy.tqreplace("</size:small>", "</span>");
tomboy.tqreplace("<size:large>", "<span style='font-size: 16pt'>");
tomboy.tqreplace("</size:large>", "</span>");
tomboy.tqreplace("<size:huge>", "<span style='font-size: 20pt'>");
tomboy.tqreplace("</size:huge>", "</span>");
tomboy.replace("<size:small>", "<span style='font-size: 7pt'>");
tomboy.replace("</size:small>", "</span>");
tomboy.replace("<size:large>", "<span style='font-size: 16pt'>");
tomboy.replace("</size:large>", "</span>");
tomboy.replace("<size:huge>", "<span style='font-size: 20pt'>");
tomboy.replace("</size:huge>", "</span>");
// Internal links to other notes aren't supported yet by BasKet Note Pads:
tomboy.tqreplace("<link:internal>", "");
tomboy.tqreplace("</link:internal>", "");
tomboy.replace("<link:internal>", "");
tomboy.replace("</link:internal>", "");
// In the Tomboy file, new lines are "\n" and not "<br>":
tomboy.tqreplace("\n", "<br>\n");
tomboy.replace("\n", "<br>\n");
// Preserve consecutive spaces:
return "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + tomboy + "</body></html>";
@ -264,7 +264,7 @@ void SoftwareImporters::importKJots()
} else if (buf.left(3) != "\\ID") { // Don't care of the ID
// Remove escaped '\' characters and append the text to the body
int pos = 0;
while ( (pos = buf.tqfind('\\', pos)) != -1 )
while ( (pos = buf.find('\\', pos)) != -1 )
if (buf[++pos] == '\\')
buf.remove(pos, 1);
body.append(buf + "\n");
@ -379,7 +379,7 @@ void SoftwareImporters::importStickyNotes()
TQStringList list = dir.entryList();
for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { // For each folder
if ( (*it).tqcontains("gnome", false) ) {
if ( (*it).contains("gnome", false) ) {
TQString fullPath = TQDir::home().absPath() + "/" + (*it) + "/stickynotes_applet";
if (dir.exists(fullPath))
founds += fullPath;
@ -457,9 +457,9 @@ void SoftwareImporters::importTomboy()
// Isolate "<note-content version="0.1">CONTENT</note-content>"!
TQString xml = loadUtf8FileToString(dirPath + *it);
xml = xml.mid(xml.tqfind("<note-content "));
xml = xml.mid(xml.tqfind(">") + 1);
xml = xml.mid(0, xml.tqfind("</note-content>"));
xml = xml.mid(xml.find("<note-content "));
xml = xml.mid(xml.find(">") + 1);
xml = xml.mid(0, xml.find("</note-content>"));
if (!title.isEmpty() && !/*content*/xml.isEmpty())
insertTitledNote(basket, title, fromTomboy(xml/*content*/), TQt::RichText);
@ -598,8 +598,8 @@ void SoftwareImporters::importKnowIt()
if(stream.atEnd())
break;
int i = line.tqfind("Entry") + 6;
int n = line.tqfind(' ', i);
int i = line.find("Entry") + 6;
int n = line.find(' ', i);
level = line.mid(i, n - i).toInt();
name = line.mid(n+1);
text = "";

@ -107,8 +107,8 @@ void KSystemTray2::displayCloseMessage(TQString fileMenu)
// out of screen.
if (useSystray) {
TQRect deskRect(0, 0, desktopWidth, desktopHeight);
if ( !deskRect.tqcontains(g.x(), g.y()) ||
!deskRect.tqcontains(g.x() + tw, g.y() + th) )
if ( !deskRect.contains(g.x(), g.y()) ||
!deskRect.contains(g.x() + tw, g.y() + th) )
useSystray = false;
}
@ -297,7 +297,7 @@ void SystemTray::mouseReleaseEvent(TQMouseEvent *event)
{
m_canDrag = false;
if (event->button() == Qt::LeftButton) // Show / hide main window
if ( TQT_TQRECT_OBJECT(rect()).tqcontains(event->pos()) ) { // Accept only if released in systemTray
if ( TQT_TQRECT_OBJECT(rect()).contains(event->pos()) ) { // Accept only if released in systemTray
toggleActive();
emit showPart();
event->accept();
@ -350,7 +350,7 @@ void SystemTray::dropEvent(TQDropEvent *event)
/*
* This function copies the entirety of src into dest, starting in
* dest at x and y. This function exists because I was unable to tqfind
* dest at x and y. This function exists because I was unable to find
* a function like it in either TQImage or kdefx
*/
static bool copyImage(TQImage &dest, TQImage &src, int x, int y)

@ -791,7 +791,7 @@ void TagsEditDialog::moveUp()
// Move in the value list:
if (tagItem->tagCopy()) {
int pos = m_tagCopies.tqfindIndex(tagItem->tagCopy());
int pos = m_tagCopies.findIndex(tagItem->tagCopy());
m_tagCopies.remove(tagItem->tagCopy());
int i = 0;
for (TagCopy::List::iterator it = m_tagCopies.begin(); it != m_tagCopies.end(); ++it, ++i)
@ -801,7 +801,7 @@ void TagsEditDialog::moveUp()
}
} else {
StateCopy::List &stateCopies = ((TagListViewItem*)( tagItem->tqparent() ))->tagCopy()->stateCopies;
int pos = stateCopies.tqfindIndex(tagItem->stateCopy());
int pos = stateCopies.findIndex(tagItem->stateCopy());
stateCopies.remove(tagItem->stateCopy());
int i = 0;
for (StateCopy::List::iterator it = stateCopies.begin(); it != stateCopies.end(); ++it, ++i)
@ -829,7 +829,7 @@ void TagsEditDialog::moveDown()
// Move in the value list:
if (tagItem->tagCopy()) {
uint pos = m_tagCopies.tqfindIndex(tagItem->tagCopy());
uint pos = m_tagCopies.findIndex(tagItem->tagCopy());
m_tagCopies.remove(tagItem->tagCopy());
if (pos == m_tagCopies.count() - 1) // Insert at end: iterator does not go there
m_tagCopies.append(tagItem->tagCopy());
@ -843,7 +843,7 @@ void TagsEditDialog::moveDown()
}
} else {
StateCopy::List &stateCopies = ((TagListViewItem*)( tagItem->tqparent() ))->tagCopy()->stateCopies;
uint pos = stateCopies.tqfindIndex(tagItem->stateCopy());
uint pos = stateCopies.findIndex(tagItem->stateCopy());
stateCopies.remove(tagItem->stateCopy());
if (pos == stateCopies.count() - 1) // Insert at end: iterator does not go there
stateCopies.append(tagItem->stateCopy());

@ -69,9 +69,9 @@ TQString Tools::textToHTML(const TQString &text)
if (/*text.isEmpty() ||*/ text == " " || text == "&nbsp;")
return "<p>&nbsp;</p>";
// convertFromPlainText() tqreplace "\n\n" by "</p>\n<p>": we don't want that
// convertFromPlainText() replace "\n\n" by "</p>\n<p>": we don't want that
TQString htmlString = TQStyleSheet::convertFromPlainText(text, TQStyleSheetItem::WhiteSpaceNormal);
return htmlString.tqreplace("</p>\n", "<br>\n<br>\n").tqreplace("\n<p>", "\n"); // Don't replace first and last tags
return htmlString.replace("</p>\n", "<br>\n<br>\n").replace("\n<p>", "\n"); // Don't replace first and last tags
}
TQString Tools::textToHTMLWithoutP(const TQString &text)
@ -88,7 +88,7 @@ TQString Tools::htmlToParagraph(const TQString &html)
// Remove the <html> start tag, all the <head> and the <body> start
// Because <body> can contain style="..." parameter, we transform it to <span>
int pos = result.tqfind("<body");
int pos = result.find("<body");
if (pos != -1) {
result = "<span" + result.mid(pos + 5);
startedBySpan = true;
@ -96,14 +96,14 @@ TQString Tools::htmlToParagraph(const TQString &html)
// Remove the ending "</p>\n</body></html>", each tag can be separated by space characters (%s)
// "</p>" can be omitted (eg. if the HTML doesn't contain paragraph but tables), as well as "</body>" (optinal)
pos = result.tqfind(TQRegExp("(?:(?:</p>[\\s\\n\\r\\t]*)*</body>[\\s\\n\\r\\t]*)*</html>", false)); // Case unsensitive
pos = result.find(TQRegExp("(?:(?:</p>[\\s\\n\\r\\t]*)*</body>[\\s\\n\\r\\t]*)*</html>", false)); // Case unsensitive
if (pos != -1)
result = result.left(pos);
if (startedBySpan)
result += "</span>";
return result.tqreplace("</p>", "<br><br>").tqreplace("<p>", "");
return result.replace("</p>", "<br><br>").replace("<p>", "");
}
// The following is adapted from KStringHanlder::tagURLs
@ -125,7 +125,7 @@ TQString Tools::tagURLs(const TQString &text)
continue;
}
TQString anchor = "<a href=\"" + href + "\">" + href + "</a>";
richText.tqreplace(urlPos, urlLen, anchor);
richText.replace(urlPos, urlLen, anchor);
urlPos += anchor.length();
}
return richText;
@ -135,24 +135,24 @@ TQString Tools::htmlToText(const TQString &html)
{
TQString text = htmlToParagraph(html);
text.remove("\n");
text.tqreplace("</h1>", "\n");
text.tqreplace("</h2>", "\n");
text.tqreplace("</h3>", "\n");
text.tqreplace("</h4>", "\n");
text.tqreplace("</h5>", "\n");
text.tqreplace("</h6>", "\n");
text.tqreplace("</li>", "\n");
text.tqreplace("</dt>", "\n");
text.tqreplace("</dd>", "\n");
text.tqreplace("<dd>", " ");
text.tqreplace("</div>","\n");
text.tqreplace("</blockquote>","\n");
text.tqreplace("</caption>","\n");
text.tqreplace("</tr>", "\n");
text.tqreplace("</th>", " ");
text.tqreplace("</td>", " ");
text.tqreplace("<br>", "\n");
text.tqreplace("<br />","\n");
text.replace("</h1>", "\n");
text.replace("</h2>", "\n");
text.replace("</h3>", "\n");
text.replace("</h4>", "\n");
text.replace("</h5>", "\n");
text.replace("</h6>", "\n");
text.replace("</li>", "\n");
text.replace("</dt>", "\n");
text.replace("</dd>", "\n");
text.replace("<dd>", " ");
text.replace("</div>","\n");
text.replace("</blockquote>","\n");
text.replace("</caption>","\n");
text.replace("</tr>", "\n");
text.replace("</th>", " ");
text.replace("</td>", " ");
text.replace("<br>", "\n");
text.replace("<br />","\n");
// FIXME: Format <table> tags better, if possible
// TODO: Replace &eacute; and co. by theire equivalent!
@ -165,7 +165,7 @@ TQString Tools::htmlToText(const TQString &html)
TQValueStack<bool> ul; // true if current list is a <ul> one, false if it's an <ol> one
TQValueStack<int> lines; // The line number if it is an <ol> list
// We're removing every other tags, or replace them in the case of li:
while ( (pos = text.tqfind("<"), pos) != -1 ) {
while ( (pos = text.find("<"), pos) != -1 ) {
// What is the current tag?
tag = text.mid(pos + 1, 2);
tag3 = text.mid(pos + 1, 3);
@ -184,7 +184,7 @@ TQString Tools::htmlToText(const TQString &html)
lines.pop();
}
// Where the tag closes?
pos2 = text.tqfind(">");
pos2 = text.find(">");
if (pos2 != -1) {
// Remove the tag:
text.remove(pos, pos2 - pos + 1);
@ -209,11 +209,11 @@ TQString Tools::htmlToText(const TQString &html)
++pos;
}
text.tqreplace("&gt;", ">");
text.tqreplace("&lt;", "<");
text.tqreplace("&quot;", "\"");
text.tqreplace("&nbsp;", " ");
text.tqreplace("&amp;", "&"); // CONVERT IN LAST!!
text.replace("&gt;", ">");
text.replace("&lt;", "<");
text.replace("&quot;", "\"");
text.replace("&nbsp;", " ");
text.replace("&amp;", "&"); // CONVERT IN LAST!!
return text;
}
@ -227,14 +227,14 @@ TQString Tools::cssFontDefinition(const TQFont &font, bool onlyFontFamily)
// Then, try to match the font name with a standard CSS font family:
TQString genericFont = "";
if (definition.tqcontains("serif", false) || definition.tqcontains("roman", false))
if (definition.contains("serif", false) || definition.contains("roman", false))
genericFont = "serif";
// No "else if" because "sans serif" must be counted as "sans". So, the order between "serif" and "sans" is important
if (definition.tqcontains("sans", false) || definition.tqcontains("arial", false) || definition.tqcontains("helvetica", false))
if (definition.contains("sans", false) || definition.contains("arial", false) || definition.contains("helvetica", false))
genericFont = "sans-serif";
if (definition.tqcontains("mono", false) || definition.tqcontains("courier", false) ||
definition.tqcontains("typewriter", false) || definition.tqcontains("console", false) ||
definition.tqcontains("terminal", false) || definition.tqcontains("news", false))
if (definition.contains("mono", false) || definition.contains("courier", false) ||
definition.contains("typewriter", false) || definition.contains("console", false) ||
definition.contains("terminal", false) || definition.contains("news", false))
genericFont = "monospace";
// Eventually add the generic font family to the definition:
@ -384,7 +384,7 @@ TQString Tools::fileNameForNewFile(const TQString &wantedName, const TQString &d
// Find the file extension, if it exists : Split fileName in fileName and extension
// Example : fileName == "note5-3.txt" => fileName = "note5-3" and extension = ".txt"
int extIndex = fileName.tqfindRev('.');
int extIndex = fileName.findRev('.');
if (extIndex != -1 && extIndex != int(fileName.length()-1)) { // Extension found and fileName do not ends with '.' !
extension = fileName.mid(extIndex);
fileName.truncate(extIndex);
@ -392,7 +392,7 @@ TQString Tools::fileNameForNewFile(const TQString &wantedName, const TQString &d
// Find the file number, if it exists : Split fileName in fileName and number
// Example : fileName == "note5-3" => fileName = "note5" and number = 3
int extNumber = fileName.tqfindRev('-');
int extNumber = fileName.findRev('-');
if (extNumber != -1 && extNumber != int(fileName.length()-1)) { // Number found and fileName do not ends with '-' !
bool isANumber;
int theNumber = fileName.mid(extNumber + 1).toInt(&isANumber);

Loading…
Cancel
Save