#include "folderexpander.h"
-#include <QtCore/QTimer>
-#include <QtGui/QAbstractItemView>
-#include <QtGui/QTreeView>
-#include <QtGui/QScrollBar>
+#include <QTimer>
+#include <QAbstractItemView>
+#include <QTreeView>
+#include <QScrollBar>
-#include <QtCore/QEvent>
-#include <QtGui/QDragMoveEvent>
+#include <QEvent>
+#include <QDragMoveEvent>
-#include <QtGui/QSortFilterProxyModel>
+#include <QSortFilterProxyModel>
-#include <kdirmodel.h>
+#include <KDirModel>
FolderExpander::FolderExpander(QAbstractItemView *view, QSortFilterProxyModel *proxyModel) :
QObject(view),
m_autoExpandTriggerTimer(0),
m_autoExpandPos()
{
- if (m_view == 0) {
- return;
- }
- if (m_proxyModel == 0) {
+ if (!m_view || !m_proxyModel) {
return;
}
KDirModel *m_dirModel = qobject_cast<KDirModel*>(m_proxyModel->sourceModel());
- if (m_dirModel == 0) {
+ if (!m_dirModel) {
return;
}
QModelIndex proxyIndexToExpand = m_view->indexAt(m_autoExpandPos);
QModelIndex indexToExpand = m_proxyModel->mapToSource(proxyIndexToExpand);
KDirModel* m_dirModel = qobject_cast< KDirModel* >(m_proxyModel->sourceModel());
- Q_ASSERT(m_dirModel != 0);
+ Q_ASSERT(m_dirModel);
KFileItem itemToExpand = m_dirModel->itemForIndex(indexToExpand);
if (itemToExpand.isNull() || itemToExpand == m_dirModel->itemForIndex(QModelIndex())) {
if (itemToExpand.isDir()) {
QTreeView* treeView = qobject_cast<QTreeView*>(m_view);
- if ((treeView != 0) && treeView->itemsExpandable()) {
+ if (treeView && treeView->itemsExpandable()) {
// Toggle expanded state of this directory.
treeView->setExpanded(proxyIndexToExpand, !treeView->isExpanded(proxyIndexToExpand));
}