]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Making KFileItemList value based.
authorTobias Koenig <tokoe@kde.org>
Mon, 1 Oct 2007 08:00:48 +0000 (08:00 +0000)
committerTobias Koenig <tokoe@kde.org>
Mon, 1 Oct 2007 08:00:48 +0000 (08:00 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=719514

src/dolphincolumnview.cpp
src/dolphinmainwindow.cpp
src/dolphinpart.cpp
src/dolphinview.cpp
src/dolphinviewcontainer.cpp

index 4f893e9975c829dfb264632a21aa568cb4296e8c..e38d0818749aeeedd660a1d92cedf95c8f94e90c 100644 (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);
     }
 }
index f3dbfcf6ed6d3301c91df6b6099895fa5726e1e8..fd7f65aa545d7d7985598046ce05f2ba5db6fe51 100644 (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();
 }
 
index 22b2483951f739828ad87296390300816189d277..f88f916227e59ae1037314090cb0db92b02b3227 100644 (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"
index edecf199a1c20d75999c9d0f17f1f3ec3331bb0a..2c02820c44328e7aa47c33f9084191b2589b9e40 100644 (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);
 
index a2902afd7e547839d74e9ef2e716aad71beded7b..bd4acc2be131a4ead94a600585dfc5f86b11dbd3 100644 (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;