connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateCutItems()));
- connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
- this, SLOT(generatePreviews(const KFileItemList&)));
+ connect(m_dirLister, SIGNAL(newItems(const QList<KFileItem>&)),
+ this, SLOT(generatePreviews(const QList<KFileItem>&)));
m_controller = new DolphinController(this);
m_controller->setUrl(url);
void DolphinView::triggerItem(const QModelIndex& index)
{
- if (!isValidNameIndex(index)) {
- clearSelection();
- showHoverInformation(index);
- return;
- }
+ Q_ASSERT(index.isValid());
const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
if ((modifier & Qt::ShiftModifier) || (modifier & Qt::ControlModifier)) {
return;
}
- KFileItem item = m_dirModel->itemForIndex(m_proxyModel->mapToSource(index));
+ const KFileItem item = m_dirModel->itemForIndex(m_proxyModel->mapToSource(index));
if (item.isNull()) {
return;
}
- // The stuff below should be moved to ViewContainer and be just a signal?
-
- // Prefer the local path over the URL.
- bool isLocal;
- KUrl url = item.mostLocalUrl(isLocal);
-
- if (item.isDir()) {
- setUrl(url);
- } else if (item.isFile()) {
- // allow to browse through ZIP and tar files
- KMimeType::Ptr mime = item.mimeTypePtr();
- if (mime->is("application/zip")) {
- url.setProtocol("zip");
- setUrl(url);
- } else if (mime->is("application/x-tar") ||
- mime->is("application/x-tarz") ||
- mime->is("application/x-bzip-compressed-tar") ||
- mime->is("application/x-compressed-tar") ||
- mime->is("application/x-tzo")) {
- url.setProtocol("tar");
- setUrl(url);
- } else {
- item.run();
- }
- } else {
- item.run();
- }
+ emit itemTriggered(item); // caught by DolphinViewContainer or DolphinPart
}
void DolphinView::generatePreviews(const QList<KFileItem>& items)
const KUrl& dirListerUrl = m_dirLister->url();
if ((dirListerUrl == url) || !m_dirLister->url().isParentOf(url)) {
// The current URL is not a child of the dir lister
- // URL. This may happen when e. g. a bookmark has been selected
+ // URL. This may happen when e. g. a place has been selected
// and hence the view must be reset.
keepOldDirs = false;
}