connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateCutItems()));
- connect(m_dirLister, SIGNAL(newItems(const QList<KFileItem>&)),
- this, SLOT(generatePreviews(const QList<KFileItem>&)));
+ connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
+ this, SLOT(generatePreviews(const KFileItemList&)));
m_controller = new DolphinController(this);
m_controller->setUrl(url);
itemView()->selectionModel()->clear();
}
-QList<KFileItem> DolphinView::selectedItems() const
+KFileItemList DolphinView::selectedItems() const
{
const QAbstractItemView* view = itemView();
Q_ASSERT((view != 0) && (view->selectionModel() != 0));
const QItemSelection selection = m_proxyModel->mapSelectionToSource(view->selectionModel()->selection());
- QList<KFileItem> itemList;
+ KFileItemList itemList;
const QModelIndexList indexList = selection.indexes();
foreach (QModelIndex index, indexList) {
KUrl::List DolphinView::selectedUrls() const
{
KUrl::List urls;
- const QList<KFileItem> list = selectedItems();
- for ( QList<KFileItem>::const_iterator it = list.begin(), end = list.end();
- it != end; ++it ) {
- urls.append((*it).url());
+ const KFileItemList list = selectedItems();
+ foreach (KFileItem item, list) {
+ urls.append(item.url());
}
return urls;
}
ViewProperties props(viewPropsUrl);
props.setAdditionalInfo(info);
- m_controller->setShowAdditionalInfo(!info.isEmpty());
+ m_controller->setAdditionalInfoCount(info.count());
m_fileItemDelegate->setShowInformation(info);
emit additionalInfoChanged(info);
startDirLister(viewPropsUrl, true);
}
-void DolphinView::setAdditionalInfo(KFileItemDelegate::Information info)
-{
- KFileItemDelegate::InformationList list;
- if (info != KFileItemDelegate::NoInformation)
- list << info;
-
- setAdditionalInfo(list);
-}
-
KFileItemDelegate::InformationList DolphinView::additionalInfo() const
{
return m_fileItemDelegate->showInformation();
if (restoreColumnView) {
applyViewProperties(rootUrl);
- Q_ASSERT(itemView() == m_columnView);
startDirLister(rootUrl);
- m_columnView->showColumn(url);
+ // Restoring the column view relies on the URL-history. It might be possible
+ // that the view properties have been changed or deleted in the meantime, so
+ // it cannot be asserted that really a column view has been created:
+ if (itemView() == m_columnView) {
+ m_columnView->showColumn(url);
+ }
} else {
applyViewProperties(url);
startDirLister(url);
emit itemTriggered(item); // caught by DolphinViewContainer or DolphinPart
}
-void DolphinView::generatePreviews(const QList<KFileItem>& items)
+void DolphinView::generatePreviews(const KFileItemList& items)
{
if (m_controller->showPreview()) {
KIO::PreviewJob* job = KIO::filePreview(items, 128);
// The current URL is not a child of the dir lister
// URL. This may happen when e. g. a place has been selected
// and hence the view must be reset.
- m_dirLister->openUrl(url, false, false);
+ m_dirLister->openUrl(url, KDirLister::NoFlags);
}
}
} else {
- m_dirLister->openUrl(url, false, reload);
+ m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
}
}
KFileItemDelegate::InformationList info = props.additionalInfo();
if (info != m_fileItemDelegate->showInformation()) {
- m_controller->setShowAdditionalInfo(!info.isEmpty());
+ m_controller->setAdditionalInfoCount(info.count());
m_fileItemDelegate->setShowInformation(info);
emit additionalInfoChanged(info);
}
}
}
-void DolphinView::changeSelection(const QList<KFileItem>& selection)
+void DolphinView::changeSelection(const KFileItemList& selection)
{
clearSelection();
if (selection.isEmpty()) {
void DolphinView::createView()
{
+ KFileItemDelegate::InformationList infoList;
+ if (m_fileItemDelegate != 0) {
+ infoList = m_fileItemDelegate->showInformation();
+ }
+
// delete current view
QAbstractItemView* view = itemView();
if (view != 0) {
Q_ASSERT(view != 0);
m_fileItemDelegate = new KFileItemDelegate(view);
+ m_fileItemDelegate->setShowInformation(infoList);
view->setItemDelegate(m_fileItemDelegate);
view->setModel(m_proxyModel);