From 81fcd720a2cc095262e52b8a40dd1472d774a415 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 13 Aug 2007 21:57:20 +0000 Subject: Use KFileItem by value rather than by pointer - in KDirModel::itemForIndex, as noted there as a TODO - in dolphin, everywhere. svn path=/trunk/KDE/kdebase/apps/; revision=699691 --- src/dolphinmainwindow.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 3f1153340..5657a2c8c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -237,7 +237,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url) } } -void DolphinMainWindow::changeSelection(const KFileItemList& selection) +void DolphinMainWindow::changeSelection(const QList& selection) { activeViewContainer()->view()->changeSelection(selection); } @@ -351,7 +351,7 @@ void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::AdditionalI } } -void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection) +void DolphinMainWindow::slotSelectionChanged(const QList& selection) { updateEditActions(); @@ -490,8 +490,14 @@ void DolphinMainWindow::deleteItems() void DolphinMainWindow::properties() { - const KFileItemList list = m_activeViewContainer->view()->selectedItems(); - KPropertiesDialog dialog(list, this); + QList list = m_activeViewContainer->view()->selectedItems(); + // ### KPropertiesDialog still uses pointer-based KFileItemList + KFileItemList lst; + // Can't be a const_iterator :( + for ( QList::iterator it = list.begin(), end = list.end() ; it != end ; ++it ) { + lst << & *it; // ugly! + } + KPropertiesDialog dialog(lst, this); dialog.exec(); } @@ -1348,8 +1354,8 @@ void DolphinMainWindow::setupDockWidgets() addDockWidget(Qt::RightDockWidgetArea, infoDock); connect(this, SIGNAL(urlChanged(KUrl)), infoWidget, SLOT(setUrl(KUrl))); - connect(this, SIGNAL(selectionChanged(KFileItemList)), - infoWidget, SLOT(setSelection(KFileItemList))); + connect(this, SIGNAL(selectionChanged(QList)), + infoWidget, SLOT(setSelection(QList))); connect(this, SIGNAL(requestItemInfo(KFileItem)), infoWidget, SLOT(requestDelayedItemInfo(KFileItem))); @@ -1369,8 +1375,8 @@ void DolphinMainWindow::setupDockWidgets() treeWidget, SLOT(setUrl(KUrl))); connect(treeWidget, SIGNAL(changeUrl(KUrl)), this, SLOT(changeUrl(KUrl))); - connect(treeWidget, SIGNAL(changeSelection(KFileItemList)), - this, SLOT(changeSelection(KFileItemList))); + connect(treeWidget, SIGNAL(changeSelection(QList)), + this, SLOT(changeSelection(QList))); connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)), this, SLOT(dropUrls(KUrl::List, KUrl))); @@ -1432,7 +1438,7 @@ void DolphinMainWindow::updateHistory() void DolphinMainWindow::updateEditActions() { - const KFileItemList list = m_activeViewContainer->view()->selectedItems(); + const QList list = m_activeViewContainer->view()->selectedItems(); if (list.isEmpty()) { stateChanged("has_no_selection"); } else { @@ -1445,11 +1451,10 @@ void DolphinMainWindow::updateEditActions() bool enableMoveToTrash = true; - KFileItemList::const_iterator it = list.begin(); - const KFileItemList::const_iterator end = list.end(); + QList::const_iterator it = list.begin(); + const QList::const_iterator end = list.end(); while (it != end) { - KFileItem* item = *it; - const KUrl& url = item->url(); + const KUrl& url = (*it).url(); // only enable the 'Move to Trash' action for local files if (!url.isLocalFile()) { enableMoveToTrash = false; @@ -1572,8 +1577,8 @@ void DolphinMainWindow::connectViewSignals(int viewIndex) this, SLOT(slotSortOrderChanged(Qt::SortOrder))); connect(view, SIGNAL(additionalInfoChanged(KFileItemDelegate::AdditionalInformation)), this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation))); - connect(view, SIGNAL(selectionChanged(KFileItemList)), - this, SLOT(slotSelectionChanged(KFileItemList))); + connect(view, SIGNAL(selectionChanged(QList)), + this, SLOT(slotSelectionChanged(QList))); connect(view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(slotRequestItemInfo(KFileItem))); connect(view, SIGNAL(activated()), -- cgit v1.3