m_proxyModel);
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
- connect(m_view, SIGNAL(requestContextMenu(KFileItem*, const KUrl&)),
- this, SLOT(openContextMenu(KFileItem*, const KUrl&)));
+ connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),
+ this, SLOT(openContextMenu(KFileItem, const KUrl&)));
connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
connect(m_view, SIGNAL(contentsMoved(int, int)),
void DolphinViewContainer::renameSelectedItems()
{
DolphinViewContainer* view = m_mainWindow->activeViewContainer();
- const KUrl::List urls = m_view->selectedUrls();
- if (urls.count() > 1) {
+ const QList<KFileItem> items = m_view->selectedItems();
+ if (items.count() > 1) {
// More than one item has been selected for renaming. Open
// a rename dialog and rename all items afterwards.
- RenameDialog dialog(urls);
+ RenameDialog dialog(items);
if (dialog.exec() == QDialog::Rejected) {
return;
}
Q_ASSERT(replaceIndex >= 0);
int index = 1;
- KUrl::List::const_iterator it = urls.begin();
- KUrl::List::const_iterator end = urls.end();
+ QList<KFileItem>::const_iterator it = items.begin();
+ QList<KFileItem>::const_iterator end = items.end();
while (it != end) {
- const KUrl& oldUrl = *it;
+ const KUrl& oldUrl = (*it).url();
QString number;
number.setNum(index++);
} else {
// Only one item has been selected for renaming. Use the custom
// renaming mechanism from the views.
- Q_ASSERT(urls.count() == 1);
+ Q_ASSERT(items.count() == 1);
// TODO: Think about using KFileItemDelegate as soon as it supports editing.
// Currently the RenameDialog is used, but I'm not sure whether inline renaming
// is a benefit for the user at all -> let's wait for some input first...
- RenameDialog dialog(urls);
+ RenameDialog dialog(items);
if (dialog.exec() == QDialog::Rejected) {
return;
}
view->statusBar()->setMessage(dialog.errorString(),
DolphinStatusBar::Error);
} else {
- const KUrl& oldUrl = urls.first();
+ const KUrl& oldUrl = items.first().url();
KUrl newUrl = oldUrl;
newUrl.setFileName(newName);
m_mainWindow->rename(oldUrl, newUrl);
return m_urlNavigator->isUrlEditable();
}
-KFileItem* DolphinViewContainer::fileItem(const QModelIndex index) const
+KFileItem DolphinViewContainer::fileItem(const QModelIndex& index) const
{
const QModelIndex dirModelIndex = m_proxyModel->mapToSource(index);
return m_dirModel->itemForIndex(dirModelIndex);
QString DolphinViewContainer::selectionStatusBarText() const
{
QString text;
- const KFileItemList list = m_view->selectedItems();
+ const QList<KFileItem> list = m_view->selectedItems();
if (list.isEmpty()) {
// when an item is triggered, it is temporary selected but selectedItems()
// will return an empty list
int fileCount = 0;
int folderCount = 0;
KIO::filesize_t byteSize = 0;
- KFileItemList::const_iterator it = list.begin();
- const KFileItemList::const_iterator end = list.end();
+ QList<KFileItem>::const_iterator it = list.begin();
+ const QList<KFileItem>::const_iterator end = list.end();
while (it != end) {
- KFileItem* item = *it;
- if (item->isDir()) {
+ const KFileItem& item = *it;
+ if (item.isDir()) {
++folderCount;
} else {
++fileCount;
- byteSize += item->size();
+ byteSize += item.size();
}
++it;
}
#endif
}
-void DolphinViewContainer::openContextMenu(KFileItem* item,
+void DolphinViewContainer::openContextMenu(const KFileItem& item,
const KUrl& url)
{
DolphinContextMenu contextMenu(m_mainWindow, item, url);