diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-03 01:36:58 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-03 01:36:58 +0000 |
commit | d9d0ac84a2b1609ff81b399b81842a15704cbefd (patch) | |
tree | 58c783db373c4633201e5a9716901599c1afad92 /ksquirrel/sidebar/sq_treeview.cpp | |
parent | 63f270d62c4541f1379f0f82f5255a34e5037e00 (diff) | |
download | ksquirrel-d9d0ac84a2b1609ff81b399b81842a15704cbefd.tar.gz ksquirrel-d9d0ac84a2b1609ff81b399b81842a15704cbefd.zip |
TQt4 port ksquirrel
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ksquirrel@1239132 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksquirrel/sidebar/sq_treeview.cpp')
-rw-r--r-- | ksquirrel/sidebar/sq_treeview.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/ksquirrel/sidebar/sq_treeview.cpp b/ksquirrel/sidebar/sq_treeview.cpp index f622384..2a84f49 100644 --- a/ksquirrel/sidebar/sq_treeview.cpp +++ b/ksquirrel/sidebar/sq_treeview.cpp @@ -19,10 +19,10 @@ #include "config.h" #endif -#include <qdir.h> -#include <qheader.h> -#include <qtimer.h> -#include <qcursor.h> +#include <tqdir.h> +#include <tqheader.h> +#include <tqtimer.h> +#include <tqcursor.h> #include <klocale.h> #include <kurldrag.h> @@ -45,57 +45,57 @@ SQ_TreeView * SQ_TreeView::m_instance = 0; -SQ_FileTreeViewBranch::SQ_FileTreeViewBranch(KFileTreeView *parent, const KURL &url, - const QString &name, const QPixmap &pix) : KFileTreeBranch(parent, url, name, pix) +SQ_FileTreeViewBranch::SQ_FileTreeViewBranch(KFileTreeView *tqparent, const KURL &url, + const TQString &name, const TQPixmap &pix) : KFileTreeBranch(tqparent, url, name, pix) {} SQ_FileTreeViewBranch::~SQ_FileTreeViewBranch() {} -KFileTreeViewItem* SQ_FileTreeViewBranch::createTreeViewItem(KFileTreeViewItem *parent, KFileItem *fileItem) +KFileTreeViewItem* SQ_FileTreeViewBranch::createTreeViewItem(KFileTreeViewItem *tqparent, KFileItem *fileItem) { KFileTreeViewItem *tvi = 0; - if(parent && fileItem) - tvi = new SQ_TreeViewItem(parent, fileItem, this); + if(tqparent && fileItem) + tvi = new SQ_TreeViewItem(tqparent, fileItem, this); return tvi; } /******************************************************************************************************/ -SQ_TreeView::SQ_TreeView(QWidget *parent, const char *name) : KFileTreeView(parent, name) +SQ_TreeView::SQ_TreeView(TQWidget *tqparent, const char *name) : KFileTreeView(tqparent, name) { m_instance = this; itemToBeOpened = 0; - m_animTimer = new QTimer(this); - scanTimer = new QTimer(this); + m_animTimer = new TQTimer(this); + scanTimer = new TQTimer(this); m_ignoreClick = false; - connect(m_animTimer, SIGNAL(timeout()), this, SLOT(slotAnimation())); - connect(scanTimer, SIGNAL(timeout()), this, SLOT(slotDelayedScan())); + connect(m_animTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAnimation())); + connect(scanTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotDelayedScan())); dw = 0; m_recurs = No; - lister = new SQ_ThreadDirLister(this); + lister = new SQ_ThreadDirLister(TQT_TQOBJECT(this)); setupRecursion(); - setFrameShape(QFrame::NoFrame); + setFrameShape(TQFrame::NoFrame); addColumn("Name"); addColumn("Check"); header()->hide(); header()->moveSection(1, 0); - setColumnWidthMode(1, QListView::Manual); + setColumnWidthMode(1, TQListView::Manual); setColumnWidth(1, 18); - root = new SQ_FileTreeViewBranch(this, QDir::rootDirPath(), QString::null, + root = new SQ_FileTreeViewBranch(this, TQDir::rootDirPath(), TQString(), SQ_IconLoader::instance()->loadIcon("folder_red", KIcon::Desktop, KIcon::SizeSmall)); // some hacks to create our SQ_TreeViewItem as root item SQ_TreeViewItem *ritem = new SQ_TreeViewItem(this, - new KFileItem(QDir::rootDirPath(), + new KFileItem(TQDir::rootDirPath(), "inode/directory", S_IFDIR), root); @@ -119,14 +119,14 @@ SQ_TreeView::SQ_TreeView(QWidget *parent, const char *name) : KFileTreeView(pare // connect signals // Space and Return will open item - connect(this, SIGNAL(spacePressed(QListViewItem*)), this, SIGNAL(executed(QListViewItem*))); - connect(this, SIGNAL(returnPressed(QListViewItem*)), this, SIGNAL(executed(QListViewItem*))); - connect(this, SIGNAL(currentChanged(QListViewItem *)), this, SLOT(slotCurrentChanged(QListViewItem*))); + connect(this, TQT_SIGNAL(spacePressed(TQListViewItem*)), this, TQT_SIGNAL(executed(TQListViewItem*))); + connect(this, TQT_SIGNAL(returnPressed(TQListViewItem*)), this, TQT_SIGNAL(executed(TQListViewItem*))); + connect(this, TQT_SIGNAL(currentChanged(TQListViewItem *)), this, TQT_SLOT(slotCurrentChanged(TQListViewItem*))); - connect(this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotItemExecuted(QListViewItem*))); - connect(this, SIGNAL(newURL(const KURL&)), this, SLOT(slotNewURL(const KURL&))); - connect(root, SIGNAL(populateFinished(KFileTreeViewItem *)), this, SLOT(slotOpened(KFileTreeViewItem *))); - connect(root, SIGNAL(deleteItem(KFileItem *)), this, SLOT(slotDeleteItemMy(KFileItem *))); + connect(this, TQT_SIGNAL(executed(TQListViewItem*)), this, TQT_SLOT(slotItemExecuted(TQListViewItem*))); + connect(this, TQT_SIGNAL(newURL(const KURL&)), this, TQT_SLOT(slotNewURL(const KURL&))); + connect(root, TQT_SIGNAL(populateFinished(KFileTreeViewItem *)), this, TQT_SLOT(slotOpened(KFileTreeViewItem *))); + connect(root, TQT_SIGNAL(deleteItem(KFileItem *)), this, TQT_SLOT(slotDeleteItemMy(KFileItem *))); setCurrentItem(root->root()); root->setChildRecurse(false); @@ -140,18 +140,18 @@ SQ_TreeView::SQ_TreeView(QWidget *parent, const char *name) : KFileTreeView(pare setAcceptDrops(true); - connect(this, SIGNAL(dropped(QDropEvent *, QListViewItem *, QListViewItem *)), - this, SLOT(slotDropped(QDropEvent *, QListViewItem *, QListViewItem *))); + connect(this, TQT_SIGNAL(dropped(TQDropEvent *, TQListViewItem *, TQListViewItem *)), + this, TQT_SLOT(slotDropped(TQDropEvent *, TQListViewItem *, TQListViewItem *))); - connect(this, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint &)), - this, SLOT(slotContextMenu(KListView *, QListViewItem *, const QPoint &))); + connect(this, TQT_SIGNAL(contextMenu(KListView *, TQListViewItem *, const TQPoint &)), + this, TQT_SLOT(slotContextMenu(KListView *, TQListViewItem *, const TQPoint &))); menu = new SQ_TreeViewMenu(this); if(SQ_HLOptions::instance()->have_directorybasket) { menu->insertSeparator(); - menu->insertItem(i18n("Add to Folder Basket"), this, SLOT(slotAddToFolderBasket())); + menu->insertItem(i18n("Add to Folder Basket"), this, TQT_SLOT(slotAddToFolderBasket())); } } @@ -163,7 +163,7 @@ SQ_TreeView::~SQ_TreeView() delete lister; } -void SQ_TreeView::slotCurrentChanged(QListViewItem *item) +void SQ_TreeView::slotCurrentChanged(TQListViewItem *item) { SQ_TreeViewItem *tvi = static_cast<SQ_TreeViewItem *>(item); @@ -176,7 +176,7 @@ void SQ_TreeView::setRecursion(int b) if(m_recurs == b) return; - QListViewItemIterator it(this); + TQListViewItemIterator it(this); SQ_TreeViewItem *tvi; // ignore root item @@ -185,8 +185,8 @@ void SQ_TreeView::setRecursion(int b) // turn recursion on if(m_recurs == No && b) { - dw = new KDirWatch(this); - connect(dw, SIGNAL(dirty(const QString &)), this, SLOT(slotDirty(const QString &))); + dw = new KDirWatch(TQT_TQOBJECT(this)); + connect(dw, TQT_SIGNAL(dirty(const TQString &)), this, TQT_SLOT(slotDirty(const TQString &))); dw->blockSignals(true); lister->lock(); @@ -239,7 +239,7 @@ void SQ_TreeView::setRecursion(int b) void SQ_TreeView::slotClearChecked() { - QListViewItemIterator it(this); + TQListViewItemIterator it(this); SQ_TreeViewItem *tvi; while(it.current()) @@ -256,7 +256,7 @@ void SQ_TreeView::slotClearChecked() /* * Item executed. Let's pass its url to SQ_WidgetStack (if needed). */ -void SQ_TreeView::slotItemExecuted(QListViewItem *item) +void SQ_TreeView::slotItemExecuted(TQListViewItem *item) { if(!item) return; @@ -328,7 +328,7 @@ void SQ_TreeView::slotNewURL(const KURL &url) KURL last = k; - QString s; + TQString s; // divide url to paths. // for example, "/home/krasu/1/2" will be divided to @@ -382,7 +382,7 @@ bool SQ_TreeView::doSearch() return false; } - QStringList::iterator it = paths.begin(); + TQStringList::iterator it = paths.begin(); KFileTreeViewItem *found = findItem(root, *it); @@ -409,7 +409,7 @@ bool SQ_TreeView::doSearch() /* * On show event load saved url, if any. See emitNewURL(). */ -void SQ_TreeView::showEvent(QShowEvent *) +void SQ_TreeView::showEvent(TQShowEvent *) { // if pending url is valid if(!pendingURL.isEmpty()) @@ -453,7 +453,7 @@ void SQ_TreeView::slotDelayedScan() lister->start(); } -void SQ_TreeView::customEvent(QCustomEvent *e) +void SQ_TreeView::customEvent(TQCustomEvent *e) { if(!e || e->type() != SQ_ItemsEventId) return; @@ -494,7 +494,7 @@ void SQ_TreeView::stopAnimation(KFileTreeViewItem *item) if(!item) return; - int f = m_mapFolders.find(item); + int f = m_mapFolders.tqfind(item); if(f != -1) { @@ -505,7 +505,7 @@ void SQ_TreeView::stopAnimation(KFileTreeViewItem *item) m_animTimer->stop(); } -void SQ_TreeView::viewportResizeEvent(QResizeEvent *) +void SQ_TreeView::viewportResizeEvent(TQResizeEvent *) { setColumnWidth(0, viewport()->width() - columnWidth(1)); triggerUpdate(); @@ -516,26 +516,26 @@ void SQ_TreeView::clearSelection() if(!m_ignoreClick) KFileTreeView::clearSelection(); } -void SQ_TreeView::setSelected(QListViewItem *item, bool selected) +void SQ_TreeView::setSelected(TQListViewItem *item, bool selected) { if(!m_ignoreClick) KFileTreeView::setSelected(item, selected); } -void SQ_TreeView::setCurrentItem(QListViewItem *item) +void SQ_TreeView::setCurrentItem(TQListViewItem *item) { if(!m_ignoreClick) KFileTreeView::setCurrentItem(item); } -void SQ_TreeView::setOpen(QListViewItem *item, bool open) +void SQ_TreeView::setOpen(TQListViewItem *item, bool open) { if(!m_ignoreClick) KFileTreeView::setOpen(item, open); } -void SQ_TreeView::contentsMousePressEvent(QMouseEvent *e) +void SQ_TreeView::contentsMousePressEvent(TQMouseEvent *e) { - QListViewItem *item; + TQListViewItem *item; - QPoint point = e->pos(); + TQPoint point = e->pos(); point.setY(point.y() - contentsY()); if(header()->sectionAt(point.x()) && (item = itemAt(point))) @@ -550,21 +550,21 @@ void SQ_TreeView::contentsMousePressEvent(QMouseEvent *e) toggle(m, true); else { - QListViewItemIterator it(this); + TQListViewItemIterator it(this); - // toggle parent item - if(state == Qt::ShiftButton) toggle(m, true); - else if(state == Qt::ControlButton) toggle(m, false, true); - else if(state == Qt::AltButton) toggle(m, false, false); + // toggle tqparent item + if(state == TQt::ShiftButton) toggle(m, true); + else if(state == TQt::ControlButton) toggle(m, false, true); + else if(state == TQt::AltButton) toggle(m, false, false); SQ_TreeViewItem *tvi = static_cast<SQ_TreeViewItem *>(m->firstChild()); // toggle all child items while(tvi) { - if(state == Qt::ShiftButton) toggle(tvi, false, m->checked()); - else if(state == Qt::ControlButton) toggle(tvi, false, true); - else if(state == Qt::AltButton) toggle(tvi, false, false); + if(state == TQt::ShiftButton) toggle(tvi, false, m->checked()); + else if(state == TQt::ControlButton) toggle(tvi, false, true); + else if(state == TQt::AltButton) toggle(tvi, false, false); tvi = static_cast<SQ_TreeViewItem *>(tvi->nextSibling()); } @@ -579,7 +579,7 @@ void SQ_TreeView::contentsMousePressEvent(QMouseEvent *e) m_ignoreClick = false; } -void SQ_TreeView::contentsMouseDoubleClickEvent(QMouseEvent *e) +void SQ_TreeView::contentsMouseDoubleClickEvent(TQMouseEvent *e) { if(header()->sectionAt(e->x())) m_ignoreClick = true; @@ -609,9 +609,9 @@ void SQ_TreeView::toggle(SQ_TreeViewItem *item, bool togg, bool set) emit urlRemoved(item->url()); } -void SQ_TreeView::slotDropped(QDropEvent *e, QListViewItem *parent, QListViewItem *item) +void SQ_TreeView::slotDropped(TQDropEvent *e, TQListViewItem *tqparent, TQListViewItem *item) { - if(!item) item = parent; + if(!item) item = tqparent; KFileTreeViewItem *cur = static_cast<KFileTreeViewItem *>(item); @@ -621,10 +621,10 @@ void SQ_TreeView::slotDropped(QDropEvent *e, QListViewItem *parent, QListViewIte KURLDrag::decode(e, list); SQ_NavigatorDropMenu::instance()->setupFiles(list, cur->url()); - SQ_NavigatorDropMenu::instance()->exec(QCursor::pos(), true); + SQ_NavigatorDropMenu::instance()->exec(TQCursor::pos(), true); } -void SQ_TreeView::slotContextMenu(KListView *, QListViewItem *item, const QPoint &point) +void SQ_TreeView::slotContextMenu(KListView *, TQListViewItem *item, const TQPoint &point) { if(item) { @@ -635,7 +635,7 @@ void SQ_TreeView::slotContextMenu(KListView *, QListViewItem *item, const QPoint } } -void SQ_TreeView::slotDirty(const QString &path) +void SQ_TreeView::slotDirty(const TQString &path) { KURL url; url.setPath(path); |