diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /quanta/treeviews/structtreeview.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/treeviews/structtreeview.cpp')
-rw-r--r-- | quanta/treeviews/structtreeview.cpp | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/quanta/treeviews/structtreeview.cpp b/quanta/treeviews/structtreeview.cpp index f6f55b40..1f22e594 100644 --- a/quanta/treeviews/structtreeview.cpp +++ b/quanta/treeviews/structtreeview.cpp @@ -19,12 +19,12 @@ #include <assert.h> // QT headers -#include <qpixmap.h> -#include <qheader.h> -#include <qregexp.h> -#include <qdatetime.h> -#include <qdragobject.h> -#include <qcursor.h> +#include <tqpixmap.h> +#include <tqheader.h> +#include <tqregexp.h> +#include <tqdatetime.h> +#include <tqdragobject.h> +#include <tqcursor.h> // KDE headers #include <kapplication.h> @@ -57,7 +57,7 @@ #include "structtreeview.moc" extern GroupElementMapList globalGroupMap; -StructTreeView::StructTreeView(QWidget *parent, const char *name ) +StructTreeView::StructTreeView(TQWidget *parent, const char *name ) : KListView(parent,name), m_marker(0), m_draggedItem(0)/*, m_thisWidget(0)*/ { for (int i = 0; i < 15; i++) @@ -83,7 +83,7 @@ StructTreeView::StructTreeView(QWidget *parent, const char *name ) setLineWidth( 2 ); addColumn( i18n("Name"), -1 ); - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQWidget::ClickFocus); dtdMenu = new KPopupMenu(this); @@ -95,46 +95,46 @@ StructTreeView::StructTreeView(QWidget *parent, const char *name ) dtdMenu->insertItem(dtdList[i], i, -1); } - connect(dtdMenu, SIGNAL(activated(int)), this, SLOT(slotDTDChanged(int))); + connect(dtdMenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotDTDChanged(int))); - connect(this, SIGNAL(dropped(QDropEvent*, QListViewItem*, QListViewItem*)), - SLOT(slotDropped(QDropEvent*, QListViewItem*, QListViewItem*))); + connect(this, TQT_SIGNAL(dropped(TQDropEvent*, TQListViewItem*, TQListViewItem*)), + TQT_SLOT(slotDropped(TQDropEvent*, TQListViewItem*, TQListViewItem*))); emptyAreaMenu = new KPopupMenu(this); emptyAreaMenu->insertItem(i18n("Show Groups For"), dtdMenu); - emptyAreaMenu->insertItem(SmallIcon("reload"), i18n("&Reparse"), this, SLOT(slotReparseMenuItem())); + emptyAreaMenu->insertItem(SmallIcon("reload"), i18n("&Reparse"), this, TQT_SLOT(slotReparseMenuItem())); popupMenu = new KPopupMenu(this); popupMenu -> insertItem( i18n("Show Groups For"), dtdMenu); popupMenu -> insertSeparator(); - popupMenu -> insertItem( i18n("Select Tag Area"), this ,SLOT(slotSelectTag())); - popupMenu -> insertItem( i18n("Go to End of Tag"), this ,SLOT(slotGotoClosingTag())); - openFileMenuId = popupMenu -> insertItem( i18n("Open File"), this ,SLOT(slotOpenFile())); + popupMenu -> insertItem( i18n("Select Tag Area"), this ,TQT_SLOT(slotSelectTag())); + popupMenu -> insertItem( i18n("Go to End of Tag"), this ,TQT_SLOT(slotGotoClosingTag())); + openFileMenuId = popupMenu -> insertItem( i18n("Open File"), this ,TQT_SLOT(slotOpenFile())); popupMenu -> insertSeparator(); - popupMenu -> insertItem( i18n("Open Subtrees"), this ,SLOT(slotOpenSubTree())); - popupMenu -> insertItem( i18n("Close Subtrees"),this ,SLOT(slotCloseSubTree())); + popupMenu -> insertItem( i18n("Open Subtrees"), this ,TQT_SLOT(slotOpenSubTree())); + popupMenu -> insertItem( i18n("Close Subtrees"),this ,TQT_SLOT(slotCloseSubTree())); popupMenu -> insertSeparator(); #if 0 - popupMenu -> insertItem( i18n("Remove"),this ,SLOT(slotRemoveTags())); + popupMenu -> insertItem( i18n("Remove"),this ,TQT_SLOT(slotRemoveTags())); popupMenu -> insertSeparator(); #endif - popupMenu -> insertItem( SmallIcon("reload"), i18n("&Reparse"), this ,SLOT(slotReparseMenuItem())); - followCursorId = popupMenu -> insertItem( i18n("Follow Cursor"), this ,SLOT(changeFollowCursor())); + popupMenu -> insertItem( SmallIcon("reload"), i18n("&Reparse"), this ,TQT_SLOT(slotReparseMenuItem())); + followCursorId = popupMenu -> insertItem( i18n("Follow Cursor"), this ,TQT_SLOT(changeFollowCursor())); popupMenu -> setItemChecked ( followCursorId, followCursor() ); - connect( this, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int)), - this, SLOT (slotMouseClicked(int, QListViewItem*, const QPoint&, int))); + connect( this, TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem*, const TQPoint&, int)), + this, TQT_SLOT (slotMouseClicked(int, TQListViewItem*, const TQPoint&, int))); - connect( this, SIGNAL(doubleClicked(QListViewItem *)), SLOT(slotDoubleClicked(QListViewItem *))); + connect( this, TQT_SIGNAL(doubleClicked(TQListViewItem *)), TQT_SLOT(slotDoubleClicked(TQListViewItem *))); - connect(this, SIGNAL(expanded(QListViewItem *)), SLOT(slotExpanded(QListViewItem *))); - connect(this, SIGNAL(collapsed(QListViewItem *)), SLOT(slotCollapsed(QListViewItem *))); + connect(this, TQT_SIGNAL(expanded(TQListViewItem *)), TQT_SLOT(slotExpanded(TQListViewItem *))); + connect(this, TQT_SIGNAL(collapsed(TQListViewItem *)), TQT_SLOT(slotCollapsed(TQListViewItem *))); write = 0L; - timer = new QTime(); + timer = new TQTime(); timer->start(); m_dirty = true; } @@ -161,9 +161,9 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) StructTreeTag *item = 0L; StructTreeTag *parentItem = top; //under this int level = 0; - QString title; - QString tagStr; - QString tmpStr; + TQString title; + TQString tagStr; + TQString tmpStr; int groupId = 0; const DTDStruct* parsingDTD; for (uint index = 0; index < m_parsingDTDList.count(); index++) @@ -191,7 +191,7 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) } } else { - QMap<QString, XMLStructGroup>::ConstIterator it; + TQMap<TQString, XMLStructGroup>::ConstIterator it; for (it = parsingDTD->xmlStructTreeGroups.begin(); it != parsingDTD->xmlStructTreeGroups.end(); ++it) { XMLStructGroup group = it.data(); @@ -212,8 +212,8 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) } } groupsCount = groupId; - QMap<QString, QListViewItem*> lastItemInGroup; - QMap<QString, QListViewItem*> groupItems; + TQMap<TQString, TQListViewItem*> lastItemInGroup; + TQMap<TQString, TQListViewItem*> groupItems; while (currentNode) { if (!groupOnly) @@ -233,14 +233,14 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) } const DTDStruct *dtd = currentNode->tag->dtd(); //add all the group elements belonging to this node to the tree - for (QValueList<GroupElement*>::ConstIterator it = currentNode->m_groupElements.constBegin(); it != currentNode->m_groupElements.constEnd(); ++it) + for (TQValueList<GroupElement*>::ConstIterator it = currentNode->m_groupElements.constBegin(); it != currentNode->m_groupElements.constEnd(); ++it) { GroupElement *groupElement = (*it); if (!groupIds.contains(groupElement->group->name + dtd->name)) continue; StructTreeTag *groupItem = groups[groupIds[groupElement->group->name + dtd->name]]; - QListViewItem* insertAfter = 0L; - QListViewItem* insertUnder = groupItem; + TQListViewItem* insertAfter = 0L; + TQListViewItem* insertUnder = groupItem; if (groupItems.contains(groupElement->group->name + groupElement->tag->name)) insertUnder = groupItems[groupElement->group->name + groupElement->tag->name]; if (lastItemInGroup.contains(groupElement->group->name)) @@ -312,9 +312,9 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) } } //add the externally found items to the tree - QListViewItem *insertUnder; - QListViewItem *insertAfter; - QListViewItem *listItem; + TQListViewItem *insertUnder; + TQListViewItem *insertAfter; + TQListViewItem *listItem; GroupElementMapList::Iterator it; IncludedGroupElementsMap::Iterator externalIt; for (uint index = 0; index < m_parsingDTDList.count(); index++) @@ -328,7 +328,7 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) { group = parsingDTD->structTreeGroups[i]; groupId = groupIds[group.name + parsingDTD->name]; - QString name = group.name+"|"; + TQString name = group.name+"|"; StructTreeTag *groupTag = groups[groupId]; for (externalIt = parser->includedMap.begin(); externalIt != parser->includedMap.end(); ++externalIt) { @@ -419,7 +419,7 @@ void StructTreeView::slotReparse(Document *w, Node* node, int openLevel, bool gr } } else { - QMap<QString, XMLStructGroup>::ConstIterator it; + TQMap<TQString, XMLStructGroup>::ConstIterator it; uint i = 0; for (it = parsingDTD->xmlStructTreeGroups.begin(); it != parsingDTD->xmlStructTreeGroups.end(); ++it) { @@ -444,7 +444,7 @@ void StructTreeView::slotReparse(Document *w, Node* node, int openLevel, bool gr m_dirty = false; } -void StructTreeView::slotGotoTag( QListViewItem *item ) +void StructTreeView::slotGotoTag( TQListViewItem *item ) { StructTreeTag *it = dynamic_cast<StructTreeTag*>(item); if (!m_dirty && it && it->node && it->node->tag) @@ -477,15 +477,15 @@ void StructTreeView::slotGotoTag( QListViewItem *item ) } -void StructTreeView::slotMouseClicked(int button, QListViewItem *item, const QPoint& point, int dummy) +void StructTreeView::slotMouseClicked(int button, TQListViewItem *item, const TQPoint& point, int dummy) { if (item) { config->setGroup("Parser options"); - QString handleMBM = config->readEntry("MBM", i18n("Select Tag Area")); - QString handleLBM = config->readEntry("LBM", i18n("Find tag")); - QString handleDoubleClick = config->readEntry("Double click", i18n("Select Tag Area")); + TQString handleMBM = config->readEntry("MBM", i18n("Select Tag Area")); + TQString handleLBM = config->readEntry("LBM", i18n("Find tag")); + TQString handleDoubleClick = config->readEntry("Double click", i18n("Select Tag Area")); setSelected(item, true); @@ -542,7 +542,7 @@ void StructTreeView::slotMouseClicked(int button, QListViewItem *item, const QPo } -void StructTreeView::slotDoubleClicked( QListViewItem *item) +void StructTreeView::slotDoubleClicked( TQListViewItem *item) { config->setGroup("Parser options"); @@ -565,7 +565,7 @@ void StructTreeView::slotReparseMenuItem() void StructTreeView::slotGotoClosingTag() { - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); StructTreeTag *it = dynamic_cast<StructTreeTag*>(item); if (!m_dirty && it && it->node) { @@ -594,7 +594,7 @@ void StructTreeView::slotGotoClosingTag() void StructTreeView::slotSelectTag() { bool newFileOpened = false; - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); StructTreeTag *it = dynamic_cast<StructTreeTag*>(item); if (!m_dirty && it && it->node) { @@ -642,7 +642,7 @@ void StructTreeView::slotSelectTag() /** Do the recursive opening or closing of the trees */ -void StructTreeView::setOpenSubTree( QListViewItem *it, bool open) +void StructTreeView::setOpenSubTree( TQListViewItem *it, bool open) { if (it) { @@ -655,7 +655,7 @@ void StructTreeView::setOpenSubTree( QListViewItem *it, bool open) /** Recursively open the tree and all its subtrees */ void StructTreeView::slotOpenSubTree() { - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); if (item) { item->setOpen( true ); @@ -667,7 +667,7 @@ void StructTreeView::slotOpenSubTree() /** Recursively close the tree and all its subtrees */ void StructTreeView::slotCloseSubTree() { - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); if (item) { item->setOpen( false ); @@ -696,7 +696,7 @@ void StructTreeView::setFollowCursor(bool follow) } /** No descriptions */ -void StructTreeView::slotExpanded(QListViewItem *item) +void StructTreeView::slotExpanded(TQListViewItem *item) { StructTreeTag *it = dynamic_cast<StructTreeTag*>(item); if (!m_dirty && it && it->node) @@ -704,20 +704,20 @@ void StructTreeView::slotExpanded(QListViewItem *item) } /** No descriptions */ -void StructTreeView::slotCollapsed(QListViewItem *item) +void StructTreeView::slotCollapsed(TQListViewItem *item) { StructTreeTag *it = dynamic_cast<StructTreeTag*>(item); if (!m_dirty && it && it->node) it->node->opened = false; } /** Do a reparse before showing. */ -void StructTreeView::showEvent(QShowEvent* /*ev*/) +void StructTreeView::showEvent(TQShowEvent* /*ev*/) { slotReparseMenuItem(); } /** Do a reparse before showing. */ -void StructTreeView::hideEvent(QHideEvent* /*ev*/) +void StructTreeView::hideEvent(TQHideEvent* /*ev*/) { emit clearProblemOutput(); } @@ -732,15 +732,15 @@ void StructTreeView::setContiguousSelectedItems() { kdDebug(25001) << "setContiguousSelectedItems" << endl; - QPtrList<QListViewItem> selected_items = selectedItems(false); + TQPtrList<TQListViewItem> selected_items = selectedItems(false); - QListViewItem* first = selected_items.getFirst(); - QListViewItem* last = selected_items.getLast(); + TQListViewItem* first = selected_items.getFirst(); + TQListViewItem* last = selected_items.getLast(); - QListViewItemIterator it(first); + TQListViewItemIterator it(first); while(it.current() && it.current() != last) { - QListViewItem* item = it.current(); + TQListViewItem* item = it.current(); if(!item->isSelected()) item->setSelected(true); @@ -748,13 +748,13 @@ void StructTreeView::setContiguousSelectedItems() } } -bool StructTreeView::acceptDrag(QDropEvent* e) const +bool StructTreeView::acceptDrag(TQDropEvent* e) const { static int i = 0; kdDebug(25001) << "acceptDrag: " << ++i << endl; - QPoint p = contentsToViewport(e->pos()); - QListViewItem* current_item = itemAt(p); + TQPoint p = contentsToViewport(e->pos()); + TQListViewItem* current_item = itemAt(p); // assert(m_thisWidget); @@ -775,7 +775,7 @@ bool StructTreeView::acceptDrag(QDropEvent* e) const m_marker = current_item; if(current_item == m_draggedItem || - !(e->provides("text/x-struct_tree_tag_item") || e->source() == (QWidget *)this) || !m_marker) + !(e->provides("text/x-struct_tree_tag_item") || e->source() == (TQWidget *)this) || !m_marker) { e->accept(false); last_accept = false; @@ -818,14 +818,14 @@ bool StructTreeView::acceptDrag(QDropEvent* e) const return is_child; } -void StructTreeView::slotDropped(QDropEvent* e, QListViewItem* parent, QListViewItem* after) +void StructTreeView::slotDropped(TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after) { if(!e) return; if (e->source() != this) return; // Only internal drags are supported atm - if(!QTextDrag::canDecode(e)) + if(!TQTextDrag::canDecode(e)) return; KPopupMenu *menu = new KPopupMenu( this ); @@ -833,7 +833,7 @@ void StructTreeView::slotDropped(QDropEvent* e, QListViewItem* parent, QListView menu->insertItem( SmallIcon("editcopy"), i18n("&Copy Here"), DRAG_COPY, 1 ); menu->insertSeparator(); menu->insertItem( SmallIcon("cancel"), i18n("C&ancel"), DRAG_CANCEL, 3 ); - int id = menu->exec(QCursor::pos(), 0); + int id = menu->exec(TQCursor::pos(), 0); switch(id) { case DRAG_COPY: @@ -856,7 +856,7 @@ void StructTreeView::slotDropped(QDropEvent* e, QListViewItem* parent, QListView void StructTreeView::startDrag() { // This a dummy drag object. Decode is made by the objects selected on the tree. - QTextDrag* drag = new QTextDrag(this); + TQTextDrag* drag = new TQTextDrag(this); // m_thisWidget = drag->source(); drag->setSubtype("x-struct_tree_tag_item"); drag->setPixmap(SmallIcon("node")); @@ -864,27 +864,27 @@ void StructTreeView::startDrag() } -void StructTreeView::contentsMousePressEvent(QMouseEvent* e) +void StructTreeView::contentsMousePressEvent(TQMouseEvent* e) { if(e->button() == LeftButton) { - QPoint p = contentsToViewport(e->pos()); + TQPoint p = contentsToViewport(e->pos()); m_draggedItem = itemAt(p); m_marker = m_draggedItem; } KListView::contentsMousePressEvent(e); } -void StructTreeView::copySelectedItems(QListViewItem* parent, QListViewItem* after) +void StructTreeView::copySelectedItems(TQListViewItem* parent, TQListViewItem* after) { StructTreeTag* parent_item = dynamic_cast<StructTreeTag*> (parent); StructTreeTag* after_item = dynamic_cast<StructTreeTag*> (after); if(!parent_item/* || !after_item*/) // can happen if the element is inserted as the first child return; - QPtrList<QListViewItem> selected_items = selectedItems(false); - QListViewItem* first_item = selected_items.getFirst(); - QListViewItem* last_item = selected_items.getLast(); + TQPtrList<TQListViewItem> selected_items = selectedItems(false); + TQListViewItem* first_item = selected_items.getFirst(); + TQListViewItem* last_item = selected_items.getLast(); Node* start_node = (dynamic_cast<StructTreeTag*> (first_item))->node; Node* end_node = (dynamic_cast<StructTreeTag*> (last_item))->node; @@ -913,16 +913,16 @@ void StructTreeView::copySelectedItems(QListViewItem* parent, QListViewItem* aft write->docUndoRedo->addNewModifsSet(modifs, undoRedo::NodeTreeModif, 0, false); } -void StructTreeView::moveSelectedItems(QListViewItem* parent, QListViewItem* after) +void StructTreeView::moveSelectedItems(TQListViewItem* parent, TQListViewItem* after) { StructTreeTag* parent_item = dynamic_cast<StructTreeTag*> (parent); StructTreeTag* after_item = dynamic_cast<StructTreeTag*> (after); if(!parent_item || !after_item) return; - QPtrList<QListViewItem> selected_items = selectedItems(false); - QListViewItem* first_item = selected_items.getFirst(); - QListViewItem* last_item = selected_items.getLast(); + TQPtrList<TQListViewItem> selected_items = selectedItems(false); + TQListViewItem* first_item = selected_items.getFirst(); + TQListViewItem* last_item = selected_items.getLast(); Node* start_node = (dynamic_cast<StructTreeTag*> (first_item))->node; Node* end_node = (dynamic_cast<StructTreeTag*> (last_item))->node; @@ -954,24 +954,24 @@ void StructTreeView::moveSelectedItems(QListViewItem* parent, QListViewItem* aft /** The treeview DTD has changed to id. */ void StructTreeView::slotDTDChanged(int id) { - QString text = dtdMenu->text(id); + TQString text = dtdMenu->text(id); if (dtdMenu->indexOf(id) > 0) { - QString dtdName = DTDs::ref()->getDTDNameFromNickName(text); + TQString dtdName = DTDs::ref()->getDTDNameFromNickName(text); emit showGroupsForDTEP(dtdName, !dtdMenu->isItemChecked(id)); } else emit showGroupsForDTEP("clear", true); } -void StructTreeView::setParsingDTDs(const QStringList &parsingDTDList) +void StructTreeView::setParsingDTDs(const TQStringList &parsingDTDList) { m_parsingDTDList.clear(); for (uint i = 0; i < dtdList.count(); i++) { dtdMenu->setItemChecked(i, false); } - QString dtdNickName; - for (QStringList::ConstIterator it = parsingDTDList.constBegin(); it != parsingDTDList.constEnd(); ++it) + TQString dtdNickName; + for (TQStringList::ConstIterator it = parsingDTDList.constBegin(); it != parsingDTDList.constEnd(); ++it) { dtdNickName = DTDs::ref()->getDTDNickNameFromName(*it); for (uint i = 0; i < dtdList.count(); i++) @@ -988,7 +988,7 @@ void StructTreeView::slotOpenFile() StructTreeTag *item = dynamic_cast<StructTreeTag*>(currentItem()); if (!m_dirty && item->node) { - QString text = item->groupTag->name; + TQString text = item->groupTag->name; text.remove(item->fileNameRx); KURL baseUrl = QExtFileInfo::path(write->url()); KURL url = baseUrl; @@ -1014,16 +1014,16 @@ void StructTreeView::slotNodeTreeChanged() m_dirty = true; } -void StructTreeView::showMessage(const QString& message) +void StructTreeView::showMessage(const TQString& message) { emit showProblemMessage(message); } -void StructTreeView::slotMouseClickedVPL(int /*button*/, QListViewItem* item, const QPoint&, int) +void StructTreeView::slotMouseClickedVPL(int /*button*/, TQListViewItem* item, const TQPoint&, int) { ViewManager::ref()->activeView()->setFocus(); - QPtrList<QListViewItem> selected_items = selectedItems(true); + TQPtrList<TQListViewItem> selected_items = selectedItems(true); if(selected_items.count() == 1) { StructTreeTag* tag_item = dynamic_cast<StructTreeTag*> (item); @@ -1049,7 +1049,7 @@ void StructTreeView::slotMouseClickedVPL(int /*button*/, QListViewItem* item, co void StructTreeView::slotRemoveTags() { - QPtrList<QListViewItem> selected_items = selectedItems(true); + TQPtrList<TQListViewItem> selected_items = selectedItems(true); Node* start_node = (dynamic_cast<StructTreeTag*> (selected_items.getFirst()))->node; Node* end_node = start_node; |