1 /***************************************************************************
2 * Copyright (C) 2006-2009 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "dolphinview.h"
23 #include <QAbstractItemView>
24 #include <QApplication>
27 #include <QItemSelection>
32 #include <kactioncollection.h>
33 #include <kcolorscheme.h>
34 #include <kdirlister.h>
35 #include <kiconeffect.h>
36 #include <kfileitem.h>
38 #include <kio/deletejob.h>
39 #include <kio/netaccess.h>
40 #include <kio/previewjob.h>
43 #include <kmessagebox.h>
44 #include <kmimetyperesolver.h>
45 #include <konq_fileitemcapabilities.h>
46 #include <konq_operations.h>
47 #include <konqmimedata.h>
48 #include <ktoggleaction.h>
51 #include "additionalinfoaccessor.h"
52 #include "dolphinmodel.h"
53 #include "dolphincolumnviewcontainer.h"
54 #include "dolphinviewcontroller.h"
55 #include "dolphindetailsview.h"
56 #include "dolphinfileitemdelegate.h"
57 #include "dolphinnewfilemenuobserver.h"
58 #include "dolphinsortfilterproxymodel.h"
59 #include "dolphin_detailsmodesettings.h"
60 #include "dolphiniconsview.h"
61 #include "dolphin_generalsettings.h"
62 #include "draganddrophelper.h"
63 #include "renamedialog.h"
64 #include "settings/dolphinsettings.h"
65 #include "viewmodecontroller.h"
66 #include "viewproperties.h"
67 #include "zoomlevelinfo.h"
68 #include "dolphindetailsviewexpander.h"
70 DolphinView::DolphinView(QWidget
* parent
,
72 DolphinSortFilterProxyModel
* proxyModel
) :
76 m_storedCategorizedSorting(false),
77 m_tabsForFiles(false),
78 m_isContextMenuOpen(false),
79 m_assureVisibleCurrentIndex(false),
80 m_mode(DolphinView::IconsView
),
82 m_dolphinViewController(0),
83 m_viewModeController(0),
84 m_viewAccessor(proxyModel
),
85 m_selectionChangedTimer(0),
87 m_restoredContentsPosition(),
92 m_topLayout
= new QVBoxLayout(this);
93 m_topLayout
->setSpacing(0);
94 m_topLayout
->setMargin(0);
96 m_dolphinViewController
= new DolphinViewController(this);
98 m_viewModeController
= new ViewModeController(this);
99 m_viewModeController
->setUrl(url
);
101 connect(m_viewModeController
, SIGNAL(urlChanged(const KUrl
&)),
102 this, SIGNAL(urlChanged(const KUrl
&)));
104 connect(m_dolphinViewController
, SIGNAL(requestContextMenu(const QPoint
&, const QList
<QAction
*>&)),
105 this, SLOT(openContextMenu(const QPoint
&, const QList
<QAction
*>&)));
106 connect(m_dolphinViewController
, SIGNAL(urlsDropped(const KFileItem
&, const KUrl
&, QDropEvent
*)),
107 this, SLOT(dropUrls(const KFileItem
&, const KUrl
&, QDropEvent
*)));
108 connect(m_dolphinViewController
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
109 this, SLOT(updateSorting(DolphinView::Sorting
)));
110 connect(m_dolphinViewController
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
111 this, SLOT(updateSortOrder(Qt::SortOrder
)));
112 connect(m_dolphinViewController
, SIGNAL(sortFoldersFirstChanged(bool)),
113 this, SLOT(updateSortFoldersFirst(bool)));
114 connect(m_dolphinViewController
, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList
&)),
115 this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList
&)));
116 connect(m_dolphinViewController
, SIGNAL(itemTriggered(const KFileItem
&)),
117 this, SLOT(triggerItem(const KFileItem
&)));
118 connect(m_dolphinViewController
, SIGNAL(tabRequested(const KUrl
&)),
119 this, SIGNAL(tabRequested(const KUrl
&)));
120 connect(m_dolphinViewController
, SIGNAL(activated()),
121 this, SLOT(activate()));
122 connect(m_dolphinViewController
, SIGNAL(itemEntered(const KFileItem
&)),
123 this, SLOT(showHoverInformation(const KFileItem
&)));
124 connect(m_dolphinViewController
, SIGNAL(viewportEntered()),
125 this, SLOT(clearHoverInformation()));
126 connect(m_dolphinViewController
, SIGNAL(urlChangeRequested(KUrl
)),
127 m_viewModeController
, SLOT(setUrl(KUrl
)));
129 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
130 connect(dirLister
, SIGNAL(redirection(KUrl
,KUrl
)),
131 this, SLOT(slotRedirection(KUrl
,KUrl
)));
132 connect(dirLister
, SIGNAL(completed()),
133 this, SLOT(slotDirListerCompleted()));
134 connect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
135 this, SLOT(slotRefreshItems()));
137 // When a new item has been created by the "Create New..." menu, the item should
138 // get selected and it must be assured that the item will get visible. As the
139 // creation is done asynchronously, several signals must be checked:
140 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
141 this, SLOT(observeCreatedItem(const KUrl
&)));
143 m_selectionChangedTimer
= new QTimer(this);
144 m_selectionChangedTimer
->setSingleShot(true);
145 m_selectionChangedTimer
->setInterval(300);
146 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
147 this, SLOT(emitSelectionChangedSignal()));
149 applyViewProperties();
150 m_topLayout
->addWidget(m_viewAccessor
.layoutTarget());
153 DolphinView::~DolphinView()
157 KUrl
DolphinView::url() const
159 return m_viewModeController
->url();
162 KUrl
DolphinView::rootUrl() const
164 const KUrl viewUrl
= url();
165 const KUrl root
= m_viewAccessor
.rootUrl();
166 if (root
.isEmpty() || !root
.isParentOf(viewUrl
)) {
172 void DolphinView::setActive(bool active
)
174 if (active
== m_active
) {
180 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
182 emitSelectionChangedSignal();
187 QWidget
* viewport
= m_viewAccessor
.itemView()->viewport();
189 palette
.setColor(viewport
->backgroundRole(), color
);
190 viewport
->setPalette(palette
);
195 m_viewAccessor
.itemView()->setFocus();
199 m_viewModeController
->indicateActivationChange(active
);
202 bool DolphinView::isActive() const
207 void DolphinView::setMode(Mode mode
)
209 if (mode
== m_mode
) {
210 return; // the wished mode is already set
213 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
216 // remember the currently selected items, so that they will
217 // be restored after reloading the directory
218 m_selectedItems
= selectedItems();
222 const KUrl viewPropsUrl
= rootUrl();
223 ViewProperties
props(viewPropsUrl
);
224 props
.setViewMode(m_mode
);
227 // the file item delegate has been recreated, apply the current
228 // additional information manually
229 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
230 m_viewAccessor
.itemDelegate()->setShowInformation(infoList
);
231 emit
additionalInfoChanged();
233 // Not all view modes support categorized sorting. Adjust the sorting model
234 // if changing the view mode results in a change of the categorized sorting
236 m_storedCategorizedSorting
= props
.categorizedSorting();
237 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
238 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
239 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
240 emit
categorizedSortingChanged();
245 updateZoomLevel(oldZoomLevel
);
246 loadDirectory(viewPropsUrl
);
249 DolphinView::Mode
DolphinView::mode() const
254 bool DolphinView::showPreview() const
256 return m_showPreview
;
259 bool DolphinView::showHiddenFiles() const
261 return m_viewAccessor
.dirLister()->showingDotFiles();
264 bool DolphinView::categorizedSorting() const
266 // If all view modes would support categorized sorting, returning
267 // m_viewAccessor.proxyModel()->isCategorizedModel() would be the way to go. As
268 // currently only the icons view supports caterized sorting, we remember
269 // the stored view properties state in m_storedCategorizedSorting and
270 // return this state. The application takes care to disable the corresponding
271 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
272 // that this setting is not applied to the current view mode.
273 return m_storedCategorizedSorting
;
276 bool DolphinView::supportsCategorizedSorting() const
278 return m_viewAccessor
.supportsCategorizedSorting();
281 KFileItemList
DolphinView::items() const
283 return m_viewAccessor
.dirLister()->items();
286 KFileItemList
DolphinView::selectedItems() const
288 KFileItemList itemList
;
289 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
294 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
296 const QModelIndexList indexList
= selection
.indexes();
297 foreach (const QModelIndex
&index
, indexList
) {
298 KFileItem item
= m_viewAccessor
.dirModel()->itemForIndex(index
);
299 if (!item
.isNull()) {
300 itemList
.append(item
);
307 int DolphinView::selectedItemsCount() const
309 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
314 return view
->selectionModel()->selectedIndexes().count();
317 void DolphinView::markUrlsAsSelected(const QList
<KUrl
>& urls
)
319 foreach (const KUrl
& url
, urls
) {
320 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, url
);
321 m_selectedItems
.append(item
);
325 void DolphinView::setItemSelectionEnabled(const QRegExp
& pattern
, bool enabled
)
327 const QItemSelection matchingIndexes
= childrenMatchingPattern(QModelIndex(), pattern
);
328 const QItemSelectionModel::SelectionFlags command
= enabled
329 ? QItemSelectionModel::Select
330 : QItemSelectionModel::Deselect
;
331 m_viewAccessor
.itemView()->selectionModel()->select(matchingIndexes
, command
);
334 void DolphinView::setZoomLevel(int level
)
336 if (level
< ZoomLevelInfo::minimumLevel()) {
337 level
= ZoomLevelInfo::minimumLevel();
338 } else if (level
> ZoomLevelInfo::maximumLevel()) {
339 level
= ZoomLevelInfo::maximumLevel();
342 if (level
!= zoomLevel()) {
343 m_viewModeController
->setZoomLevel(level
);
344 emit
zoomLevelChanged(level
);
348 int DolphinView::zoomLevel() const
350 return m_viewModeController
->zoomLevel();
353 void DolphinView::setSorting(Sorting sorting
)
355 if (sorting
!= this->sorting()) {
356 updateSorting(sorting
);
360 DolphinView::Sorting
DolphinView::sorting() const
362 return m_viewAccessor
.proxyModel()->sorting();
365 void DolphinView::setSortOrder(Qt::SortOrder order
)
367 if (sortOrder() != order
) {
368 updateSortOrder(order
);
372 Qt::SortOrder
DolphinView::sortOrder() const
374 return m_viewAccessor
.proxyModel()->sortOrder();
377 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
379 if (sortFoldersFirst() != foldersFirst
) {
380 updateSortFoldersFirst(foldersFirst
);
384 bool DolphinView::sortFoldersFirst() const
386 return m_viewAccessor
.proxyModel()->sortFoldersFirst();
389 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
391 const KUrl viewPropsUrl
= rootUrl();
392 ViewProperties
props(viewPropsUrl
);
393 props
.setAdditionalInfo(info
);
394 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
396 emit
additionalInfoChanged();
398 if (m_viewAccessor
.reloadOnAdditionalInfoChange()) {
399 loadDirectory(viewPropsUrl
);
403 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
405 return m_viewAccessor
.itemDelegate()->showInformation();
408 void DolphinView::reload()
410 QByteArray viewState
;
411 QDataStream
saveStream(&viewState
, QIODevice::WriteOnly
);
412 saveState(saveStream
);
413 m_selectedItems
= selectedItems();
416 loadDirectory(url(), true);
418 QDataStream
restoreStream(viewState
);
419 restoreState(restoreStream
);
422 void DolphinView::stopLoading()
424 m_viewAccessor
.dirLister()->stop();
427 void DolphinView::refresh()
429 const bool oldActivationState
= m_active
;
430 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
434 applyViewProperties();
437 setActive(oldActivationState
);
438 updateZoomLevel(oldZoomLevel
);
441 void DolphinView::setNameFilter(const QString
& nameFilter
)
443 m_viewModeController
->setNameFilter(nameFilter
);
446 void DolphinView::calculateItemCount(int& fileCount
,
448 KIO::filesize_t
& totalFileSize
) const
450 foreach (const KFileItem
& item
, m_viewAccessor
.dirLister()->items()) {
455 totalFileSize
+= item
.size();
460 QString
DolphinView::statusBarText() const
465 KIO::filesize_t totalFileSize
= 0;
467 if (hasSelection()) {
468 // give a summary of the status of the selected files
469 const KFileItemList list
= selectedItems();
470 if (list
.isEmpty()) {
471 // when an item is triggered, it is temporary selected but selectedItems()
472 // will return an empty list
476 KFileItemList::const_iterator it
= list
.begin();
477 const KFileItemList::const_iterator end
= list
.end();
479 const KFileItem
& item
= *it
;
484 totalFileSize
+= item
.size();
489 if (folderCount
+ fileCount
== 1) {
490 // if only one item is selected, show the filename
491 const QString name
= list
.first().text();
492 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
493 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
494 name
, KIO::convertSize(totalFileSize
));
496 // at least 2 items are selected
497 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
498 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
499 if ((folderCount
> 0) && (fileCount
> 0)) {
500 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
501 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
502 } else if (fileCount
> 0) {
503 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
505 Q_ASSERT(folderCount
> 0);
510 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
511 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
512 fileCount
, folderCount
,
513 totalFileSize
, true);
519 QList
<QAction
*> DolphinView::versionControlActions(const KFileItemList
& items
) const
521 return m_dolphinViewController
->versionControlActions(items
);
524 void DolphinView::setUrl(const KUrl
& url
)
526 if (m_viewModeController
->url() == url
) {
530 // The selection model might change in the case of the column view. Disconnect
531 // from the current selection model and reconnect later after the URL switch.
532 const bool hadSelection
= hasSelection();
533 QAbstractItemView
* view
= m_viewAccessor
.itemView();
534 disconnect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
535 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
537 m_newFileNames
.clear();
539 m_viewModeController
->setUrl(url
); // emits urlChanged, which we forward
540 m_viewAccessor
.prepareUrlChange(url
);
541 applyViewProperties();
544 // When changing the URL there is no need to keep the version
545 // data of the previous URL.
546 m_viewAccessor
.dirModel()->clearVersionData();
548 emit
startedPathLoading(url
);
550 // Reconnect to the (probably) new selection model
551 view
= m_viewAccessor
.itemView();
552 connect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
553 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
554 if (hadSelection
|| hasSelection()) {
555 emitSelectionChangedSignal();
559 void DolphinView::selectAll()
561 m_viewAccessor
.itemView()->selectAll();
564 void DolphinView::invertSelection()
566 QItemSelectionModel
* selectionModel
= m_viewAccessor
.itemView()->selectionModel();
567 const QAbstractItemModel
* itemModel
= selectionModel
->model();
569 const QModelIndex topLeft
= itemModel
->index(0, 0);
570 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
571 itemModel
->columnCount() - 1);
573 const QItemSelection
selection(topLeft
, bottomRight
);
574 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
577 void DolphinView::clearSelection()
579 m_viewAccessor
.itemView()->clearSelection();
582 void DolphinView::renameSelectedItems()
584 KFileItemList items
= selectedItems();
585 const int itemCount
= items
.count();
590 if ((itemCount
== 1) && DolphinSettings::instance().generalSettings()->renameInline()) {
591 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForItem(items
.first());
592 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
593 m_viewAccessor
.itemView()->edit(proxyIndex
);
595 RenameDialog
* dialog
= new RenameDialog(this, items
);
596 dialog
->setAttribute(Qt::WA_DeleteOnClose
);
599 dialog
->activateWindow();
603 void DolphinView::trashSelectedItems()
605 const KUrl::List list
= simplifiedSelectedUrls();
606 KonqOperations::del(this, KonqOperations::TRASH
, list
);
609 void DolphinView::deleteSelectedItems()
611 const KUrl::List list
= simplifiedSelectedUrls();
612 const bool del
= KonqOperations::askDeleteConfirmation(list
,
614 KonqOperations::DEFAULT_CONFIRMATION
,
618 KIO::Job
* job
= KIO::del(list
);
619 connect(job
, SIGNAL(result(KJob
*)),
620 this, SLOT(slotDeleteFileFinished(KJob
*)));
624 void DolphinView::cutSelectedItems()
626 QMimeData
* mimeData
= selectionMimeData();
627 KonqMimeData::addIsCutSelection(mimeData
, true);
628 QApplication::clipboard()->setMimeData(mimeData
);
631 void DolphinView::copySelectedItems()
633 QMimeData
* mimeData
= selectionMimeData();
634 QApplication::clipboard()->setMimeData(mimeData
);
637 void DolphinView::paste()
642 void DolphinView::pasteIntoFolder()
644 const KFileItemList items
= selectedItems();
645 if ((items
.count() == 1) && items
.first().isDir()) {
646 pasteToUrl(items
.first().url());
650 void DolphinView::setShowPreview(bool show
)
652 if (m_showPreview
== show
) {
656 const KUrl viewPropsUrl
= rootUrl();
657 ViewProperties
props(viewPropsUrl
);
658 props
.setShowPreview(show
);
660 m_showPreview
= show
;
661 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
662 emit
showPreviewChanged();
664 // Enabling or disabling the preview might change the icon size of the view.
665 // As the view does not emit a signal when the icon size has been changed,
666 // the used zoom level of the controller must be adjusted manually:
667 updateZoomLevel(oldZoomLevel
);
670 void DolphinView::setShowHiddenFiles(bool show
)
672 if (m_viewAccessor
.dirLister()->showingDotFiles() == show
) {
676 const KUrl viewPropsUrl
= rootUrl();
677 ViewProperties
props(viewPropsUrl
);
678 props
.setShowHiddenFiles(show
);
680 m_viewAccessor
.dirLister()->setShowingDotFiles(show
);
681 emit
showHiddenFilesChanged();
684 void DolphinView::setCategorizedSorting(bool categorized
)
686 if (categorized
== categorizedSorting()) {
690 // setCategorizedSorting(true) may only get invoked
691 // if the view supports categorized sorting
692 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
694 ViewProperties
props(rootUrl());
695 props
.setCategorizedSorting(categorized
);
698 m_storedCategorizedSorting
= categorized
;
699 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
701 emit
categorizedSortingChanged();
704 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
706 QWidget::mouseReleaseEvent(event
);
710 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
712 switch (event
->type()) {
713 case QEvent::FocusIn
:
714 if (watched
== m_viewAccessor
.itemView()) {
715 m_dolphinViewController
->requestActivation();
719 case QEvent::DragEnter
:
720 if (watched
== m_viewAccessor
.itemView()->viewport()) {
725 case QEvent::KeyPress
:
726 if (watched
== m_viewAccessor
.itemView()) {
727 // clear the selection when Escape has been pressed
728 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
729 if (keyEvent
->key() == Qt::Key_Escape
) {
736 if (watched
== m_viewAccessor
.itemView()->viewport()) {
737 // Ctrl+wheel events should cause icon zooming, but not if the left mouse button is pressed
738 // (the user is probably trying to scroll during a selection in that case)
739 QWheelEvent
* wheelEvent
= static_cast<QWheelEvent
*>(event
);
740 if (wheelEvent
->modifiers() & Qt::ControlModifier
&& !(wheelEvent
->buttons() & Qt::LeftButton
)) {
741 const int delta
= wheelEvent
->delta();
742 const int level
= zoomLevel();
744 setZoomLevel(level
+ 1);
745 } else if (delta
< 0) {
746 setZoomLevel(level
- 1);
757 return QWidget::eventFilter(watched
, event
);
760 void DolphinView::activate()
765 void DolphinView::triggerItem(const KFileItem
& item
)
767 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
768 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
769 // items are selected by the user, hence don't trigger the
770 // item specified by 'index'
774 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
775 if (item
.isNull() || m_isContextMenuOpen
) {
779 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
782 void DolphinView::slotSelectionChanged(const QItemSelection
& selected
, const QItemSelection
& deselected
)
784 const int count
= selectedItemsCount();
785 const bool selectionStateChanged
= ((count
> 0) && (selected
.count() == count
)) ||
786 ((count
== 0) && !deselected
.isEmpty());
788 // If nothing has been selected before and something got selected (or if something
789 // was selected before and now nothing is selected) the selectionChangedSignal must
790 // be emitted asynchronously as fast as possible to update the edit-actions.
791 m_selectionChangedTimer
->setInterval(selectionStateChanged
? 0 : 300);
792 m_selectionChangedTimer
->start();
795 void DolphinView::emitSelectionChangedSignal()
797 m_selectionChangedTimer
->stop();
798 emit
selectionChanged(selectedItems());
801 void DolphinView::openContextMenu(const QPoint
& pos
,
802 const QList
<QAction
*>& customActions
)
805 const QModelIndex index
= m_viewAccessor
.itemView()->indexAt(pos
);
806 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
807 const QModelIndex dolphinModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(index
);
808 item
= m_viewAccessor
.dirModel()->itemForIndex(dolphinModelIndex
);
811 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
812 emit
requestContextMenu(item
, url(), customActions
);
813 m_isContextMenuOpen
= false;
816 void DolphinView::dropUrls(const KFileItem
& destItem
,
817 const KUrl
& destPath
,
820 addNewFileNames(event
->mimeData());
821 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
824 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
826 ViewProperties
props(rootUrl());
827 props
.setSorting(sorting
);
829 m_viewAccessor
.proxyModel()->setSorting(sorting
);
831 emit
sortingChanged(sorting
);
834 void DolphinView::updateSortOrder(Qt::SortOrder order
)
836 ViewProperties
props(rootUrl());
837 props
.setSortOrder(order
);
839 m_viewAccessor
.proxyModel()->setSortOrder(order
);
841 emit
sortOrderChanged(order
);
844 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
846 ViewProperties
props(rootUrl());
847 props
.setSortFoldersFirst(foldersFirst
);
849 m_viewAccessor
.proxyModel()->setSortFoldersFirst(foldersFirst
);
851 emit
sortFoldersFirstChanged(foldersFirst
);
854 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
856 ViewProperties
props(rootUrl());
857 props
.setAdditionalInfo(info
);
860 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
862 emit
additionalInfoChanged();
865 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
867 const AdditionalInfoAccessor
& infoAccessor
= AdditionalInfoAccessor::instance();
869 const KFileItemDelegate::InformationList checkedInfo
= m_viewAccessor
.itemDelegate()->showInformation();
870 const KFileItemDelegate::InformationList infoKeys
= infoAccessor
.keys();
872 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
873 (m_mode
== DolphinView::IconsView
);
875 foreach (const KFileItemDelegate::Information
& info
, infoKeys
) {
876 const QString name
= infoAccessor
.actionCollectionName(info
, AdditionalInfoAccessor::AdditionalInfoType
);
877 QAction
* action
= collection
->action(name
);
878 Q_ASSERT(action
!= 0);
879 action
->setEnabled(enable
);
880 action
->setChecked(checkedInfo
.contains(info
));
884 QPair
<bool, QString
> DolphinView::pasteInfo() const
886 return KonqOperations::pasteInfo(url());
889 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
891 m_tabsForFiles
= tabsForFiles
;
894 bool DolphinView::isTabsForFilesEnabled() const
896 return m_tabsForFiles
;
899 bool DolphinView::itemsExpandable() const
901 return m_viewAccessor
.itemsExpandable();
904 void DolphinView::restoreState(QDataStream
& stream
)
906 // Restore the URL of the current item that had the keyboard focus
907 stream
>> m_activeItemUrl
;
909 // Restore the root URL
912 m_viewAccessor
.setRootUrl(rootUrl
);
914 // Restore the view position
915 stream
>> m_restoredContentsPosition
;
917 // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
918 QSet
<KUrl
> urlsToExpand
;
919 stream
>> urlsToExpand
;
920 const DolphinDetailsViewExpander
* expander
= m_viewAccessor
.setExpandedUrls(urlsToExpand
);
922 m_expanderActive
= true;
923 connect (expander
, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
926 m_expanderActive
= false;
930 void DolphinView::saveState(QDataStream
& stream
)
932 // Save the URL of the current item that has the keyboard focus
933 KFileItem currentItem
;
934 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
937 const QModelIndex proxyIndex
= view
->currentIndex();
938 const QModelIndex dirModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
939 currentItem
= m_viewAccessor
.dirModel()->itemForIndex(dirModelIndex
);
943 if (!currentItem
.isNull()) {
944 currentItemUrl
= currentItem
.url();
947 stream
<< currentItemUrl
;
950 stream
<< m_viewAccessor
.rootUrl();
952 // Save view position
953 const int x
= view
->horizontalScrollBar()->value();
954 const int y
= view
->verticalScrollBar()->value();
955 stream
<< QPoint(x
, y
);
957 // Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
958 stream
<< m_viewAccessor
.expandedUrls();
961 bool DolphinView::hasSelection() const
963 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
964 return (view
!= 0) && view
->selectionModel()->hasSelection();
967 void DolphinView::observeCreatedItem(const KUrl
& url
)
969 m_createdItemUrl
= url
;
970 connect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
971 this, SLOT(selectAndScrollToCreatedItem()));
974 void DolphinView::selectAndScrollToCreatedItem()
976 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_createdItemUrl
);
977 if (dirIndex
.isValid()) {
978 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
979 m_viewAccessor
.itemView()->setCurrentIndex(proxyIndex
);
982 disconnect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
983 this, SLOT(selectAndScrollToCreatedItem()));
984 m_createdItemUrl
= KUrl();
987 void DolphinView::showHoverInformation(const KFileItem
& item
)
989 emit
requestItemInfo(item
);
992 void DolphinView::clearHoverInformation()
994 emit
requestItemInfo(KFileItem());
997 void DolphinView::slotDeleteFileFinished(KJob
* job
)
999 if (job
->error() == 0) {
1000 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1001 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
1002 emit
errorMessage(job
->errorString());
1006 void DolphinView::slotDirListerCompleted()
1008 if (!m_expanderActive
) {
1009 slotLoadingCompleted();
1012 if (!m_newFileNames
.isEmpty()) {
1013 // select all newly added items created by a paste operation or
1014 // a drag & drop operation, and clear the previous selection
1015 m_viewAccessor
.itemView()->clearSelection();
1016 const int rowCount
= m_viewAccessor
.proxyModel()->rowCount();
1017 QItemSelection selection
;
1018 for (int row
= 0; row
< rowCount
; ++row
) {
1019 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->index(row
, 0);
1020 const QModelIndex dirIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
1021 const KUrl url
= m_viewAccessor
.dirModel()->itemForIndex(dirIndex
).url();
1022 if (m_newFileNames
.contains(url
.fileName())) {
1023 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1026 m_viewAccessor
.itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1028 m_newFileNames
.clear();
1032 void DolphinView::slotLoadingCompleted()
1034 m_expanderActive
= false;
1036 if (!m_activeItemUrl
.isEmpty()) {
1037 // assure that the current item remains visible
1038 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_activeItemUrl
);
1039 if (dirIndex
.isValid()) {
1040 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1041 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1042 const bool clearSelection
= !hasSelection();
1043 view
->setCurrentIndex(proxyIndex
);
1044 if (clearSelection
) {
1045 view
->clearSelection();
1047 m_activeItemUrl
.clear();
1051 if (!m_selectedItems
.isEmpty()) {
1052 const KUrl
& baseUrl
= url();
1054 QItemSelection newSelection
;
1055 foreach(const KFileItem
& item
, m_selectedItems
) {
1056 url
= item
.url().upUrl();
1057 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
1058 QModelIndex index
= m_viewAccessor
.proxyModel()->mapFromSource(m_viewAccessor
.dirModel()->indexForItem(item
));
1059 newSelection
.select(index
, index
);
1062 m_viewAccessor
.itemView()->selectionModel()->select(newSelection
,
1063 QItemSelectionModel::ClearAndSelect
1064 | QItemSelectionModel::Current
);
1065 m_selectedItems
.clear();
1068 // Restore the contents position. This has to be done using a Qt::QueuedConnection
1069 // because the view might not be in its final state yet.
1070 QMetaObject::invokeMethod(this, "restoreContentsPosition", Qt::QueuedConnection
);
1072 emit
finishedPathLoading(url());
1075 void DolphinView::slotRefreshItems()
1077 if (m_assureVisibleCurrentIndex
) {
1078 m_assureVisibleCurrentIndex
= false;
1079 m_viewAccessor
.itemView()->scrollTo(m_viewAccessor
.itemView()->currentIndex());
1083 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1085 if (!url
.isValid()) {
1086 const QString
location(url
.pathOrUrl());
1087 if (location
.isEmpty()) {
1088 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1090 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1095 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
1096 dirLister
->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1099 void DolphinView::applyViewProperties()
1101 const ViewProperties
props(rootUrl());
1103 const Mode mode
= props
.viewMode();
1104 if (m_mode
!= mode
) {
1105 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1111 updateZoomLevel(oldZoomLevel
);
1113 if (m_viewAccessor
.itemView() == 0) {
1117 Q_ASSERT(m_viewAccessor
.itemView() != 0);
1118 Q_ASSERT(m_viewAccessor
.itemDelegate() != 0);
1120 const bool showHiddenFiles
= props
.showHiddenFiles();
1121 if (showHiddenFiles
!= m_viewAccessor
.dirLister()->showingDotFiles()) {
1122 m_viewAccessor
.dirLister()->setShowingDotFiles(showHiddenFiles
);
1123 emit
showHiddenFilesChanged();
1126 m_storedCategorizedSorting
= props
.categorizedSorting();
1127 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1128 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
1129 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
1130 emit
categorizedSortingChanged();
1133 const DolphinView::Sorting sorting
= props
.sorting();
1134 if (sorting
!= m_viewAccessor
.proxyModel()->sorting()) {
1135 m_viewAccessor
.proxyModel()->setSorting(sorting
);
1136 emit
sortingChanged(sorting
);
1139 const Qt::SortOrder sortOrder
= props
.sortOrder();
1140 if (sortOrder
!= m_viewAccessor
.proxyModel()->sortOrder()) {
1141 m_viewAccessor
.proxyModel()->setSortOrder(sortOrder
);
1142 emit
sortOrderChanged(sortOrder
);
1145 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1146 if (sortFoldersFirst
!= m_viewAccessor
.proxyModel()->sortFoldersFirst()) {
1147 m_viewAccessor
.proxyModel()->setSortFoldersFirst(sortFoldersFirst
);
1148 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1151 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1152 if (info
!= m_viewAccessor
.itemDelegate()->showInformation()) {
1153 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
1154 emit
additionalInfoChanged();
1157 const bool showPreview
= props
.showPreview();
1158 if (showPreview
!= m_showPreview
) {
1159 m_showPreview
= showPreview
;
1160 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1161 emit
showPreviewChanged();
1163 // Enabling or disabling the preview might change the icon size of the view.
1164 // As the view does not emit a signal when the icon size has been changed,
1165 // the used zoom level of the controller must be adjusted manually:
1166 updateZoomLevel(oldZoomLevel
);
1170 void DolphinView::createView()
1174 Q_ASSERT(m_viewAccessor
.itemView() == 0);
1175 Q_ASSERT(m_dolphinViewController
->itemView() == 0);
1176 m_viewAccessor
.createView(this, m_dolphinViewController
, m_viewModeController
, m_mode
);
1178 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1179 Q_ASSERT(view
!= 0);
1180 view
->installEventFilter(this);
1181 view
->viewport()->installEventFilter(this);
1183 m_dolphinViewController
->setItemView(view
);
1185 const int zoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(view
->iconSize());
1186 m_viewModeController
->setZoomLevel(zoomLevel
);
1188 connect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1189 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1191 setFocusProxy(m_viewAccessor
.layoutTarget());
1192 m_topLayout
->insertWidget(1, m_viewAccessor
.layoutTarget());
1195 void DolphinView::deleteView()
1197 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1198 Q_ASSERT((m_dolphinViewController
->itemView() == 0) || (m_dolphinViewController
->itemView() == view
));
1199 m_dolphinViewController
->setItemView(0);
1202 if (view
->selectionModel() != 0) {
1203 disconnect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1204 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1207 // It's important to set the keyboard focus to the parent
1208 // before deleting the view: Otherwise when having a split
1209 // view the other view will get the focus and will request
1210 // an activation (see DolphinView::eventFilter()).
1214 m_viewModeController
->disconnect(view
);
1216 m_viewAccessor
.deleteView();
1220 void DolphinView::pasteToUrl(const KUrl
& url
)
1222 addNewFileNames(QApplication::clipboard()->mimeData());
1223 KonqOperations::doPaste(this, url
);
1226 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1228 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor
.itemView()->iconSize());
1229 if (oldZoomLevel
!= newZoomLevel
) {
1230 m_viewModeController
->setZoomLevel(newZoomLevel
);
1231 emit
zoomLevelChanged(newZoomLevel
);
1235 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1239 const KFileItemList items
= selectedItems();
1240 foreach (const KFileItem
&item
, items
) {
1241 urls
.append(item
.url());
1245 if (itemsExpandable()) {
1246 urls
= KDirModel::simplifiedUrlList(urls
);
1252 QMimeData
* DolphinView::selectionMimeData() const
1254 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
1255 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1256 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
1257 return m_viewAccessor
.dirModel()->mimeData(selection
.indexes());
1260 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1262 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1263 foreach (const KUrl
& url
, urls
) {
1264 m_newFileNames
.insert(url
.fileName());
1268 QItemSelection
DolphinView::childrenMatchingPattern(const QModelIndex
& parent
, const QRegExp
& pattern
) const
1270 QItemSelection matchingIndexes
;
1271 const DolphinSortFilterProxyModel
* proxyModel
= m_viewAccessor
.proxyModel();
1272 const DolphinModel
* dolphinModel
= m_viewAccessor
.dirModel();
1274 const int rowCount
= proxyModel
->rowCount(parent
);
1276 for (int row
= 0; row
< rowCount
; ++row
) {
1277 QModelIndex index
= proxyModel
->index(row
, 0, parent
);
1278 QModelIndex sourceIndex
= proxyModel
->mapToSource(index
);
1280 if (sourceIndex
.isValid() && pattern
.exactMatch(dolphinModel
->data(sourceIndex
).toString())) {
1281 matchingIndexes
+= QItemSelectionRange(index
);
1284 if (proxyModel
->hasChildren(index
)) {
1285 matchingIndexes
+= childrenMatchingPattern(index
, pattern
);
1289 return matchingIndexes
;
1292 DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel
* proxyModel
) :
1296 m_columnsContainer(0),
1297 m_proxyModel(proxyModel
),
1302 DolphinView::ViewAccessor::~ViewAccessor()
1304 delete m_dragSource
;
1308 void DolphinView::ViewAccessor::createView(QWidget
* parent
,
1309 DolphinViewController
* dolphinViewController
,
1310 const ViewModeController
* viewModeController
,
1313 Q_ASSERT(itemView() == 0);
1317 m_iconsView
= new DolphinIconsView(parent
,
1318 dolphinViewController
,
1324 m_detailsView
= new DolphinDetailsView(parent
,
1325 dolphinViewController
,
1331 m_columnsContainer
= new DolphinColumnViewContainer(parent
,
1332 dolphinViewController
,
1333 viewModeController
);
1334 if (!m_rootUrl
.isEmpty() && m_rootUrl
.isParentOf(viewModeController
->url())) {
1335 // The column-view must show several columns starting with m_rootUrl as
1336 // first column and viewModeController->url() as last column.
1337 m_columnsContainer
->showColumn(m_rootUrl
);
1338 m_columnsContainer
->showColumn(viewModeController
->url());
1347 void DolphinView::ViewAccessor::deleteView()
1349 if (m_columnsContainer
!= 0) {
1350 m_columnsContainer
->close();
1351 m_columnsContainer
->disconnect();
1352 m_columnsContainer
->deleteLater();
1353 m_columnsContainer
= 0;
1355 QAbstractItemView
* view
= itemView();
1360 if (DragAndDropHelper::instance().isDragSource(view
)) {
1361 // The view is a drag source (the feature "Open folders
1362 // during drag operations" is used). Deleting the view
1363 // during an ongoing drag operation is not allowed, so
1364 // this will postponed.
1365 if (m_dragSource
!= 0) {
1366 // the old stored view is obviously not the drag source anymore
1367 m_dragSource
->deleteLater();
1371 m_dragSource
= view
;
1373 view
->deleteLater();
1383 void DolphinView::ViewAccessor::prepareUrlChange(const KUrl
& url
)
1385 if (m_columnsContainer
!= 0) {
1386 m_columnsContainer
->showColumn(url
);
1390 QAbstractItemView
* DolphinView::ViewAccessor::itemView() const
1392 if (m_iconsView
!= 0) {
1396 if (m_detailsView
!= 0) {
1397 return m_detailsView
;
1400 if (m_columnsContainer
!= 0) {
1401 return m_columnsContainer
->activeColumn();
1407 KFileItemDelegate
* DolphinView::ViewAccessor::itemDelegate() const
1409 return static_cast<KFileItemDelegate
*>(itemView()->itemDelegate());
1412 QWidget
* DolphinView::ViewAccessor::layoutTarget() const
1414 if (m_columnsContainer
!= 0) {
1415 return m_columnsContainer
;
1420 void DolphinView::ViewAccessor::setRootUrl(const KUrl
& rootUrl
)
1422 m_rootUrl
= rootUrl
;
1425 KUrl
DolphinView::ViewAccessor::rootUrl() const
1427 return (m_columnsContainer
!= 0) ? m_columnsContainer
->rootUrl() : m_rootUrl
;
1430 bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
1432 return m_iconsView
!= 0;
1435 bool DolphinView::ViewAccessor::itemsExpandable() const
1437 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1440 QSet
<KUrl
> DolphinView::ViewAccessor::expandedUrls() const
1442 if (m_detailsView
!= 0) {
1443 return m_detailsView
->expandedUrls();
1446 return QSet
<KUrl
>();
1449 const DolphinDetailsViewExpander
* DolphinView::ViewAccessor::setExpandedUrls(const QSet
<KUrl
>& urlsToExpand
)
1451 if ((m_detailsView
!= 0) && m_detailsView
->itemsExpandable() && !urlsToExpand
.isEmpty()) {
1452 // Check if another expander is already active and stop it if necessary.
1453 if(!m_detailsViewExpander
.isNull()) {
1454 m_detailsViewExpander
->stop();
1457 m_detailsViewExpander
= new DolphinDetailsViewExpander(m_detailsView
, urlsToExpand
);
1458 return m_detailsViewExpander
;
1465 bool DolphinView::ViewAccessor::reloadOnAdditionalInfoChange() const
1467 // the details view requires no reloading of the directory, as it maps
1468 // the file item delegate info to its columns internally
1469 return m_detailsView
!= 0;
1472 DolphinModel
* DolphinView::ViewAccessor::dirModel() const
1474 return static_cast<DolphinModel
*>(proxyModel()->sourceModel());
1477 DolphinSortFilterProxyModel
* DolphinView::ViewAccessor::proxyModel() const
1479 if (m_columnsContainer
!= 0) {
1480 return static_cast<DolphinSortFilterProxyModel
*>(m_columnsContainer
->activeColumn()->model());
1482 return m_proxyModel
;
1485 KDirLister
* DolphinView::ViewAccessor::dirLister() const
1487 return dirModel()->dirLister();
1490 void DolphinView::slotRedirection(const KUrl
& oldUrl
, const KUrl
& newUrl
)
1492 if (oldUrl
.equals(url(), KUrl::CompareWithoutTrailingSlash
)) {
1493 emit
redirection(oldUrl
, newUrl
);
1494 m_viewModeController
->redirectToUrl(newUrl
); // #186947
1498 void DolphinView::restoreContentsPosition()
1500 if (!m_restoredContentsPosition
.isNull()) {
1501 const int x
= m_restoredContentsPosition
.x();
1502 const int y
= m_restoredContentsPosition
.y();
1503 m_restoredContentsPosition
= QPoint();
1505 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1506 Q_ASSERT(view
!= 0);
1507 view
->horizontalScrollBar()->setValue(x
);
1508 view
->verticalScrollBar()->setValue(y
);
1512 #include "dolphinview.moc"