summaryrefslogtreecommitdiffstats
path: root/kio/bookmarks/kbookmark.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kio/bookmarks/kbookmark.cc')
-rw-r--r--kio/bookmarks/kbookmark.cc166
1 files changed, 83 insertions, 83 deletions
diff --git a/kio/bookmarks/kbookmark.cc b/kio/bookmarks/kbookmark.cc
index 59cf10db3..44b8b496c 100644
--- a/kio/bookmarks/kbookmark.cc
+++ b/kio/bookmarks/kbookmark.cc
@@ -20,7 +20,7 @@
*/
#include "kbookmark.h"
-#include <qvaluestack.h>
+#include <tqvaluestack.h>
#include <kdebug.h>
#include <kmimetype.h>
#include <kstringhandler.h>
@@ -33,16 +33,16 @@
#include <kbookmarkmanager.h>
KBookmarkGroup::KBookmarkGroup()
- : KBookmark( QDomElement() )
+ : KBookmark( TQDomElement() )
{
}
-KBookmarkGroup::KBookmarkGroup( QDomElement elem )
+KBookmarkGroup::KBookmarkGroup( TQDomElement elem )
: KBookmark(elem)
{
}
-QString KBookmarkGroup::groupAddress() const
+TQString KBookmarkGroup::groupAddress() const
{
if (m_address.isEmpty())
m_address = address();
@@ -55,7 +55,7 @@ bool KBookmarkGroup::isOpen() const
}
// Returns first element node equal to or after node n
-static QDomElement firstElement(QDomNode n)
+static TQDomElement firstElement(TQDomNode n)
{
while(!n.isNull() && !n.isElement())
n = n.nextSibling();
@@ -63,7 +63,7 @@ static QDomElement firstElement(QDomNode n)
}
// Returns first element node equal to or before node n
-static QDomElement lastElement(QDomNode n)
+static TQDomElement lastElement(TQDomNode n)
{
while(!n.isNull() && !n.isElement())
n = n.previousSibling();
@@ -85,18 +85,18 @@ KBookmark KBookmarkGroup::next( const KBookmark & current ) const
return KBookmark( nextKnownTag( firstElement(current.element.nextSibling()), true ) );
}
-// KDE4: Change QDomElement to QDomNode so that we can get rid of
+// KDE4: Change TQDomElement to TQDomNode so that we can get rid of
// firstElement() and lastElement()
-QDomElement KBookmarkGroup::nextKnownTag( QDomElement start, bool goNext ) const
+TQDomElement KBookmarkGroup::nextKnownTag( TQDomElement start, bool goNext ) const
{
- static const QString & bookmark = KGlobal::staticQString("bookmark");
- static const QString & folder = KGlobal::staticQString("folder");
- static const QString & separator = KGlobal::staticQString("separator");
+ static const TQString & bookmark = KGlobal::staticQString("bookmark");
+ static const TQString & folder = KGlobal::staticQString("folder");
+ static const TQString & separator = KGlobal::staticQString("separator");
- for( QDomNode n = start; !n.isNull(); )
+ for( TQDomNode n = start; !n.isNull(); )
{
- QDomElement elem = n.toElement();
- QString tag = elem.tagName();
+ TQDomElement elem = n.toElement();
+ TQString tag = elem.tagName();
if (tag == folder || tag == bookmark || tag == separator)
return elem;
if (goNext)
@@ -104,30 +104,30 @@ QDomElement KBookmarkGroup::nextKnownTag( QDomElement start, bool goNext ) const
else
n = n.previousSibling();
}
- return QDomElement();
+ return TQDomElement();
}
-KBookmarkGroup KBookmarkGroup::createNewFolder( KBookmarkManager* mgr, const QString & text, bool emitSignal )
+KBookmarkGroup KBookmarkGroup::createNewFolder( KBookmarkManager* mgr, const TQString & text, bool emitSignal )
{
- QString txt( text );
+ TQString txt( text );
if ( text.isEmpty() )
{
bool ok;
- QString caption = parentGroup().fullText().isEmpty() ?
+ TQString caption = parentGroup().fullText().isEmpty() ?
i18n( "Create New Bookmark Folder" ) :
i18n( "Create New Bookmark Folder in %1" )
.arg( parentGroup().text() );
txt = KInputDialog::getText( caption, i18n( "New folder:" ),
- QString::null, &ok );
+ TQString::null, &ok );
if ( !ok )
return KBookmarkGroup();
}
Q_ASSERT(!element.isNull());
- QDomDocument doc = element.ownerDocument();
- QDomElement groupElem = doc.createElement( "folder" );
+ TQDomDocument doc = element.ownerDocument();
+ TQDomElement groupElem = doc.createElement( "folder" );
element.appendChild( groupElem );
- QDomElement textElem = doc.createElement( "title" );
+ TQDomElement textElem = doc.createElement( "title" );
groupElem.appendChild( textElem );
textElem.appendChild( doc.createTextNode( txt ) );
@@ -145,25 +145,25 @@ KBookmarkGroup KBookmarkGroup::createNewFolder( KBookmarkManager* mgr, const QSt
KBookmark KBookmarkGroup::createNewSeparator()
{
Q_ASSERT(!element.isNull());
- QDomDocument doc = element.ownerDocument();
+ TQDomDocument doc = element.ownerDocument();
Q_ASSERT(!doc.isNull());
- QDomElement sepElem = doc.createElement( "separator" );
+ TQDomElement sepElem = doc.createElement( "separator" );
element.appendChild( sepElem );
return KBookmark(sepElem);
}
bool KBookmarkGroup::moveItem( const KBookmark & item, const KBookmark & after )
{
- QDomNode n;
+ TQDomNode n;
if ( !after.isNull() )
n = element.insertAfter( item.element, after.element );
else // first child
{
if ( element.firstChild().isNull() ) // Empty element -> set as real first child
- n = element.insertBefore( item.element, QDomElement() );
+ n = element.insertBefore( item.element, TQDomElement() );
// we have to skip everything up to the first valid child
- QDomElement firstChild = nextKnownTag(element.firstChild().toElement(), true);
+ TQDomElement firstChild = nextKnownTag(element.firstChild().toElement(), true);
if ( !firstChild.isNull() )
n = element.insertBefore( item.element, firstChild );
else
@@ -192,18 +192,18 @@ KBookmark KBookmarkGroup::addBookmark( KBookmarkManager* mgr, const KBookmark &b
return bm;
}
-KBookmark KBookmarkGroup::addBookmark( KBookmarkManager* mgr, const QString & text, const KURL & url, const QString & icon, bool emitSignal )
+KBookmark KBookmarkGroup::addBookmark( KBookmarkManager* mgr, const TQString & text, const KURL & url, const TQString & icon, bool emitSignal )
{
//kdDebug(7043) << "KBookmarkGroup::addBookmark " << text << " into " << m_address << endl;
- QDomDocument doc = element.ownerDocument();
- QDomElement elem = doc.createElement( "bookmark" );
+ TQDomDocument doc = element.ownerDocument();
+ TQDomElement elem = doc.createElement( "bookmark" );
elem.setAttribute( "href", url.url( 0, 106 ) ); // write utf8 URL (106 is mib enum for utf8)
- QString _icon = icon;
+ TQString _icon = icon;
if ( _icon.isEmpty() )
_icon = KMimeType::iconForURL( url );
elem.setAttribute( "icon", _icon );
- QDomElement textElem = doc.createElement( "title" );
+ TQDomElement textElem = doc.createElement( "title" );
elem.appendChild( textElem );
textElem.appendChild( doc.createTextNode( text ) );
@@ -220,13 +220,13 @@ bool KBookmarkGroup::isToolbarGroup() const
return ( element.attribute("toolbar") == "yes" );
}
-QDomElement KBookmarkGroup::findToolbar() const
+TQDomElement KBookmarkGroup::findToolbar() const
{
if ( element.attribute("toolbar") == "yes" )
return element;
- for (QDomNode n = element.firstChild(); !n.isNull() ; n = n.nextSibling() )
+ for (TQDomNode n = element.firstChild(); !n.isNull() ; n = n.nextSibling() )
{
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
// Search among the "folder" children only
if ( e.tagName() == "folder" )
{
@@ -234,18 +234,18 @@ QDomElement KBookmarkGroup::findToolbar() const
return e;
else
{
- QDomElement result = KBookmarkGroup(e).findToolbar();
+ TQDomElement result = KBookmarkGroup(e).findToolbar();
if (!result.isNull())
return result;
}
}
}
- return QDomElement();
+ return TQDomElement();
}
-QValueList<KURL> KBookmarkGroup::groupUrlList() const
+TQValueList<KURL> KBookmarkGroup::groupUrlList() const
{
- QValueList<KURL> urlList;
+ TQValueList<KURL> urlList;
for ( KBookmark bm = first(); !bm.isNull(); bm = next(bm) )
{
if ( bm.isSeparator() || bm.isGroup() )
@@ -259,7 +259,7 @@ QValueList<KURL> KBookmarkGroup::groupUrlList() const
bool KBookmark::isGroup() const
{
- QString tag = element.tagName();
+ TQString tag = element.tagName();
return ( tag == "folder"
|| tag == "xbel" ); // don't forget the toplevel group
}
@@ -271,16 +271,16 @@ bool KBookmark::isSeparator() const
bool KBookmark::hasParent() const
{
- QDomElement parent = element.parentNode().toElement();
+ TQDomElement parent = element.parentNode().toElement();
return !parent.isNull();
}
-QString KBookmark::text() const
+TQString KBookmark::text() const
{
return KStringHandler::csqueeze( fullText() );
}
-QString KBookmark::fullText() const
+TQString KBookmark::fullText() const
{
if (isSeparator())
return i18n("--- separator ---");
@@ -293,9 +293,9 @@ KURL KBookmark::url() const
return KURL(element.attribute("href"), 106); // Decode it from utf8 (106 is mib enum for utf8)
}
-QString KBookmark::icon() const
+TQString KBookmark::icon() const
{
- QString icon = element.attribute("icon");
+ TQString icon = element.attribute("icon");
if ( icon.isEmpty() )
// Default icon depends on URL for bookmarks, and is default directory
// icon for groups.
@@ -320,10 +320,10 @@ KBookmarkGroup KBookmark::toGroup() const
return KBookmarkGroup(element);
}
-QString KBookmark::address() const
+TQString KBookmark::address() const
{
if ( element.tagName() == "xbel" )
- return ""; // not QString::null !
+ return ""; // not TQString::null !
else
{
// Use keditbookmarks's DEBUG_ADDRESSES flag to debug this code :)
@@ -333,44 +333,44 @@ QString KBookmark::address() const
return "ERROR"; // Avoid an infinite loop
}
KBookmarkGroup group = parentGroup();
- QString parentAddress = group.address();
+ TQString parentAddress = group.address();
uint counter = 0;
// Implementation note: we don't use QDomNode's childNode list because we
// would have to skip "TEXT", which KBookmarkGroup already does for us.
for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk), ++counter )
{
if ( bk.element == element )
- return parentAddress + "/" + QString::number(counter);
+ return parentAddress + "/" + TQString::number(counter);
}
kdWarning() << "KBookmark::address : this can't happen! " << parentAddress << endl;
return "ERROR";
}
}
-KBookmark KBookmark::standaloneBookmark( const QString & text, const KURL & url, const QString & icon )
+KBookmark KBookmark::standaloneBookmark( const TQString & text, const KURL & url, const TQString & icon )
{
- QDomDocument doc("xbel");
- QDomElement elem = doc.createElement("xbel");
+ TQDomDocument doc("xbel");
+ TQDomElement elem = doc.createElement("xbel");
doc.appendChild( elem );
KBookmarkGroup grp( elem );
grp.addBookmark( 0L, text, url, icon, false );
return grp.first();
}
-// For some strange reason QString("").left(0) returns QString::null;
+// For some strange reason TQString("").left(0) returns TQString::null;
// That breaks commonParent()
-QString KBookmark::left(const QString & str, uint len)
+TQString KBookmark::left(const TQString & str, uint len)
{
- //kdDebug()<<"********"<<QString("").left(0).isNull()<<endl;
+ //kdDebug()<<"********"<<TQString("").left(0).isNull()<<endl;
if(len == 0)
- return QString("");
+ return TQString("");
else
return str.left(len);
}
-QString KBookmark::commonParent(QString A, QString B)
+TQString KBookmark::commonParent(TQString A, TQString B)
{
- QString error("ERROR");
+ TQString error("ERROR");
if(A == error || B == error)
return error;
@@ -389,9 +389,9 @@ QString KBookmark::commonParent(QString A, QString B)
return left(A, lastCommonSlash);
}
-static QDomNode cd_or_create(QDomNode node, QString name)
+static TQDomNode cd_or_create(TQDomNode node, TQString name)
{
- QDomNode subnode = node.namedItem(name);
+ TQDomNode subnode = node.namedItem(name);
if (subnode.isNull())
{
subnode = node.ownerDocument().createElement(name);
@@ -400,9 +400,9 @@ static QDomNode cd_or_create(QDomNode node, QString name)
return subnode;
}
-static QDomText get_or_create_text(QDomNode node)
+static TQDomText get_or_create_text(TQDomNode node)
{
- QDomNode subnode = node.firstChild();
+ TQDomNode subnode = node.firstChild();
if (subnode.isNull())
{
subnode = node.ownerDocument().createTextNode("");
@@ -412,14 +412,14 @@ static QDomText get_or_create_text(QDomNode node)
}
// Look for a metadata with owner="http://www.kde.org" or without any owner (for compatibility)
-static QDomNode findOrCreateMetadata( QDomNode& parent )
+static TQDomNode findOrCreateMetadata( TQDomNode& parent )
{
static const char kdeOwner[] = "http://www.kde.org";
- QDomElement metadataElement;
- for ( QDomNode _node = parent.firstChild(); !_node.isNull(); _node = _node.nextSibling() ) {
- QDomElement elem = _node.toElement();
+ TQDomElement metadataElement;
+ for ( TQDomNode _node = parent.firstChild(); !_node.isNull(); _node = _node.nextSibling() ) {
+ TQDomElement elem = _node.toElement();
if ( !elem.isNull() && elem.tagName() == "metadata" ) {
- const QString owner = elem.attribute( "owner" );
+ const TQString owner = elem.attribute( "owner" );
if ( owner == kdeOwner )
return elem;
if ( owner.isEmpty() )
@@ -439,7 +439,7 @@ bool KBookmark::hasMetaData() const
// ### NOTE: this code creates <info> and <metadata>, despite its name and the const.
// It doesn't matter much in practice since it's only called for newly-created bookmarks,
// which will get metadata soon after anyway.
- QDomNode n = cd_or_create( internalElement(), "info" );
+ TQDomNode n = cd_or_create( internalElement(), "info" );
return findOrCreateMetadata( n ).hasChildNodes();
}
@@ -447,44 +447,44 @@ void KBookmark::updateAccessMetadata()
{
kdDebug(7043) << "KBookmark::updateAccessMetadata " << address() << " " << url().prettyURL() << endl;
- const uint timet = QDateTime::currentDateTime().toTime_t();
- setMetaDataItem( "time_added", QString::number( timet ), DontOverwriteMetaData );
- setMetaDataItem( "time_visited", QString::number( timet ) );
+ const uint timet = TQDateTime::currentDateTime().toTime_t();
+ setMetaDataItem( "time_added", TQString::number( timet ), DontOverwriteMetaData );
+ setMetaDataItem( "time_visited", TQString::number( timet ) );
- QString countStr = metaDataItem( "visit_count" ); // TODO use spec'ed name
+ TQString countStr = metaDataItem( "visit_count" ); // TODO use spec'ed name
bool ok;
int currentCount = countStr.toInt(&ok);
if (!ok)
currentCount = 0;
currentCount++;
- setMetaDataItem( "visit_count", QString::number( currentCount ) );
+ setMetaDataItem( "visit_count", TQString::number( currentCount ) );
// TODO - for 4.0 - time_modified
}
-QString KBookmark::metaDataItem( const QString &key ) const
+TQString KBookmark::metaDataItem( const TQString &key ) const
{
- QDomNode infoNode = cd_or_create( internalElement(), "info" );
+ TQDomNode infoNode = cd_or_create( internalElement(), "info" );
infoNode = findOrCreateMetadata( infoNode );
- for ( QDomNode n = infoNode.firstChild(); !n.isNull(); n = n.nextSibling() ) {
+ for ( TQDomNode n = infoNode.firstChild(); !n.isNull(); n = n.nextSibling() ) {
if ( !n.isElement() ) {
continue;
}
- const QDomElement e = n.toElement();
+ const TQDomElement e = n.toElement();
if ( e.tagName() == key ) {
return e.text();
}
}
- return QString::null;
+ return TQString::null;
}
-void KBookmark::setMetaDataItem( const QString &key, const QString &value, MetaDataOverwriteMode mode )
+void KBookmark::setMetaDataItem( const TQString &key, const TQString &value, MetaDataOverwriteMode mode )
{
- QDomNode infoNode = cd_or_create( internalElement(), "info" );
+ TQDomNode infoNode = cd_or_create( internalElement(), "info" );
infoNode = findOrCreateMetadata( infoNode );
- QDomNode item = cd_or_create( infoNode, key );
- QDomText text = get_or_create_text( item );
+ TQDomNode item = cd_or_create( infoNode, key );
+ TQDomText text = get_or_create_text( item );
if ( mode == DontOverwriteMetaData && !text.data().isEmpty() ) {
return;
}
@@ -495,7 +495,7 @@ void KBookmark::setMetaDataItem( const QString &key, const QString &value, MetaD
void KBookmarkGroupTraverser::traverse(const KBookmarkGroup &root)
{
// non-recursive bookmark iterator
- QValueStack<KBookmarkGroup> stack;
+ TQValueStack<KBookmarkGroup> stack;
stack.push(root);
KBookmark bk = stack.top().first();
for (;;) {