diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /quanta/treeviews/structtreeview.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/treeviews/structtreeview.cpp')
-rw-r--r-- | quanta/treeviews/structtreeview.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/quanta/treeviews/structtreeview.cpp b/quanta/treeviews/structtreeview.cpp index 1f22e594..00c78845 100644 --- a/quanta/treeviews/structtreeview.cpp +++ b/quanta/treeviews/structtreeview.cpp @@ -57,8 +57,8 @@ #include "structtreeview.moc" extern GroupElementMapList globalGroupMap; -StructTreeView::StructTreeView(TQWidget *parent, const char *name ) - : KListView(parent,name), m_marker(0), m_draggedItem(0)/*, m_thisWidget(0)*/ +StructTreeView::StructTreeView(TQWidget *tqparent, const char *name ) + : KListView(tqparent,name), m_marker(0), m_draggedItem(0)/*, m_thisWidget(0)*/ { for (int i = 0; i < 15; i++) groupOpened.append(false); @@ -83,7 +83,7 @@ StructTreeView::StructTreeView(TQWidget *parent, const char *name ) setLineWidth( 2 ); addColumn( i18n("Name"), -1 ); - setFocusPolicy(TQWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); dtdMenu = new KPopupMenu(this); @@ -159,7 +159,7 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) Node *currentNode = baseNode; StructTreeTag *currentItem = top; //after this StructTreeTag *item = 0L; - StructTreeTag *parentItem = top; //under this + StructTreeTag *tqparentItem = top; //under this int level = 0; TQString title; TQString tagStr; @@ -219,7 +219,7 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) if (!groupOnly) { title = ""; - item = new StructTreeTag(parentItem, currentNode, title, currentItem); + item = new StructTreeTag(tqparentItem, currentNode, title, currentItem); item->setOpen(level < openLevel); currentNode->mainListItem = item; @@ -236,14 +236,14 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) 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)) + if (!groupIds.tqcontains(groupElement->group->name + dtd->name)) continue; StructTreeTag *groupItem = groups[groupIds[groupElement->group->name + dtd->name]]; TQListViewItem* insertAfter = 0L; TQListViewItem* insertUnder = groupItem; - if (groupItems.contains(groupElement->group->name + groupElement->tag->name)) + if (groupItems.tqcontains(groupElement->group->name + groupElement->tag->name)) insertUnder = groupItems[groupElement->group->name + groupElement->tag->name]; - if (lastItemInGroup.contains(groupElement->group->name)) + if (lastItemInGroup.tqcontains(groupElement->group->name)) insertAfter = lastItemInGroup[groupElement->group->name]; StructTreeTag *item = new StructTreeTag(static_cast<StructTreeTag*>(insertUnder), currentNode, groupElement->tag->name, insertAfter); @@ -264,7 +264,7 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) if (currentNode->child) { currentNode = currentNode->child; - parentItem = item; + tqparentItem = item; currentItem = 0L; level++; } else @@ -276,35 +276,35 @@ void StructTreeView::buildTree(Node *baseNode, int openLevel, bool groupOnly) currentItem = item; } else { - //go up some levels, to the parent, if the node has no child or next + //go up some levels, to the tqparent, if the node has no child or next while (currentNode) { level--; - //parentItem = dynamic_cast<StructTreeTag*>(parentItem->parent()); - if (currentNode->parent && currentNode->parent->next) + //tqparentItem = dynamic_cast<StructTreeTag*>(tqparentItem->tqparent()); + if (currentNode->tqparent && currentNode->tqparent->next) { - currentNode = currentNode->parent->next; + currentNode = currentNode->tqparent->next; break; } else { - currentNode = currentNode->parent; + currentNode = currentNode->tqparent; } } if (!groupOnly && currentNode) { if (currentNode->prev) currentItem = static_cast<StructTreeTag*>(currentNode->prev->mainListItem); - if (currentNode->parent) + if (currentNode->tqparent) { - parentItem = static_cast<StructTreeTag*>(currentNode->parent->mainListItem); - if (!parentItem) + tqparentItem = static_cast<StructTreeTag*>(currentNode->tqparent->mainListItem); + if (!tqparentItem) { - parentItem = top; + tqparentItem = top; } } else { - parentItem = top; + tqparentItem = top; } } @@ -376,7 +376,7 @@ void StructTreeView::deleteList(bool groupOnly) groupsCount = 0; } -/** repaint document structure */ +/** tqrepaint document structure */ void StructTreeView::slotReparse(Document *w, Node* node, int openLevel, bool groupOnly) { timer->restart(); @@ -505,7 +505,7 @@ void StructTreeView::slotMouseClicked(int button, TQListViewItem *item, const TQ setOpen(item, !isOpen(item)); setSelected(item, true); - bool const ctrlPressed = KApplication::keyboardMouseState() & Qt::ControlButton; + bool const ctrlPressed = KApplication::keyboardMouseState() & TQt::ControlButton; if(ctrlPressed) setContiguousSelectedItems(); @@ -764,9 +764,9 @@ bool StructTreeView::acceptDrag(TQDropEvent* e) const { e->accept(last_accept); /* if(last_accept) - m_thisWidget->setCursor(Qt::ForbiddenCursor); + m_thisWidget->setCursor(TQt::ForbiddenCursor); else - m_thisWidget->setCursor(Qt::ForbiddenCursor);*/ + m_thisWidget->setCursor(TQt::ForbiddenCursor);*/ kdDebug(25001) << "Princ�io: " << last_accept << endl; return last_accept; @@ -780,9 +780,9 @@ bool StructTreeView::acceptDrag(TQDropEvent* e) const e->accept(false); last_accept = false; /* if(last_accept) - m_thisWidget->setCursor(Qt::ForbiddenCursor); + m_thisWidget->setCursor(TQt::ForbiddenCursor); else - m_thisWidget->setCursor(Qt::ForbiddenCursor);*/ + m_thisWidget->setCursor(TQt::ForbiddenCursor);*/ kdDebug(25001) << "PROIBIDO! #1" << endl; return false; } @@ -794,14 +794,14 @@ bool StructTreeView::acceptDrag(TQDropEvent* e) const e->accept(false); last_accept = false; /* if(last_accept) - m_thisWidget->setCursor(Qt::ForbiddenCursor); + m_thisWidget->setCursor(TQt::ForbiddenCursor); else - m_thisWidget->setCursor(Qt::ForbiddenCursor);*/ + m_thisWidget->setCursor(TQt::ForbiddenCursor);*/ kdDebug(25001) << "PROIBIDO! #2" << endl; return false; } - QTag* nodeQTag = QuantaCommon::tagFromDTD(after_node->parent); - bool is_child = (nodeQTag && nodeQTag->isChild(dragged_node)); + TQTag* nodeTQTag = QuantaCommon::tagFromDTD(after_node->tqparent); + bool is_child = (nodeTQTag && nodeTQTag->isChild(dragged_node)); if(!is_child) kdDebug(25001) << "PROIBIDO! #3" << endl; @@ -811,14 +811,14 @@ bool StructTreeView::acceptDrag(TQDropEvent* e) const e->accept(is_child); last_accept = is_child; // if(last_accept) -// m_thisWidget->setCursor(Qt::ForbiddenCursor); +// m_thisWidget->setCursor(TQt::ForbiddenCursor); // else -// m_thisWidget->setCursor(Qt::ForbiddenCursor); +// m_thisWidget->setCursor(TQt::ForbiddenCursor); return is_child; } -void StructTreeView::slotDropped(TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after) +void StructTreeView::slotDropped(TQDropEvent* e, TQListViewItem* tqparent, TQListViewItem* after) { if(!e) return; @@ -837,10 +837,10 @@ void StructTreeView::slotDropped(TQDropEvent* e, TQListViewItem* parent, TQListV switch(id) { case DRAG_COPY: - copySelectedItems(parent, after); + copySelectedItems(tqparent, after); break; case DRAG_MOVE: - moveSelectedItems(parent, after); + moveSelectedItems(tqparent, after); break; case DRAG_CANCEL: // cancelled by menuitem break; @@ -866,7 +866,7 @@ void StructTreeView::startDrag() void StructTreeView::contentsMousePressEvent(TQMouseEvent* e) { - if(e->button() == LeftButton) + if(e->button() == Qt::LeftButton) { TQPoint p = contentsToViewport(e->pos()); m_draggedItem = itemAt(p); @@ -875,11 +875,11 @@ void StructTreeView::contentsMousePressEvent(TQMouseEvent* e) KListView::contentsMousePressEvent(e); } -void StructTreeView::copySelectedItems(TQListViewItem* parent, TQListViewItem* after) +void StructTreeView::copySelectedItems(TQListViewItem* tqparent, TQListViewItem* after) { - StructTreeTag* parent_item = dynamic_cast<StructTreeTag*> (parent); + StructTreeTag* tqparent_item = dynamic_cast<StructTreeTag*> (tqparent); StructTreeTag* after_item = dynamic_cast<StructTreeTag*> (after); - if(!parent_item/* || !after_item*/) // can happen if the element is inserted as the first child + if(!tqparent_item/* || !after_item*/) // can happen if the element is inserted as the first child return; TQPtrList<TQListViewItem> selected_items = selectedItems(false); @@ -896,28 +896,28 @@ void StructTreeView::copySelectedItems(TQListViewItem* parent, TQListViewItem* a else start_node_subtree = kafkaCommon::getNodeSubtree(start_node, 0, end_node, end_node->tag->tagStr().length()); - Node* parent_node = parent_item->node; - if(!parent_node) + Node* tqparent_node = tqparent_item->node; + if(!tqparent_node) return; Node* next_node = 0; if(after_item) next_node = after_item->node->SNext(); else - next_node = parent_node->firstChild(); + next_node = tqparent_node->firstChild(); NodeSelection cursor_holder; NodeModifsSet *modifs = new NodeModifsSet(); - kafkaCommon::DTDInsertNodeSubtree(start_node_subtree, parent_node, next_node, cursor_holder, modifs); + kafkaCommon::DTDInsertNodeSubtree(start_node_subtree, tqparent_node, next_node, cursor_holder, modifs); write->docUndoRedo->addNewModifsSet(modifs, undoRedo::NodeTreeModif, 0, false); } -void StructTreeView::moveSelectedItems(TQListViewItem* parent, TQListViewItem* after) +void StructTreeView::moveSelectedItems(TQListViewItem* tqparent, TQListViewItem* after) { - StructTreeTag* parent_item = dynamic_cast<StructTreeTag*> (parent); + StructTreeTag* tqparent_item = dynamic_cast<StructTreeTag*> (tqparent); StructTreeTag* after_item = dynamic_cast<StructTreeTag*> (after); - if(!parent_item || !after_item) + if(!tqparent_item || !after_item) return; TQPtrList<TQListViewItem> selected_items = selectedItems(false); @@ -939,14 +939,14 @@ void StructTreeView::moveSelectedItems(TQListViewItem* parent, TQListViewItem* a start_node_subtree = kafkaCommon::DTDExtractNodeSubtree(start_node, 0, end_node, end_node->tag->tagStr().length(), &cursor_node, cursor_offset, modifs); - Node* parent_node = parent_item->node; - if(!parent_node) + Node* tqparent_node = tqparent_item->node; + if(!tqparent_node) return; Node* next_node = after_item->node->SNext(); NodeSelection cursor_holder(cursor_node, cursor_offset); - kafkaCommon::DTDInsertNodeSubtree(start_node_subtree, parent_node, next_node, cursor_holder, modifs); + kafkaCommon::DTDInsertNodeSubtree(start_node_subtree, tqparent_node, next_node, cursor_holder, modifs); write->docUndoRedo->addNewModifsSet(modifs, undoRedo::NodeTreeModif, &cursor_holder, false); } @@ -979,7 +979,7 @@ void StructTreeView::setParsingDTDs(const TQStringList &parsingDTDList) if (dtdList[i] == dtdNickName) dtdMenu->setItemChecked(i, true); } - m_parsingDTDList.append(DTDs::ref()->find(*it)); + m_parsingDTDList.append(DTDs::ref()->tqfind(*it)); } } @@ -990,11 +990,11 @@ void StructTreeView::slotOpenFile() { TQString text = item->groupTag->name; text.remove(item->fileNameRx); - KURL baseUrl = QExtFileInfo::path(write->url()); + KURL baseUrl = TQExtFileInfo::path(write->url()); KURL url = baseUrl; QuantaCommon::setUrl(url, text.stripWhiteSpace()); - url = QExtFileInfo::toAbsolute(url, baseUrl); - if (QExtFileInfo::exists(url, true, this)) + url = TQExtFileInfo::toAbsolute(url, baseUrl); + if (TQExtFileInfo::exists(url, true, this)) { if (QuantaCommon::checkMimeGroup(url, "text" )) { @@ -1005,7 +1005,7 @@ void StructTreeView::slotOpenFile() emit openImage(url); } } else - KMessageBox::error(this, i18n("<qt>The file <b>%1</b> does not exist or is not a recognized mime type.</qt>").arg(url.prettyURL(0, KURL::StripFileProtocol))); + KMessageBox::error(this, i18n("<qt>The file <b>%1</b> does not exist or is not a recognized mime type.</qt>").tqarg(url.prettyURL(0, KURL::StripFileProtocol))); } } |