svn path=/trunk/KDE/kdebase/apps/; revision=
1016949
settings->italicFont());
}
settings->italicFont());
}
- // KFileItemDelegate* delegate = new KFileItemDelegate(this);
- // delegate->setShowToolTipWhenElided(false);
- // setItemDelegate(delegate);
-
activate();
connect(this, SIGNAL(viewportEntered()),
activate();
connect(this, SIGNAL(viewportEntered()),
this, SLOT(setFoldersExpandable(bool)));
m_extensionsFactory = new ViewExtensionsFactory(this, controller);
this, SLOT(setFoldersExpandable(bool)));
m_extensionsFactory = new ViewExtensionsFactory(this, controller);
+ m_extensionsFactory->fileItemDelegate()->setMinimizedNameColumn(true);
}
DolphinDetailsView::~DolphinDetailsView()
}
DolphinDetailsView::~DolphinDetailsView()
+#include <QAbstractItemView>
#include <QApplication>
#include <QClipboard>
#include <QKeyEvent>
#include <QApplication>
#include <QClipboard>
#include <QKeyEvent>
m_mode(DolphinView::IconsView),
m_topLayout(0),
m_controller(0),
m_mode(DolphinView::IconsView),
m_topLayout(0),
m_controller(0),
m_viewAccessor(proxyModel),
m_selectionChangedTimer(0),
m_versionControlObserver(0),
m_viewAccessor(proxyModel),
m_selectionChangedTimer(0),
m_versionControlObserver(0),
// the file item delegate has been recreated, apply the current
// additional information manually
const KFileItemDelegate::InformationList infoList = props.additionalInfo();
// the file item delegate has been recreated, apply the current
// additional information manually
const KFileItemDelegate::InformationList infoList = props.additionalInfo();
- m_fileItemDelegate->setShowInformation(infoList);
+ m_viewAccessor.itemDelegate()->setShowInformation(infoList);
emit additionalInfoChanged();
// Not all view modes support categorized sorting. Adjust the sorting model
emit additionalInfoChanged();
// Not all view modes support categorized sorting. Adjust the sorting model
const KUrl viewPropsUrl = rootUrl();
ViewProperties props(viewPropsUrl);
props.setAdditionalInfo(info);
const KUrl viewPropsUrl = rootUrl();
ViewProperties props(viewPropsUrl);
props.setAdditionalInfo(info);
- m_fileItemDelegate->setShowInformation(info);
+ m_viewAccessor.itemDelegate()->setShowInformation(info);
emit additionalInfoChanged();
emit additionalInfoChanged();
KFileItemDelegate::InformationList DolphinView::additionalInfo() const
{
KFileItemDelegate::InformationList DolphinView::additionalInfo() const
{
- return m_fileItemDelegate->showInformation();
+ return m_viewAccessor.itemDelegate()->showInformation();
}
void DolphinView::reload()
}
void DolphinView::reload()
}
m_controller->setUrl(url); // emits urlChanged, which we forward
}
m_controller->setUrl(url); // emits urlChanged, which we forward
- if (m_viewAccessor.prepareUrlChange(url)) {
- initializeView();
- }
+ m_viewAccessor.prepareUrlChange(url);
applyViewProperties();
loadDirectory(url);
applyViewProperties();
loadDirectory(url);
props.setAdditionalInfo(info);
props.save();
props.setAdditionalInfo(info);
props.save();
- m_fileItemDelegate->setShowInformation(info);
+ m_viewAccessor.itemDelegate()->setShowInformation(info);
emit additionalInfoChanged();
}
emit additionalInfoChanged();
}
showGroupInfo->setEnabled(enable);
showMimeInfo->setEnabled(enable);
showGroupInfo->setEnabled(enable);
showMimeInfo->setEnabled(enable);
- foreach (KFileItemDelegate::Information info, m_fileItemDelegate->showInformation()) {
+ foreach (KFileItemDelegate::Information info, m_viewAccessor.itemDelegate()->showInformation()) {
switch (info) {
case KFileItemDelegate::Size:
showSizeInfo->setChecked(true);
switch (info) {
case KFileItemDelegate::Size:
showSizeInfo->setChecked(true);
}
KFileItemDelegate::InformationList info = props.additionalInfo();
}
KFileItemDelegate::InformationList info = props.additionalInfo();
- if (info != m_fileItemDelegate->showInformation()) {
- m_fileItemDelegate->setShowInformation(info);
+ if (info != m_viewAccessor.itemDelegate()->showInformation()) {
+ m_viewAccessor.itemDelegate()->setShowInformation(info);
emit additionalInfoChanged();
}
emit additionalInfoChanged();
}
view = 0;
m_viewAccessor.deleteView();
view = 0;
m_viewAccessor.deleteView();
- m_fileItemDelegate = 0;
m_controller->setItemView(view);
m_controller->setItemView(view);
- m_fileItemDelegate = new DolphinFileItemDelegate(view);
- m_fileItemDelegate->setShowToolTipWhenElided(false);
- m_fileItemDelegate->setMinimizedNameColumn(m_mode == DetailsView);
- view->setItemDelegate(m_fileItemDelegate);
-
// TODO: reactivate selection model
/*view->setModel(m_viewAccessor.proxyModel());
if (m_selectionModel != 0) {
// TODO: reactivate selection model
/*view->setModel(m_viewAccessor.proxyModel());
if (m_selectionModel != 0) {
-bool DolphinView::ViewAccessor::prepareUrlChange(const KUrl& url)
+void DolphinView::ViewAccessor::prepareUrlChange(const KUrl& url)
{
if (m_columnsContainer != 0) {
{
if (m_columnsContainer != 0) {
- return m_columnsContainer->showColumn(url);
+ m_columnsContainer->showColumn(url);
}
QAbstractItemView* DolphinView::ViewAccessor::itemView() const
}
QAbstractItemView* DolphinView::ViewAccessor::itemView() const
+KFileItemDelegate* DolphinView::ViewAccessor::itemDelegate() const
+{
+ return static_cast<KFileItemDelegate*>(itemView()->itemDelegate());
+}
+
QWidget* DolphinView::ViewAccessor::layoutTarget() const
{
if (m_columnsContainer != 0) {
QWidget* DolphinView::ViewAccessor::layoutTarget() const
{
if (m_columnsContainer != 0) {
class DolphinController;
class DolphinColumnViewContainer;
class DolphinDetailsView;
class DolphinController;
class DolphinColumnViewContainer;
class DolphinDetailsView;
-class DolphinFileItemDelegate;
class DolphinIconsView;
class DolphinMainWindow;
class DolphinModel;
class DolphinIconsView;
class DolphinMainWindow;
class DolphinModel;
void createView(QWidget* parent, DolphinController* controller, Mode mode);
void deleteView();
void createView(QWidget* parent, DolphinController* controller, Mode mode);
void deleteView();
- bool prepareUrlChange(const KUrl& url);
+
+ /**
+ * Must be invoked before the URL has been changed and allows view implementations
+ * like the column view to create a new column.
+ */
+ void prepareUrlChange(const KUrl& url);
+
QAbstractItemView* itemView() const;
QAbstractItemView* itemView() const;
+ KFileItemDelegate* itemDelegate() const;
/**
* Returns the widget that should be added to the layout as target. Usually
/**
* Returns the widget that should be added to the layout as target. Usually
QVBoxLayout* m_topLayout;
DolphinController* m_controller;
QVBoxLayout* m_topLayout;
DolphinController* m_controller;
- DolphinFileItemDelegate* m_fileItemDelegate;
ViewAccessor m_viewAccessor;
QItemSelectionModel* m_selectionModel;
ViewAccessor m_viewAccessor;
QItemSelectionModel* m_selectionModel;
#include "viewextensionsfactory.h"
#include "dolphincontroller.h"
#include "viewextensionsfactory.h"
#include "dolphincontroller.h"
+#include "dolphinfileitemdelegate.h"
#include "dolphinsortfilterproxymodel.h"
#include "dolphinview.h"
#include "dolphinviewautoscroller.h"
#include "dolphinsortfilterproxymodel.h"
#include "dolphinview.h"
#include "dolphinviewautoscroller.h"
m_toolTipManager(0),
m_previewGenerator(0),
m_selectionManager(0),
m_toolTipManager(0),
m_previewGenerator(0),
m_selectionManager(0),
+ m_autoScroller(0),
+ m_fileItemDelegate(0)
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
connect(controller, SIGNAL(currentIndexChanged(QModelIndex, QModelIndex)),
m_autoScroller, SLOT(handleCurrentIndexChanged(QModelIndex, QModelIndex)));
connect(controller, SIGNAL(currentIndexChanged(QModelIndex, QModelIndex)),
m_autoScroller, SLOT(handleCurrentIndexChanged(QModelIndex, QModelIndex)));
+ // initialize file item delegate
+ m_fileItemDelegate = new DolphinFileItemDelegate(view);
+ m_fileItemDelegate->setShowToolTipWhenElided(false);
+ view->setItemDelegate(m_fileItemDelegate);
+
view->viewport()->installEventFilter(this);
}
view->viewport()->installEventFilter(this);
}
m_autoScroller->handleCurrentIndexChange(current, previous);
}
m_autoScroller->handleCurrentIndexChange(current, previous);
}
+DolphinFileItemDelegate* ViewExtensionsFactory::fileItemDelegate() const
+{
+ return m_fileItemDelegate;
+}
+
bool ViewExtensionsFactory::eventFilter(QObject* watched, QEvent* event)
{
Q_UNUSED(watched);
bool ViewExtensionsFactory::eventFilter(QObject* watched, QEvent* event)
{
Q_UNUSED(watched);
#include <QObject>
class DolphinController;
#include <QObject>
class DolphinController;
+class DolphinFileItemDelegate;
class DolphinViewAutoScroller;
class KFilePreviewGenerator;
class QModelIndex;
class DolphinViewAutoScroller;
class KFilePreviewGenerator;
class QModelIndex;
*/
void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
*/
void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
+ DolphinFileItemDelegate* fileItemDelegate() const;
+
protected:
virtual bool eventFilter(QObject* watched, QEvent* event);
protected:
virtual bool eventFilter(QObject* watched, QEvent* event);
KFilePreviewGenerator* m_previewGenerator;
SelectionManager* m_selectionManager;
DolphinViewAutoScroller* m_autoScroller;
KFilePreviewGenerator* m_previewGenerator;
SelectionManager* m_selectionManager;
DolphinViewAutoScroller* m_autoScroller;
+ DolphinFileItemDelegate* m_fileItemDelegate;