]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphincolumnview.cpp
don't connect to non-existent signal
[dolphin.git] / src / dolphincolumnview.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #include "dolphincolumnview.h"
21
22 #include "dolphincontroller.h"
23 #include "dolphinsettings.h"
24
25 //#include "dolphin_iconsmodesettings.h"
26
27 #include <kdirmodel.h>
28 #include <kfileitem.h>
29 #include <kfileitemdelegate.h>
30
31 #include <QAbstractProxyModel>
32 #include <QPoint>
33
34 DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* controller) :
35 QColumnView(parent),
36 m_controller(controller)
37 {
38 Q_ASSERT(controller != 0);
39
40 viewport()->setAttribute(Qt::WA_Hover);
41
42 connect(this, SIGNAL(clicked(const QModelIndex&)),
43 controller, SLOT(triggerItem(const QModelIndex&)));
44 connect(this, SIGNAL(activated(const QModelIndex&)),
45 controller, SLOT(triggerItem(const QModelIndex&)));
46 connect(controller, SIGNAL(zoomIn()),
47 this, SLOT(zoomIn()));
48 connect(controller, SIGNAL(zoomOut()),
49 this, SLOT(zoomOut()));
50
51 // apply the icons mode settings to the widget
52 //const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
53 //Q_ASSERT(settings != 0);
54
55 m_viewOptions = QColumnView::viewOptions();
56
57 /*QFont font(settings->fontFamily(), settings->fontSize());
58 font.setItalic(settings->italicFont());
59 font.setBold(settings->boldFont());
60 m_viewOptions.font = font;
61
62 updateGridSize(controller->showPreview());
63
64 if (settings->arrangement() == QColumnView::TopToBottom) {
65 setFlow(QColumnView::LeftToRight);
66 m_viewOptions.decorationPosition = QStyleOptionViewItem::Top;
67 }
68 else {
69 setFlow(QColumnView::TopToBottom);
70 m_viewOptions.decorationPosition = QStyleOptionViewItem::Left;
71 }*/
72 }
73
74 DolphinColumnView::~DolphinColumnView()
75 {
76 }
77
78 QStyleOptionViewItem DolphinColumnView::viewOptions() const
79 {
80 return m_viewOptions;
81 }
82
83 void DolphinColumnView::contextMenuEvent(QContextMenuEvent* event)
84 {
85 QColumnView::contextMenuEvent(event);
86 m_controller->triggerContextMenuRequest(event->pos());
87 }
88
89 void DolphinColumnView::mouseReleaseEvent(QMouseEvent* event)
90 {
91 QColumnView::mouseReleaseEvent(event);
92 m_controller->triggerActivation();
93 }
94
95 void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event)
96 {
97 if (event->mimeData()->hasUrls()) {
98 event->acceptProposedAction();
99 }
100 }
101
102 void DolphinColumnView::dropEvent(QDropEvent* event)
103 {
104 const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
105 if (!urls.isEmpty()) {
106 m_controller->indicateDroppedUrls(urls,
107 indexAt(event->pos()),
108 event->source());
109 event->acceptProposedAction();
110 }
111 QColumnView::dropEvent(event);
112 }
113
114 void DolphinColumnView::zoomIn()
115 {
116 }
117
118 void DolphinColumnView::zoomOut()
119 {
120 }
121
122 bool DolphinColumnView::isZoomInPossible() const
123 {
124 return false;
125 }
126
127 bool DolphinColumnView::isZoomOutPossible() const
128 {
129 return false;
130 }
131
132 #include "dolphincolumnview.moc"