diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-27 00:40:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-27 00:40:29 +0000 |
commit | 7a741e43ff09e70396a918956219b8316c48e522 (patch) | |
tree | 3d0f60eccd59786cea7236db2d5c4c1f25874515 /src/dolphiniconsview.cpp | |
parent | a48487ef0c329434b58b6f920111bb0999f1109e (diff) | |
download | dolphin-7a741e43ff09e70396a918956219b8316c48e522.tar.gz dolphin-7a741e43ff09e70396a918956219b8316c48e522.zip |
TQt4 port Dolphin
This enables compilation under Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/dolphin@1229359 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/dolphiniconsview.cpp')
-rw-r--r-- | src/dolphiniconsview.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 7a2489b..7ddc762 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -19,13 +19,13 @@ ***************************************************************************/ #include "dolphiniconsview.h" -#include <qpainter.h> +#include <tqpainter.h> #include <kiconeffect.h> #include <kapplication.h> -#include <qobjectlist.h> +#include <tqobjectlist.h> #include <kglobalsettings.h> #include <kurldrag.h> -#include <qclipboard.h> +#include <tqclipboard.h> #include <assert.h> #include <kaction.h> #include <kstdaction.h> @@ -38,35 +38,35 @@ #include "dolphinsettings.h" #include "dolphiniconsviewsettings.h" -DolphinIconsView::DolphinIconsView(DolphinView* parent, LayoutMode layoutMode) : - KFileIconView(parent, 0), +DolphinIconsView::DolphinIconsView(DolphinView* tqparent, LayoutMode tqlayoutMode) : + KFileIconView(tqparent, 0), m_previewIconSize(-1), - m_layoutMode(layoutMode), - m_dolphinView(parent) + m_tqlayoutMode(tqlayoutMode), + m_dolphinView(tqparent) { setAcceptDrops(true); setMode(KIconView::Execute); setSelectionMode(KFile::Extended); Dolphin& dolphin = Dolphin::mainWin(); - connect(this, SIGNAL(onItem(QIconViewItem*)), - this, SLOT(slotOnItem(QIconViewItem*))); - connect(this, SIGNAL(onViewport()), - this, SLOT(slotOnViewport())); - connect(this, SIGNAL(contextMenuRequested(QIconViewItem*, const QPoint&)), - this, SLOT(slotContextMenuRequested(QIconViewItem*, const QPoint&))); - connect(this, SIGNAL(selectionChanged()), - &dolphin, SLOT(slotSelectionChanged())); - connect(&dolphin, SIGNAL(activeViewChanged()), - this, SLOT(slotActivationUpdate())); - connect(this, SIGNAL(itemRenamed(QIconViewItem*, const QString&)), - this, SLOT(slotItemRenamed(QIconViewItem*, const QString&))); - connect(this, SIGNAL(dropped(QDropEvent*, const KURL::List&, const KURL&)), - parent, SLOT(slotURLListDropped(QDropEvent*, const KURL::List&, const KURL&))); - - QClipboard* clipboard = QApplication::clipboard(); - connect(clipboard, SIGNAL(dataChanged()), - this, SLOT(slotUpdateDisabledItems())); + connect(this, TQT_SIGNAL(onItem(TQIconViewItem*)), + this, TQT_SLOT(slotOnItem(TQIconViewItem*))); + connect(this, TQT_SIGNAL(onViewport()), + this, TQT_SLOT(slotOnViewport())); + connect(this, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*, const TQPoint&)), + this, TQT_SLOT(slotContextMenuRequested(TQIconViewItem*, const TQPoint&))); + connect(this, TQT_SIGNAL(selectionChanged()), + &dolphin, TQT_SLOT(slotSelectionChanged())); + connect(&dolphin, TQT_SIGNAL(activeViewChanged()), + this, TQT_SLOT(slotActivationUpdate())); + connect(this, TQT_SIGNAL(itemRenamed(TQIconViewItem*, const TQString&)), + this, TQT_SLOT(slotItemRenamed(TQIconViewItem*, const TQString&))); + connect(this, TQT_SIGNAL(dropped(TQDropEvent*, const KURL::List&, const KURL&)), + tqparent, TQT_SLOT(slotURLListDropped(TQDropEvent*, const KURL::List&, const KURL&))); + + TQClipboard* clipboard = TQApplication::tqclipboard(); + connect(clipboard, TQT_SIGNAL(dataChanged()), + this, TQT_SLOT(slotUpdateDisabledItems())); // KFileIconView creates two actions for zooming, which are directly connected to the // slots KFileIconView::zoomIn() and KFileIconView::zoomOut(). As this behavior is not @@ -81,7 +81,7 @@ DolphinIconsView::DolphinIconsView(DolphinView* parent, LayoutMode layoutMode) : setItemsMovable(true); setWordWrapIconText(true); - if (m_layoutMode == Previews) { + if (m_tqlayoutMode == Previews) { showPreviews(); } refreshSettings(); @@ -93,8 +93,8 @@ DolphinIconsView::~DolphinIconsView() void DolphinIconsView::setLayoutMode(LayoutMode mode) { - if (m_layoutMode != mode) { - m_layoutMode = mode; + if (m_tqlayoutMode != mode) { + m_tqlayoutMode = mode; refreshSettings(); } } @@ -111,7 +111,7 @@ void DolphinIconsView::endItemUpdates() // has been finished. Using a delay of 300 ms is a temporary workaround // until the DolphinIconsView will implement the previews by it's own in // future releases. - QTimer::singleShot(300, this, SLOT(slotUpdateDisabledItems())); + TQTimer::singleShot(300, this, TQT_SLOT(slotUpdateDisabledItems())); const KFileIconViewItem* item = static_cast<const KFileIconViewItem*>(firstItem()); if (item != 0) { @@ -119,7 +119,7 @@ void DolphinIconsView::endItemUpdates() } int index = 0; - const QValueList<URLNavigator::HistoryElem> history = m_dolphinView->urlHistory(index); + const TQValueList<URLNavigator::HistoryElem> history = m_dolphinView->urlHistory(index); if (!history.isEmpty()) { KFileView* fileView = static_cast<KFileView*>(this); fileView->setCurrentItem(history[index].currentFileName()); @@ -129,15 +129,15 @@ void DolphinIconsView::endItemUpdates() void DolphinIconsView::refreshSettings() { - const DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_layoutMode); + const DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_tqlayoutMode); assert(settings != 0); setIconSize(settings->iconSize()); - const QIconView::Arrangement arrangement = settings->arrangement(); - const QIconView::ItemTextPos textPos = (arrangement == QIconView::LeftToRight) ? - QIconView::Bottom : - QIconView::Right; + const TQIconView::Arrangement arrangement = settings->arrangement(); + const TQIconView::ItemTextPos textPos = (arrangement == TQIconView::LeftToRight) ? + TQIconView::Bottom : + TQIconView::Right; setArrangement(arrangement); setItemTextPos(textPos); @@ -145,13 +145,13 @@ void DolphinIconsView::refreshSettings() setGridY(settings->gridHeight()); setSpacing(settings->gridSpacing()); - QFont adjustedFont(font()); + TQFont adjustedFont(font()); adjustedFont.setFamily(settings->fontFamily()); adjustedFont.setPointSize(settings->fontSize()); setFont(adjustedFont); setIconTextHeight(settings->textlinesCount()); - if (m_layoutMode == Previews) { + if (m_tqlayoutMode == Previews) { // There is no getter method for the current size in KFileIconView. To // prevent a flickering the current size is stored in m_previewIconSize and // setPreviewSize is only invoked if the size really has changed. @@ -168,13 +168,13 @@ void DolphinIconsView::refreshSettings() void DolphinIconsView::zoomIn() { if (isZoomInPossible()) { - DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_layoutMode); + DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_tqlayoutMode); const int textWidthHint = settings->textWidthHint(); const int iconSize = increasedIconSize(settings->iconSize()); settings->setIconSize(iconSize); - if (m_layoutMode == Previews) { + if (m_tqlayoutMode == Previews) { const int previewSize = increasedIconSize(settings->previewSize()); settings->setPreviewSize(previewSize); } @@ -187,13 +187,13 @@ void DolphinIconsView::zoomIn() void DolphinIconsView::zoomOut() { if (isZoomOutPossible()) { - DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_layoutMode); + DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_tqlayoutMode); const int textWidthHint = settings->textWidthHint(); const int iconSize = decreasedIconSize(settings->iconSize()); settings->setIconSize(iconSize); - if (m_layoutMode == Previews) { + if (m_tqlayoutMode == Previews) { const int previewSize = decreasedIconSize(settings->previewSize()); settings->setPreviewSize(previewSize); } @@ -205,14 +205,14 @@ void DolphinIconsView::zoomOut() bool DolphinIconsView::isZoomInPossible() const { - DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_layoutMode); - const int size = (m_layoutMode == Icons) ? settings->iconSize() : settings->previewSize(); + DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_tqlayoutMode); + const int size = (m_tqlayoutMode == Icons) ? settings->iconSize() : settings->previewSize(); return size < KIcon::SizeEnormous; } bool DolphinIconsView::isZoomOutPossible() const { - DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_layoutMode); + DolphinIconsViewSettings* settings = DolphinSettings::instance().iconsView(m_tqlayoutMode); return settings->iconSize() > KIcon::SizeSmall; } @@ -221,21 +221,21 @@ void DolphinIconsView::arrangeItemsInGrid( bool updated ) KFileIconView::arrangeItemsInGrid(updated); - if (m_layoutMode == Previews) { + if (m_tqlayoutMode == Previews) { // The class KFileIconView has a bug when the size of the previews differs from the size // of the icons: For specific MIME types the y-position and the height is calculated in // a wrong manner. The following code bypasses this issue. No bugreport has been submitted // as this functionality is not used by any KDE3 application and the core developers are // busy enough for KDE4 now :-) - KFileIconViewItem* item = static_cast<KFileIconViewItem*>(QIconView::firstItem()); - QString mimetype; + KFileIconViewItem* item = static_cast<KFileIconViewItem*>(TQIconView::firstItem()); + TQString mimetype; while (item != 0) { mimetype = item->fileInfo()->mimetype(); - const bool fixSize = mimetype.contains("text") || - mimetype.contains("application/x-"); + const bool fixSize = mimetype.tqcontains("text") || + mimetype.tqcontains("application/x-"); if (fixSize) { - item->setPixmapSize(QSize(m_previewIconSize, m_previewIconSize)); + item->setPixmapSize(TQSize(m_previewIconSize, m_previewIconSize)); } item = static_cast<KFileIconViewItem *>(item->nextItem()); } @@ -243,12 +243,12 @@ void DolphinIconsView::arrangeItemsInGrid( bool updated ) } void DolphinIconsView::setContextPixmap(void* context, - const QPixmap& pixmap) + const TQPixmap& pixmap) { reinterpret_cast<KFileIconViewItem*>(context)->setPixmap(pixmap); } -const QPixmap* DolphinIconsView::contextPixmap(void* context) +const TQPixmap* DolphinIconsView::contextPixmap(void* context) { return reinterpret_cast<KFileIconViewItem*>(context)->pixmap(); } @@ -269,7 +269,7 @@ KFileItem* DolphinIconsView::contextFileInfo(void* context) return reinterpret_cast<KFileIconViewItem*>(context)->fileInfo(); } -void DolphinIconsView::contentsMousePressEvent(QMouseEvent* event) +void DolphinIconsView::contentsMousePressEvent(TQMouseEvent* event) { KFileIconView::contentsMousePressEvent(event); resetActivatedItem(); @@ -277,7 +277,7 @@ void DolphinIconsView::contentsMousePressEvent(QMouseEvent* event) m_dolphinView->statusBar()->clear(); } -void DolphinIconsView::contentsMouseReleaseEvent(QMouseEvent* event) +void DolphinIconsView::contentsMouseReleaseEvent(TQMouseEvent* event) { KFileIconView::contentsMouseReleaseEvent(event); @@ -287,18 +287,18 @@ void DolphinIconsView::contentsMouseReleaseEvent(QMouseEvent* event) Dolphin::mainWin().slotSelectionChanged(); } -void DolphinIconsView::drawBackground(QPainter* painter, const QRect& rect) +void DolphinIconsView::drawBackground(TQPainter* painter, const TQRect& rect) { if (m_dolphinView->isActive()) { KFileIconView::drawBackground(painter, rect); } else { - const QBrush brush(colorGroup().background()); + const TQBrush brush(tqcolorGroup().background()); painter->fillRect(0, 0, width(), height(), brush); } } -QDragObject* DolphinIconsView::dragObject() +TQDragObject* DolphinIconsView::dragObject() { KURL::List urls; KFileItemListIterator it(*KFileView::selectedItems()); @@ -307,7 +307,7 @@ QDragObject* DolphinIconsView::dragObject() ++it; } - QPixmap pixmap; + TQPixmap pixmap; if(urls.count() > 1) { pixmap = DesktopIcon("kmultiple", iconSize()); } @@ -322,12 +322,12 @@ QDragObject* DolphinIconsView::dragObject() pixmap = currentFileItem()->pixmap(iconSize()); } - QDragObject* dragObj = new KURLDrag(urls, widget()); + TQDragObject* dragObj = new KURLDrag(urls, widget()); dragObj->setPixmap(pixmap); return dragObj; } -void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event) +void DolphinIconsView::contentsDragEnterEvent(TQDragEnterEvent* event) { // TODO: The method KFileIconView::contentsDragEnterEvent() does // not allow drag and drop inside itself, which prevents the possability @@ -343,9 +343,9 @@ void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event) } const bool accept = KURLDrag::canDecode(event) && - (event->action() == QDropEvent::Copy || - event->action() == QDropEvent::Move || - event->action() == QDropEvent::Link ); + (event->action() == TQDropEvent::Copy || + event->action() == TQDropEvent::Move || + event->action() == TQDropEvent::Link ); if (accept) { event->acceptAction(); } @@ -354,13 +354,13 @@ void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event) } } -void DolphinIconsView::contentsDragMoveEvent(QDragMoveEvent* event) +void DolphinIconsView::contentsDragMoveEvent(TQDragMoveEvent* event) { KFileIconView::contentsDragMoveEvent(event); // If a dragging is done above a directory, show the icon as 'active' for // a visual feedback - KFileIconViewItem* item = static_cast<KFileIconViewItem*>(findItem(contentsToViewport(event->pos()))); + KFileIconViewItem* item = static_cast<KFileIconViewItem*>(tqfindItem(contentsToViewport(event->pos()))); bool showActive = false; if (item != 0) { @@ -376,7 +376,7 @@ void DolphinIconsView::contentsDragMoveEvent(QDragMoveEvent* event) } } -void DolphinIconsView::contentsDropEvent(QDropEvent* event) +void DolphinIconsView::contentsDropEvent(TQDropEvent* event) { // TODO: Most of the following code is a copy of // KFileIconView::contentsDropEvent. See comment in @@ -387,11 +387,11 @@ void DolphinIconsView::contentsDropEvent(QDropEvent* event) return; } - KFileIconViewItem* item = static_cast<KFileIconViewItem*>(findItem(contentsToViewport(event->pos()))); + KFileIconViewItem* item = static_cast<KFileIconViewItem*>(tqfindItem(contentsToViewport(event->pos()))); const bool accept = KURLDrag::canDecode(event) && - (event->action() == QDropEvent::Copy || - event->action() == QDropEvent::Move || - event->action() == QDropEvent::Link ) && + (event->action() == TQDropEvent::Copy || + event->action() == TQDropEvent::Move || + event->action() == TQDropEvent::Link ) && (item != 0); if (!accept) { return; @@ -410,7 +410,7 @@ void DolphinIconsView::contentsDropEvent(QDropEvent* event) } } -void DolphinIconsView::slotOnItem(QIconViewItem* item) +void DolphinIconsView::slotOnItem(TQIconViewItem* item) { assert(item != 0); activateItem(reinterpret_cast<void*>(item)); @@ -425,8 +425,8 @@ void DolphinIconsView::slotOnViewport() m_dolphinView->requestItemInfo(KURL()); } -void DolphinIconsView::slotContextMenuRequested(QIconViewItem* item, - const QPoint& pos) +void DolphinIconsView::slotContextMenuRequested(TQIconViewItem* item, + const TQPoint& pos) { KFileItem* fileInfo = 0; if (item != 0) { @@ -435,8 +435,8 @@ void DolphinIconsView::slotContextMenuRequested(QIconViewItem* item, m_dolphinView->openContextMenu(fileInfo, pos); } -void DolphinIconsView::slotItemRenamed(QIconViewItem* item, - const QString& name) +void DolphinIconsView::slotItemRenamed(TQIconViewItem* item, + const TQString& name) { KFileItem* fileInfo = static_cast<KFileIconViewItem*>(item)->fileInfo(); m_dolphinView->rename(KURL(fileInfo->url()), name); @@ -447,17 +447,17 @@ void DolphinIconsView::slotActivationUpdate() update(); // TODO: there must be a simpler way to say - // "update all children" - const QObjectList* list = children(); - if (list == 0) { + // "update all tqchildren" + const TQObjectList list = childrenListObject(); + if (list.isEmpty()) { return; } - QObjectListIterator it(*list); - QObject* object = 0; + TQObjectListIterator it(list); + TQObject* object = 0; while ((object = it.current()) != 0) { - if (object->inherits("QWidget")) { - QWidget* widget = static_cast<QWidget*>(object); + if (object->inherits(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget* widget = TQT_TQWIDGET(object); widget->update(); } ++it; |