svn path=/trunk/KDE/kdebase/apps/; revision=773890
{
m_toggle->hide();
if (index.isValid() && (index.column() == DolphinModel::Name)) {
{
m_toggle->hide();
if (index.isValid() && (index.column() == DolphinModel::Name)) {
- m_toggle->setFileItem(itemForIndex(index));
+ m_toggle->setUrl(urlForIndex(index));
connect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
connect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
m_toggle->setChecked(selModel->isSelected(index));
m_toggle->show();
} else {
m_toggle->setChecked(selModel->isSelected(index));
m_toggle->show();
} else {
- m_toggle->setFileItem(KFileItem());
+ m_toggle->setUrl(KUrl());
disconnect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
}
disconnect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
}
void SelectionManager::setItemSelected(bool selected)
{
emit selectionChanged();
void SelectionManager::setItemSelected(bool selected)
{
emit selectionChanged();
- Q_ASSERT(!m_toggle->fileItem().isNull());
- const QModelIndex index = indexForItem(m_toggle->fileItem());
+ const QModelIndex index = indexForUrl(m_toggle->url());
if (index.isValid()) {
QItemSelectionModel* selModel = m_view->selectionModel();
if (selected) {
if (index.isValid()) {
QItemSelectionModel* selModel = m_view->selectionModel();
if (selected) {
-KFileItem SelectionManager::itemForIndex(const QModelIndex& index) const
+KUrl SelectionManager::urlForIndex(const QModelIndex& index) const
{
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_view->model());
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
{
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_view->model());
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
- return dirModel->itemForIndex(dirIndex);
+ return dirModel->itemForIndex(dirIndex).url();
-const QModelIndex SelectionManager::indexForItem(const KFileItem& item) const
+const QModelIndex SelectionManager::indexForUrl(const KUrl& url) const
{
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_view->model());
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
{
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_view->model());
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
- const QModelIndex dirIndex = dirModel->indexForItem(item);
+ const QModelIndex dirIndex = dirModel->indexForUrl(url);
return proxyModel->mapFromSource(dirIndex);
}
return proxyModel->mapFromSource(dirIndex);
}
void slotRowsRemoved(const QModelIndex& parent, int start, int end);
private:
void slotRowsRemoved(const QModelIndex& parent, int start, int end);
private:
- KFileItem itemForIndex(const QModelIndex& index) const;
- const QModelIndex indexForItem(const KFileItem& item) const;
+ KUrl urlForIndex(const QModelIndex& index) const;
+ const QModelIndex indexForUrl(const KUrl& url) const;
private:
QAbstractItemView* m_view;
private:
QAbstractItemView* m_view;
void SelectionToggle::reset()
{
void SelectionToggle::reset()
{
-void SelectionToggle::setFileItem(const KFileItem& item)
+void SelectionToggle::setUrl(const KUrl& url)
- m_item = item;
- if (!item.isNull()) {
+ m_url = url;
+ if (!url.isEmpty()) {
-KFileItem SelectionToggle::fileItem() const
+KUrl SelectionToggle::url() const
}
void SelectionToggle::setVisible(bool visible)
}
void SelectionToggle::setVisible(bool visible)
#ifndef SELECTIONTOGGLE_H
#define SELECTIONTOGGLE_H
#ifndef SELECTIONTOGGLE_H
#define SELECTIONTOGGLE_H
#include <QAbstractButton>
#include <QPixmap>
#include <QAbstractButton>
#include <QPixmap>
- void setFileItem(const KFileItem& item);
- KFileItem fileItem() const;
+ void setUrl(const KUrl& url);
+ KUrl url() const;
public slots:
virtual void setVisible(bool visible);
public slots:
virtual void setVisible(bool visible);
int m_fadingValue;
QPixmap m_icon;
QTimeLine* m_fadingTimeLine;
int m_fadingValue;
QPixmap m_icon;
QTimeLine* m_fadingTimeLine;