connect(controller, SIGNAL(zoomLevelChanged(int)),
this, SLOT(setZoomLevel(int)));
+ const QString nameFilter = controller->nameFilter();
+ if (!nameFilter.isEmpty()) {
+ m_proxyModel->setFilterRegExp(nameFilter);
+ }
+ connect(controller, SIGNAL(nameFilterChanged(const QString&)),
+ this, SLOT(setNameFilter(const QString&)));
+
updateDecorationSize(dolphinView->showPreview());
}
m_autoScroller->handleCurrentIndexChange(current, previous);
}
+void DolphinColumnView::setNameFilter(const QString& nameFilter)
+{
+ m_proxyModel->setFilterRegExp(nameFilter);
+}
void DolphinColumnView::setZoomLevel(int level)
{
virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous);
private slots:
+ void setNameFilter(const QString& nameFilter);
void setZoomLevel(int level);
void slotEntered(const QModelIndex& index);
m_contentX(0),
m_columns(),
m_emptyViewport(0),
- m_animation(0),
- m_nameFilter()
+ m_animation(0)
{
Q_ASSERT(controller != 0);
{
}
-void DolphinColumnViewContainer::setNameFilter(const QString& nameFilter)
-{
- if (nameFilter != m_nameFilter) {
- m_nameFilter = nameFilter;
- foreach (DolphinColumnView* column, m_columns) {
- DolphinSortFilterProxyModel* proxyModel = static_cast<DolphinSortFilterProxyModel*>(column->model());
- proxyModel->setFilterRegExp(nameFilter);
- }
- }
-}
-
-QString DolphinColumnViewContainer::nameFilter() const
-{
- return m_nameFilter;
-}
-
KUrl DolphinColumnViewContainer::rootUrl() const
{
return m_columns[0]->url();
columnIndex++;
DolphinColumnView* column = new DolphinColumnView(viewport(), this, childUrl);
- if (!m_nameFilter.isEmpty()) {
- DolphinSortFilterProxyModel* proxyModel = static_cast<DolphinSortFilterProxyModel*>(column->model());
- proxyModel->setFilterRegExp(m_nameFilter);
- }
column->setActive(false);
m_columns.append(column);
explicit DolphinColumnViewContainer(QWidget* parent, DolphinController* controller);
virtual ~DolphinColumnViewContainer();
- /**
- * Filters the currently shown items by \a nameFilter. All items
- * which contain the given filter string will be shown.
- */
- void setNameFilter(const QString& nameFilter);
-
- /**
- * Returns the currently used name filter. All items
- * which contain the name filter will be shown.
- */
- QString nameFilter() const;
-
KUrl rootUrl() const;
QAbstractItemView* activeColumn() const;
QList<DolphinColumnView*> m_columns;
QFrame* m_emptyViewport;
QTimeLine* m_animation;
- QString m_nameFilter;
friend class DolphinColumnView;
};
DolphinController::DolphinController(DolphinView* dolphinView) :
QObject(dolphinView),
m_zoomLevel(0),
+ m_nameFilter(),
m_url(),
m_dolphinView(dolphinView),
m_itemView(0)
emit activationChanged(active);
}
+void DolphinController::setNameFilter(const QString& nameFilter)
+{
+ if (nameFilter != m_nameFilter) {
+ m_nameFilter = nameFilter;
+ emit nameFilterChanged(nameFilter);
+ }
+}
+
+QString DolphinController::nameFilter() const
+{
+ return m_nameFilter;
+}
+
void DolphinController::setZoomLevel(int level)
{
Q_ASSERT(level >= ZoomLevelInfo::minimumLevel());
* - setShowHiddenFiles()
* - setShowPreview()
* - indicateActivationChange()
+ * - setNameFilter()
* - setZoomLevel()
*/
class LIBDOLPHINPRIVATE_EXPORT DolphinController : public QObject
void setZoomLevel(int level);
int zoomLevel() const;
+ /**
+ * Sets the name filter to \a and emits the signal nameFilterChanged().
+ */
+ void setNameFilter(const QString& nameFilter);
+ QString nameFilter() const;
+
/**
* Tells the view implementation to zoom out by emitting the signal zoomOut()
* and is invoked by the abstract Dolphin view.
*/
void viewportEntered();
+ /**
+ * Is emitted if the view should respect the name filter \a nameFilter. The view
+ * implementation must connect to this signal if it supports name filters.
+ */
+ void nameFilterChanged(const QString& nameFilter);
+
/**
* Is emitted if the view should change the zoom to \a level. The view implementation
* must connect to this signal if it supports zooming.
private:
int m_zoomLevel;
+ QString m_nameFilter;
static Qt::MouseButtons m_mouseButtons; // TODO: this is a workaround until Qt-issue 176832 has been fixed
KUrl m_url;
DolphinView* m_dolphinView;
#include <klocale.h>
#include <kmenu.h>
-#include <QAbstractProxyModel>
#include <QAction>
#include <QApplication>
#include <QHeaderView>
this, SLOT(slotEntered(const QModelIndex&)));
connect(this, SIGNAL(viewportEntered()),
controller, SLOT(emitViewportEntered()));
+ connect(controller, SIGNAL(nameFilterChanged(const QString&)),
+ this, SLOT(setNameFilter(const QString&)));
connect(controller, SIGNAL(zoomLevelChanged(int)),
this, SLOT(setZoomLevel(int)));
connect(controller->dolphinView(), SIGNAL(additionalInfoChanged()),
return QRect(topLeft, bottomRight).normalized();
}
+void DolphinDetailsView::setNameFilter(const QString& nameFilter)
+{
+ DolphinSortFilterProxyModel* proxyModel = static_cast<DolphinSortFilterProxyModel*>(model());
+ proxyModel->setFilterRegExp(nameFilter);
+}
+
void DolphinDetailsView::setZoomLevel(int level)
{
const int size = ZoomLevelInfo::iconSizeForZoomLevel(level);
*/
QRect elasticBandRect() const;
+ void setNameFilter(const QString& nameFilter);
+
void setZoomLevel(int level);
void slotShowPreviewChanged();
/***************************************************************************
- * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
+ * Copyright (C) 2006-2009 by Peter Penz <peter.penz@gmx.at> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
#include "dolphincategorydrawer.h"
#include "dolphincontroller.h"
#include "settings/dolphinsettings.h"
+#include "dolphinsortfilterproxymodel.h"
#include "dolphinviewautoscroller.h"
#include "dolphin_iconsmodesettings.h"
#include "dolphin_generalsettings.h"
controller, SLOT(emitItemEntered(const QModelIndex&)));
connect(this, SIGNAL(viewportEntered()),
controller, SLOT(emitViewportEntered()));
+ connect(controller, SIGNAL(nameFilterChanged(const QString&)),
+ this, SLOT(setNameFilter(const QString&)));
connect(controller, SIGNAL(zoomLevelChanged(int)),
this, SLOT(setZoomLevel(int)));
updateGridSize(showPreview, view->additionalInfo().count());
}
+void DolphinIconsView::setNameFilter(const QString& nameFilter)
+{
+ DolphinSortFilterProxyModel* proxyModel = static_cast<DolphinSortFilterProxyModel*>(model());
+ proxyModel->setFilterRegExp(nameFilter);
+}
+
void DolphinIconsView::setZoomLevel(int level)
{
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
/***************************************************************************
- * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
+ * Copyright (C) 2006-2009 by Peter Penz <peter.penz@gmx.at> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
private slots:
void slotShowPreviewChanged();
void slotAdditionalInfoChanged();
+ void setNameFilter(const QString& nameFilter);
void setZoomLevel(int level);
void requestActivation();
void slotGlobalSettingsChanged(int category);
void DolphinView::setNameFilter(const QString& nameFilter)
{
- m_viewAccessor.setNameFilter(nameFilter);
+ m_controller->setNameFilter(nameFilter);
}
void DolphinView::calculateItemCount(int& fileCount,
return itemView();
}
-void DolphinView::ViewAccessor::setNameFilter(const QString& nameFilter)
-{
- if (m_columnsContainer == 0) {
- m_columnsContainer->setNameFilter(nameFilter);
- } else {
- proxyModel()->setFilterRegExp(nameFilter);
- }
-}
-
KUrl DolphinView::ViewAccessor::rootUrl() const
{
return (m_columnsContainer != 0) ? m_columnsContainer->rootUrl() : KUrl();
*/
QWidget* layoutTarget() const;
- void setNameFilter(const QString& nameFilter);
-
KUrl rootUrl() const;
bool supportsCategorizedSorting() const;