diff options
| author | Peter Penz <[email protected]> | 2007-03-27 19:08:44 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-03-27 19:08:44 +0000 |
| commit | fd060ce7f67a95b1e3f41d3ff091595f34704920 (patch) | |
| tree | b5735e2c268b8461ede653ab2dfe83318122e42e /src/dolphincolumnview.cpp | |
| parent | 3546be263253a3982077122fb861ebfb64d7de1d (diff) | |
Initial version for a column view support (thanks a lot to Benjamin Meyer for QColumnView in Qt4.3!). Currently there is a problem when using the DolphinSortFilterProxyModel: some items get duplicated, but I doubt it's an issue in QColumnView (the same issue occurs when using QTreeView) -> further investigations necessary...
svn path=/trunk/KDE/kdebase/apps/; revision=647234
Diffstat (limited to 'src/dolphincolumnview.cpp')
| -rw-r--r-- | src/dolphincolumnview.cpp | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp new file mode 100644 index 000000000..41fb89f97 --- /dev/null +++ b/src/dolphincolumnview.cpp @@ -0,0 +1,134 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz ([email protected]) * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphincolumnview.h" + +#include "dolphincontroller.h" +#include "dolphinsettings.h" + +//#include "dolphin_iconsmodesettings.h" + +#include <kdirmodel.h> +#include <kfileitem.h> +#include <kfileitemdelegate.h> + +#include <QAbstractProxyModel> +#include <QPoint> + +DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* controller) : + QColumnView(parent), + m_controller(controller) +{ + Q_ASSERT(controller != 0); + + viewport()->setAttribute(Qt::WA_Hover); + + connect(this, SIGNAL(clicked(const QModelIndex&)), + controller, SLOT(triggerItem(const QModelIndex&))); + connect(this, SIGNAL(activated(const QModelIndex&)), + controller, SLOT(triggerItem(const QModelIndex&))); + connect(controller, SIGNAL(showPreviewChanged(bool)), + this, SLOT(updateGridSize(bool))); + connect(controller, SIGNAL(zoomIn()), + this, SLOT(zoomIn())); + connect(controller, SIGNAL(zoomOut()), + this, SLOT(zoomOut())); + + // apply the icons mode settings to the widget + //const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + //Q_ASSERT(settings != 0); + + m_viewOptions = QColumnView::viewOptions(); + + /*QFont font(settings->fontFamily(), settings->fontSize()); + font.setItalic(settings->italicFont()); + font.setBold(settings->boldFont()); + m_viewOptions.font = font; + + updateGridSize(controller->showPreview()); + + if (settings->arrangement() == QColumnView::TopToBottom) { + setFlow(QColumnView::LeftToRight); + m_viewOptions.decorationPosition = QStyleOptionViewItem::Top; + } + else { + setFlow(QColumnView::TopToBottom); + m_viewOptions.decorationPosition = QStyleOptionViewItem::Left; + }*/ +} + +DolphinColumnView::~DolphinColumnView() +{ +} + +QStyleOptionViewItem DolphinColumnView::viewOptions() const +{ + return m_viewOptions; +} + +void DolphinColumnView::contextMenuEvent(QContextMenuEvent* event) +{ + QColumnView::contextMenuEvent(event); + m_controller->triggerContextMenuRequest(event->pos()); +} + +void DolphinColumnView::mouseReleaseEvent(QMouseEvent* event) +{ + QColumnView::mouseReleaseEvent(event); + m_controller->triggerActivation(); +} + +void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event) +{ + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } +} + +void DolphinColumnView::dropEvent(QDropEvent* event) +{ + const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); + if (!urls.isEmpty()) { + m_controller->indicateDroppedUrls(urls, + indexAt(event->pos()), + event->source()); + event->acceptProposedAction(); + } + QColumnView::dropEvent(event); +} + +void DolphinColumnView::zoomIn() +{ +} + +void DolphinColumnView::zoomOut() +{ +} + +bool DolphinColumnView::isZoomInPossible() const +{ + return false; +} + +bool DolphinColumnView::isZoomOutPossible() const +{ + return false; +} + +#include "dolphincolumnview.moc" |
