Making KFileItemList value based.

svn path=/trunk/KDE/kdebase/apps/; revision=719514
This commit is contained in:
Tobias Koenig 2007-10-01 08:00:48 +00:00
parent fd805228ae
commit 29a1b26421
5 changed files with 13 additions and 21 deletions

View file

@ -497,8 +497,8 @@ void DolphinColumnView::invertSelection()
KDirLister* dirLister = m_dolphinModel->dirLister();
const KFileItemList list = dirLister->itemsForDir(column->url());
foreach (KFileItem* item, list) {
const QModelIndex index = m_dolphinModel->indexForUrl(item->url());
foreach (const KFileItem item, list) {
const QModelIndex index = m_dolphinModel->indexForUrl(item.url());
selModel->select(m_proxyModel->mapFromSource(index), QItemSelectionModel::Toggle);
}
}

View file

@ -493,14 +493,9 @@ void DolphinMainWindow::deleteItems()
void DolphinMainWindow::properties()
{
QList<KFileItem> list = m_activeViewContainer->view()->selectedItems();
// ### KPropertiesDialog still uses pointer-based KFileItemList
KFileItemList lst;
// Can't be a const_iterator :(
for ( QList<KFileItem>::iterator it = list.begin(), end = list.end() ; it != end ; ++it ) {
lst << & *it; // ugly!
}
KPropertiesDialog dialog(lst, this);
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
KPropertiesDialog dialog(list, this);
dialog.exec();
}

View file

@ -185,11 +185,8 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
item = KFileItem( S_IFDIR, (mode_t)-1, url() );
}
// TODO port popupMenu to QList<KFileItem>
KFileItem* itemCopy = new KFileItem(item); // ugly
KFileItemList items; items.append(itemCopy);
KFileItemList items; items.append(item);
emit m_extension->popupMenu( 0, QCursor::pos(), items, KParts::OpenUrlArguments(), KParts::BrowserArguments(), popupFlags );
delete itemCopy;
}
#include "dolphinpart.moc"

View file

@ -900,9 +900,9 @@ void DolphinView::applyCutItemEffect()
KFileItemList::const_iterator it = items.begin();
const KFileItemList::const_iterator end = items.end();
while (it != end) {
KFileItem* item = *it;
if (isCutItem(*item)) {
const QModelIndex index = m_dolphinModel->indexForItem(*item);
const KFileItem item = *it;
if (isCutItem(item)) {
const QModelIndex index = m_dolphinModel->indexForItem(item);
// Huh? the item is already known
//const KFileItem item = m_dolphinModel->itemForIndex(index);
const QVariant value = m_dolphinModel->data(index, Qt::DecorationRole);
@ -913,7 +913,7 @@ void DolphinView::applyCutItemEffect()
// remember current pixmap for the item to be able
// to restore it when other items get cut
CutItem cutItem;
cutItem.url = item->url();
cutItem.url = item.url();
cutItem.pixmap = pixmap;
m_cutItemsCache.append(cutItem);

View file

@ -106,7 +106,7 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
this, SLOT(updateStatusBar()));
connect(m_dirLister, SIGNAL(percent(int)),
this, SLOT(updateProgress(int)));
connect(m_dirLister, SIGNAL(deleteItem(KFileItem*)),
connect(m_dirLister, SIGNAL(deleteItem(const KFileItem&)),
this, SLOT(updateStatusBar()));
connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateItemCount()));
@ -309,8 +309,8 @@ void DolphinViewContainer::updateItemCount()
m_folderCount = 0;
while (it != end) {
KFileItem* item = *it;
if (item->isDir()) {
const KFileItem item = *it;
if (item.isDir()) {
++m_folderCount;
} else {
++m_fileCount;