┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphincolumnview.cpp6
-rw-r--r--src/views/dolphincolumnviewcontainer.cpp8
-rw-r--r--src/views/dolphindetailsview.cpp10
-rw-r--r--src/views/dolphindetailsviewexpander.cpp8
-rw-r--r--src/views/dolphiniconsview.cpp12
-rw-r--r--src/views/dolphinremoteencoding.cpp4
-rw-r--r--src/views/dolphinview.cpp60
-rw-r--r--src/views/dolphinviewactionhandler.cpp8
-rw-r--r--src/views/dolphinviewautoscroller.cpp8
-rw-r--r--src/views/dolphinviewcontroller.cpp12
-rw-r--r--src/views/draganddrophelper.cpp6
-rw-r--r--src/views/folderexpander.cpp11
-rw-r--r--src/views/selectionmanager.cpp16
-rw-r--r--src/views/selectiontoggle.cpp8
-rw-r--r--src/views/tooltips/filemetadatatooltip.cpp2
-rw-r--r--src/views/tooltips/tooltipmanager.cpp2
-rw-r--r--src/views/versioncontrol/pendingthreadsmaintainer.cpp2
-rw-r--r--src/views/versioncontrol/pendingthreadsmaintainer.h2
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.cpp2
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.cpp29
-rw-r--r--src/views/viewextensionsfactory.cpp4
21 files changed, 109 insertions, 111 deletions
diff --git a/src/views/dolphincolumnview.cpp b/src/views/dolphincolumnview.cpp
index 6b0f43cd9..fec0879ea 100644
--- a/src/views/dolphincolumnview.cpp
+++ b/src/views/dolphincolumnview.cpp
@@ -90,7 +90,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent,
m_resizeWidget->installEventFilter(this);
const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
@@ -241,7 +241,7 @@ void DolphinColumnView::setSelectionModel(QItemSelectionModel* model)
// If a change of the selection is done although the view is not active
// (e. g. by the selection markers), the column must be activated. This
// is done by listening to the current selectionChanged() signal.
- if (selectionModel() != 0) {
+ if (selectionModel()) {
disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this, SLOT(requestActivation()));
}
@@ -507,7 +507,7 @@ void DolphinColumnView::requestActivation()
void DolphinColumnView::updateFont()
{
const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
diff --git a/src/views/dolphincolumnviewcontainer.cpp b/src/views/dolphincolumnviewcontainer.cpp
index 7baded96c..3216dd2b6 100644
--- a/src/views/dolphincolumnviewcontainer.cpp
+++ b/src/views/dolphincolumnviewcontainer.cpp
@@ -49,8 +49,8 @@ DolphinColumnViewContainer::DolphinColumnViewContainer(QWidget* parent,
m_activeUrlTimer(0),
m_assureVisibleActiveColumnTimer(0)
{
- Q_ASSERT(dolphinViewController != 0);
- Q_ASSERT(viewModeController != 0);
+ Q_ASSERT(dolphinViewController);
+ Q_ASSERT(viewModeController);
setAcceptDrops(true);
setFocusPolicy(Qt::NoFocus);
@@ -392,7 +392,7 @@ void DolphinColumnViewContainer::removeAllColumns()
void DolphinColumnViewContainer::deleteColumn(DolphinColumnView* column)
{
- if (column == 0) {
+ if (!column) {
return;
}
@@ -412,7 +412,7 @@ void DolphinColumnViewContainer::deleteColumn(DolphinColumnView* column)
// during drag operations" is used). Deleting the view
// during an ongoing drag operation is not allowed, so
// this will postponed.
- if (m_dragSource != 0) {
+ if (m_dragSource) {
// the old stored view is obviously not the drag source anymore
m_dragSource->deleteLater();
m_dragSource = 0;
diff --git a/src/views/dolphindetailsview.cpp b/src/views/dolphindetailsview.cpp
index 482925aaa..5c2e9576f 100644
--- a/src/views/dolphindetailsview.cpp
+++ b/src/views/dolphindetailsview.cpp
@@ -59,9 +59,9 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent,
m_decorationSize()
{
const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
- Q_ASSERT(settings != 0);
- Q_ASSERT(dolphinViewController != 0);
- Q_ASSERT(viewModeController != 0);
+ Q_ASSERT(settings);
+ Q_ASSERT(dolphinViewController);
+ Q_ASSERT(viewModeController);
setLayoutDirection(Qt::LeftToRight);
setAcceptDrops(true);
@@ -388,7 +388,7 @@ void DolphinDetailsView::configureSettings(const QPoint& pos)
popup.addSeparator();
QAction* activatedAction = popup.exec(header()->mapToGlobal(pos));
- if (activatedAction != 0) {
+ if (activatedAction) {
const bool show = activatedAction->isChecked();
const int columnIndex = activatedAction->data().toInt();
@@ -574,7 +574,7 @@ void DolphinDetailsView::slotGlobalSettingsChanged(int category)
Q_UNUSED(category);
const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
}
diff --git a/src/views/dolphindetailsviewexpander.cpp b/src/views/dolphindetailsviewexpander.cpp
index c2734ed3a..cc4bc67be 100644
--- a/src/views/dolphindetailsviewexpander.cpp
+++ b/src/views/dolphindetailsviewexpander.cpp
@@ -34,16 +34,16 @@ DolphinDetailsViewExpander::DolphinDetailsViewExpander(DolphinDetailsView* paren
m_dolphinModel(0),
m_proxyModel(0)
{
- Q_ASSERT(parent != 0);
+ Q_ASSERT(parent);
m_proxyModel = qobject_cast<const DolphinSortFilterProxyModel*>(parent->model());
- Q_ASSERT(m_proxyModel != 0);
+ Q_ASSERT(m_proxyModel);
m_dolphinModel = qobject_cast<const DolphinModel*>(m_proxyModel->sourceModel());
- Q_ASSERT(m_dolphinModel != 0);
+ Q_ASSERT(m_dolphinModel);
m_dirLister = m_dolphinModel->dirLister();
- Q_ASSERT(m_dirLister != 0);
+ Q_ASSERT(m_dirLister);
// The URLs must be sorted. E.g. /home/user/ cannot be expanded before /home/
// because it is not known to the dir model before.
diff --git a/src/views/dolphiniconsview.cpp b/src/views/dolphiniconsview.cpp
index 6527c8611..a863de72d 100644
--- a/src/views/dolphiniconsview.cpp
+++ b/src/views/dolphiniconsview.cpp
@@ -54,8 +54,8 @@ DolphinIconsView::DolphinIconsView(QWidget* parent,
m_itemSize(),
m_dropRect()
{
- Q_ASSERT(dolphinViewController != 0);
- Q_ASSERT(viewModeController != 0);
+ Q_ASSERT(dolphinViewController);
+ Q_ASSERT(viewModeController);
setModel(proxyModel);
setLayoutDirection(Qt::LeftToRight);
@@ -93,7 +93,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent,
// apply the icons mode settings to the widget
const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
@@ -405,7 +405,7 @@ void DolphinIconsView::slotGlobalSettingsChanged(int category)
Q_UNUSED(category);
const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
}
@@ -449,7 +449,7 @@ void DolphinIconsView::categoryDrawerActionRequested(int action, const QModelInd
void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
{
const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- Q_ASSERT(settings != 0);
+ Q_ASSERT(settings);
int itemWidth = settings->itemWidth();
int itemHeight = settings->itemHeight();
@@ -510,7 +510,7 @@ void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
setGridSizeOwn(QSize(itemWidth + spacing * 2, itemHeight + spacing));
KFileItemDelegate* delegate = dynamic_cast<KFileItemDelegate*>(itemDelegate());
- if (delegate != 0) {
+ if (delegate) {
delegate->setMaximumSize(m_itemSize);
}
}
diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp
index f3bd15772..475769e91 100644
--- a/src/views/dolphinremoteencoding.cpp
+++ b/src/views/dolphinremoteencoding.cpp
@@ -169,7 +169,7 @@ void DolphinRemoteEncoding::slotAboutToShow()
void DolphinRemoteEncoding::slotItemSelected(QAction* action)
{
- if (action != 0) {
+ if (action) {
int id = action->data().toInt();
KConfig config(("kio_" + m_currentURL.protocol() + "rc").toLatin1());
@@ -200,7 +200,7 @@ void DolphinRemoteEncoding::slotDefault()
// Remove the exact name match...
domains << m_currentURL.host();
- while (partList.count()) {
+ while (!partList.isEmpty()) {
if (partList.count() == 2) {
if (partList[0].length() <= 2 && partList[1].length() == 2) {
break;
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 534eabfee..4ab16e052 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -290,7 +290,7 @@ KFileItemList DolphinView::selectedItems() const
{
KFileItemList itemList;
const QAbstractItemView* view = m_viewAccessor.itemView();
- if (view == 0) {
+ if (!view) {
return itemList;
}
@@ -310,7 +310,7 @@ KFileItemList DolphinView::selectedItems() const
int DolphinView::selectedItemsCount() const
{
const QAbstractItemView* view = m_viewAccessor.itemView();
- if (view == 0) {
+ if (!view) {
return 0;
}
@@ -886,7 +886,7 @@ void DolphinView::updateAdditionalInfoActions(KActionCollection* collection)
foreach (const KFileItemDelegate::Information& info, infoKeys) {
const QString name = infoAccessor.actionCollectionName(info, AdditionalInfoAccessor::AdditionalInfoType);
QAction* action = collection->action(name);
- Q_ASSERT(action != 0);
+ Q_ASSERT(action);
action->setEnabled(enable);
action->setChecked(checkedInfo.contains(info));
}
@@ -929,7 +929,7 @@ void DolphinView::restoreState(QDataStream& stream)
QSet<KUrl> urlsToExpand;
stream >> urlsToExpand;
const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
- if (expander != 0) {
+ if (expander) {
m_expanderActive = true;
connect (expander, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
}
@@ -944,7 +944,7 @@ void DolphinView::saveState(QDataStream& stream)
KFileItem currentItem;
const QAbstractItemView* view = m_viewAccessor.itemView();
- if (view != 0) {
+ if (view) {
const QModelIndex proxyIndex = view->currentIndex();
const QModelIndex dirModelIndex = m_viewAccessor.proxyModel()->mapToSource(proxyIndex);
currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
@@ -972,7 +972,7 @@ void DolphinView::saveState(QDataStream& stream)
bool DolphinView::hasSelection() const
{
const QAbstractItemView* view = m_viewAccessor.itemView();
- return (view != 0) && view->selectionModel()->hasSelection();
+ return view && view->selectionModel()->hasSelection();
}
void DolphinView::observeCreatedItem(const KUrl& url)
@@ -1011,7 +1011,7 @@ void DolphinView::restoreContentsPosition()
m_restoredContentsPosition = QPoint();
QAbstractItemView* view = m_viewAccessor.itemView();
- Q_ASSERT(view != 0);
+ Q_ASSERT(view);
view->horizontalScrollBar()->setValue(x);
view->verticalScrollBar()->setValue(y);
}
@@ -1163,12 +1163,12 @@ void DolphinView::applyViewProperties()
updateZoomLevel(oldZoomLevel);
}
- if (m_viewAccessor.itemView() == 0) {
+ if (!m_viewAccessor.itemView()) {
createView();
}
- Q_ASSERT(m_viewAccessor.itemView() != 0);
- Q_ASSERT(m_viewAccessor.itemDelegate() != 0);
+ Q_ASSERT(m_viewAccessor.itemView());
+ Q_ASSERT(m_viewAccessor.itemDelegate());
const bool showHiddenFiles = props.showHiddenFiles();
if (showHiddenFiles != m_viewAccessor.dirLister()->showingDotFiles()) {
@@ -1224,12 +1224,12 @@ void DolphinView::createView()
{
deleteView();
- Q_ASSERT(m_viewAccessor.itemView() == 0);
- Q_ASSERT(m_dolphinViewController->itemView() == 0);
+ Q_ASSERT(!m_viewAccessor.itemView());
+ Q_ASSERT(!m_dolphinViewController->itemView());
m_viewAccessor.createView(this, m_dolphinViewController, m_viewModeController, m_mode);
QAbstractItemView* view = m_viewAccessor.itemView();
- Q_ASSERT(view != 0);
+ Q_ASSERT(view);
view->installEventFilter(this);
view->viewport()->installEventFilter(this);
@@ -1247,10 +1247,10 @@ void DolphinView::createView()
void DolphinView::deleteView()
{
QAbstractItemView* view = m_viewAccessor.itemView();
- Q_ASSERT((m_dolphinViewController->itemView() == 0) || (m_dolphinViewController->itemView() == view));
+ Q_ASSERT(!m_dolphinViewController->itemView() || (m_dolphinViewController->itemView() == view));
m_dolphinViewController->setItemView(0);
- if (view != 0) {
+ if (view) {
disconnectViewAccessor();
if (hasFocus()) {
@@ -1303,7 +1303,7 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const
QMimeData* DolphinView::selectionMimeData() const
{
const QAbstractItemView* view = m_viewAccessor.itemView();
- Q_ASSERT((view != 0) && (view->selectionModel() != 0));
+ Q_ASSERT((view) && (view->selectionModel()));
const QItemSelection selection = m_viewAccessor.proxyModel()->mapSelectionToSource(view->selectionModel()->selection());
return m_viewAccessor.dirModel()->mimeData(selection.indexes());
}
@@ -1438,7 +1438,7 @@ void DolphinView::ViewAccessor::createView(QWidget* parent,
const ViewModeController* viewModeController,
Mode mode)
{
- Q_ASSERT(itemView() == 0);
+ Q_ASSERT(!itemView());
switch (mode) {
case IconsView:
@@ -1474,14 +1474,14 @@ void DolphinView::ViewAccessor::createView(QWidget* parent,
void DolphinView::ViewAccessor::deleteView()
{
- if (m_columnsContainer != 0) {
+ if (m_columnsContainer) {
m_columnsContainer->close();
m_columnsContainer->disconnect();
m_columnsContainer->deleteLater();
m_columnsContainer = 0;
} else {
QAbstractItemView* view = itemView();
- if (view != 0) {
+ if (view) {
view->close();
view->disconnect();
@@ -1490,7 +1490,7 @@ void DolphinView::ViewAccessor::deleteView()
// during drag operations" is used). Deleting the view
// during an ongoing drag operation is not allowed, so
// this will postponed.
- if (m_dragSource != 0) {
+ if (m_dragSource) {
// the old stored view is obviously not the drag source anymore
m_dragSource->deleteLater();
m_dragSource = 0;
@@ -1510,22 +1510,22 @@ void DolphinView::ViewAccessor::deleteView()
void DolphinView::ViewAccessor::prepareUrlChange(const KUrl& url)
{
- if (m_columnsContainer != 0) {
+ if (m_columnsContainer) {
m_columnsContainer->showColumn(url);
}
}
QAbstractItemView* DolphinView::ViewAccessor::itemView() const
{
- if (m_iconsView != 0) {
+ if (m_iconsView) {
return m_iconsView;
}
- if (m_detailsView != 0) {
+ if (m_detailsView) {
return m_detailsView;
}
- if (m_columnsContainer != 0) {
+ if (m_columnsContainer) {
return m_columnsContainer->activeColumn();
}
@@ -1539,7 +1539,7 @@ KFileItemDelegate* DolphinView::ViewAccessor::itemDelegate() const
QWidget* DolphinView::ViewAccessor::layoutTarget() const
{
- if (m_columnsContainer != 0) {
+ if (m_columnsContainer) {
return m_columnsContainer;
}
return itemView();
@@ -1552,7 +1552,7 @@ void DolphinView::ViewAccessor::setRootUrl(const KUrl& rootUrl)
KUrl DolphinView::ViewAccessor::rootUrl() const
{
- return (m_columnsContainer != 0) ? m_columnsContainer->rootUrl() : m_rootUrl;
+ return m_columnsContainer ? m_columnsContainer->rootUrl() : m_rootUrl;
}
bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
@@ -1562,12 +1562,12 @@ bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
bool DolphinView::ViewAccessor::itemsExpandable() const
{
- return (m_detailsView != 0) && m_detailsView->itemsExpandable();
+ return m_detailsView && m_detailsView->itemsExpandable();
}
QSet<KUrl> DolphinView::ViewAccessor::expandedUrls() const
{
- if (m_detailsView != 0) {
+ if (m_detailsView) {
return m_detailsView->expandedUrls();
}
@@ -1576,7 +1576,7 @@ QSet<KUrl> DolphinView::ViewAccessor::expandedUrls() const
const DolphinDetailsViewExpander* DolphinView::ViewAccessor::setExpandedUrls(const QSet<KUrl>& urlsToExpand)
{
- if ((m_detailsView != 0) && m_detailsView->itemsExpandable() && !urlsToExpand.isEmpty()) {
+ if (m_detailsView && m_detailsView->itemsExpandable() && !urlsToExpand.isEmpty()) {
// Check if another expander is already active and stop it if necessary.
if(!m_detailsViewExpander.isNull()) {
m_detailsViewExpander->stop();
@@ -1604,7 +1604,7 @@ DolphinModel* DolphinView::ViewAccessor::dirModel() const
DolphinSortFilterProxyModel* DolphinView::ViewAccessor::proxyModel() const
{
- if (m_columnsContainer != 0) {
+ if (m_columnsContainer) {
return static_cast<DolphinSortFilterProxyModel*>(m_columnsContainer->activeColumn()->model());
}
return m_proxyModel;
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index 0959a03f7..6046abc8c 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -320,7 +320,7 @@ KActionCollection* DolphinViewActionHandler::actionCollection()
void DolphinViewActionHandler::updateViewActions()
{
QAction* viewModeAction = m_actionCollection->action(currentViewModeActionName());
- if (viewModeAction != 0) {
+ if (viewModeAction) {
viewModeAction->setChecked(true);
QAction* viewModeMenu = m_actionCollection->action("view_mode");
@@ -484,7 +484,7 @@ void DolphinViewActionHandler::slotSortingChanged(DolphinView::Sorting sorting)
}
}
- if (action != 0) {
+ if (action) {
action->setChecked(true);
QAction* sortByMenu = m_actionCollection->action("sort");
@@ -495,12 +495,12 @@ void DolphinViewActionHandler::slotSortingChanged(DolphinView::Sorting sorting)
void DolphinViewActionHandler::slotZoomLevelChanged(int level)
{
QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
- if (zoomInAction != 0) {
+ if (zoomInAction) {
zoomInAction->setEnabled(level < ZoomLevelInfo::maximumLevel());
}
QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
- if (zoomOutAction != 0) {
+ if (zoomOutAction) {
zoomOutAction->setEnabled(level > ZoomLevelInfo::minimumLevel());
}
}
diff --git a/src/views/dolphinviewautoscroller.cpp b/src/views/dolphinviewautoscroller.cpp
index 4f645d026..5b338cc37 100644
--- a/src/views/dolphinviewautoscroller.cpp
+++ b/src/views/dolphinviewautoscroller.cpp
@@ -131,13 +131,13 @@ void DolphinViewAutoScroller::scrollViewport()
}
QScrollBar* verticalScrollBar = m_itemView->verticalScrollBar();
- if (verticalScrollBar != 0) {
+ if (verticalScrollBar) {
const int value = verticalScrollBar->value();
verticalScrollBar->setValue(value + m_verticalScrollInc);
}
QScrollBar* horizontalScrollBar = m_itemView->horizontalScrollBar();
- if (horizontalScrollBar != 0) {
+ if (horizontalScrollBar) {
const int value = horizontalScrollBar->value();
horizontalScrollBar->setValue(value + m_horizontalScrollInc);
@@ -156,9 +156,9 @@ void DolphinViewAutoScroller::scrollViewport()
void DolphinViewAutoScroller::triggerAutoScroll()
{
- const bool verticalScrolling = (m_itemView->verticalScrollBar() != 0) &&
+ const bool verticalScrolling = m_itemView->verticalScrollBar() &&
m_itemView->verticalScrollBar()->isVisible();
- const bool horizontalScrolling = (m_itemView->horizontalScrollBar() != 0) &&
+ const bool horizontalScrolling = m_itemView->horizontalScrollBar() &&
m_itemView->horizontalScrollBar()->isVisible();
if (!verticalScrolling && !horizontalScrolling) {
// no scrollbars are shown at all, so no autoscrolling is necessary
diff --git a/src/views/dolphinviewcontroller.cpp b/src/views/dolphinviewcontroller.cpp
index f8f27ea38..672cffe65 100644
--- a/src/views/dolphinviewcontroller.cpp
+++ b/src/views/dolphinviewcontroller.cpp
@@ -53,14 +53,14 @@ void DolphinViewController::requestUrlChange(const KUrl& url)
void DolphinViewController::setItemView(QAbstractItemView* view)
{
- if (m_itemView != 0) {
+ if (m_itemView) {
disconnect(m_itemView, SIGNAL(pressed(const QModelIndex&)),
this, SLOT(updateMouseButtonState()));
}
m_itemView = view;
- if (m_itemView != 0) {
+ if (m_itemView) {
// TODO: this is a workaround until Qt-issue 176832 has been fixed
connect(m_itemView, SIGNAL(pressed(const QModelIndex&)),
this, SLOT(updateMouseButtonState()));
@@ -126,7 +126,7 @@ QList<QAction*> DolphinViewController::versionControlActions(const KFileItemList
void DolphinViewController::handleKeyPressEvent(QKeyEvent* event)
{
- if (m_itemView == 0) {
+ if (!m_itemView) {
return;
}
@@ -194,9 +194,9 @@ void DolphinViewController::emitItemTriggered(const KFileItem& item)
KFileItem DolphinViewController::itemForIndex(const QModelIndex& index) const
{
- if (m_itemView != 0) {
+ if (m_itemView) {
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_itemView->model());
- if (proxyModel != 0) {
+ if (proxyModel) {
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
return dirModel->itemForIndex(dirIndex);
@@ -212,7 +212,7 @@ void DolphinViewController::triggerItem(const QModelIndex& index)
const KFileItem item = itemForIndex(index);
if (index.isValid() && (index.column() == KDirModel::Name)) {
emit itemTriggered(item);
- } else if (m_itemView != 0) {
+ } else if (m_itemView) {
m_itemView->clearSelection();
emit itemEntered(KFileItem());
}
diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp
index 24d5156e5..f7508e094 100644
--- a/src/views/draganddrophelper.cpp
+++ b/src/views/draganddrophelper.cpp
@@ -62,11 +62,11 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView,
const QModelIndexList indexes = itemView->selectionModel()->selectedIndexes();
if (!indexes.isEmpty()) {
QMimeData *data = itemView->model()->mimeData(indexes);
- if (data == 0) {
+ if (!data) {
return;
}
- if (dolphinViewController != 0) {
+ if (dolphinViewController) {
dolphinViewController->requestToolTipHiding();
}
@@ -83,7 +83,7 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView,
bool DragAndDropHelper::isDragSource(QAbstractItemView* itemView) const
{
- return (m_dragSource != 0) && (m_dragSource == itemView);
+ return m_dragSource && (m_dragSource == itemView);
}
void DragAndDropHelper::dropUrls(const KFileItem& destItem,
diff --git a/src/views/folderexpander.cpp b/src/views/folderexpander.cpp
index 4e22fdb0a..a9f5971c2 100644
--- a/src/views/folderexpander.cpp
+++ b/src/views/folderexpander.cpp
@@ -39,14 +39,11 @@ FolderExpander::FolderExpander(QAbstractItemView *view, QSortFilterProxyModel *p
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;
}
@@ -100,7 +97,7 @@ void FolderExpander::autoExpandTimeout()
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())) {
@@ -111,7 +108,7 @@ void FolderExpander::autoExpandTimeout()
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));
}
diff --git a/src/views/selectionmanager.cpp b/src/views/selectionmanager.cpp
index 6befc2199..7a9e81412 100644
--- a/src/views/selectionmanager.cpp
+++ b/src/views/selectionmanager.cpp
@@ -71,7 +71,7 @@ bool SelectionManager::eventFilter(QObject* watched, QEvent* event)
if (watched == m_view->viewport()) {
switch (event->type()) {
case QEvent::Leave:
- if (m_toggle != 0) {
+ if (m_toggle) {
m_toggle->hide();
}
restoreCursor();
@@ -81,7 +81,7 @@ bool SelectionManager::eventFilter(QObject* watched, QEvent* event)
// Set the toggle invisible, if a mouse button has been pressed
// outside the toggle boundaries. This e.g. assures, that the toggle
// gets invisible during dragging items.
- if (m_toggle != 0) {
+ if (m_toggle) {
const QRect toggleBounds(m_toggle->mapToGlobal(QPoint(0, 0)), m_toggle->size());
m_toggle->setVisible(toggleBounds.contains(QCursor::pos()));
}
@@ -111,7 +111,7 @@ bool SelectionManager::eventFilter(QObject* watched, QEvent* event)
void SelectionManager::reset()
{
- if (m_toggle != 0) {
+ if (m_toggle) {
m_toggle->reset();
}
}
@@ -147,7 +147,7 @@ void SelectionManager::slotEntered(const QModelIndex& index)
m_connected = false;
}
- if (m_toggle == 0) {
+ if (!m_toggle) {
return;
}
@@ -187,7 +187,7 @@ void SelectionManager::slotEntered(const QModelIndex& index)
void SelectionManager::slotViewportEntered()
{
- if (m_toggle != 0) {
+ if (m_toggle) {
m_toggle->hide();
}
restoreCursor();
@@ -197,7 +197,7 @@ void SelectionManager::setItemSelected(bool selected)
{
emit selectionChanged();
- if ((m_toggle != 0) && !m_toggle->url().isEmpty()) {
+ if (m_toggle && !m_toggle->url().isEmpty()) {
const QModelIndex index = indexForUrl(m_toggle->url());
if (index.isValid()) {
QItemSelectionModel* selModel = m_view->selectionModel();
@@ -216,7 +216,7 @@ void SelectionManager::slotRowsRemoved(const QModelIndex& parent, int start, int
Q_UNUSED(parent);
Q_UNUSED(start);
Q_UNUSED(end);
- if (m_toggle != 0) {
+ if (m_toggle) {
m_toggle->hide();
}
restoreCursor();
@@ -228,7 +228,7 @@ void SelectionManager::slotSelectionChanged(const QItemSelection& selected,
// The selection has been changed outside the scope of the selection manager
// (e. g. by the rubberband or the "Select All" action). Take care updating
// the state of the toggle button.
- if ((m_toggle != 0) && !m_toggle->url().isEmpty()) {
+ if (m_toggle && !m_toggle->url().isEmpty()) {
const QModelIndex index = indexForUrl(m_toggle->url());
if (index.isValid()) {
if (selected.contains(index)) {
diff --git a/src/views/selectiontoggle.cpp b/src/views/selectiontoggle.cpp
index e08a0220e..d602600c5 100644
--- a/src/views/selectiontoggle.cpp
+++ b/src/views/selectiontoggle.cpp
@@ -125,7 +125,7 @@ void SelectionToggle::enterEvent(QEvent* event)
// if the mouse cursor is above the selection toggle, display
// it immediately without fading timer
m_isHovered = true;
- if (m_fadingTimeLine != 0) {
+ if (m_fadingTimeLine) {
m_fadingTimeLine->stop();
}
m_fadingValue = 255;
@@ -192,7 +192,7 @@ void SelectionToggle::setFadingValue(int value)
{
m_fadingValue = value;
if (m_fadingValue >= 255) {
- Q_ASSERT(m_fadingTimeLine != 0);
+ Q_ASSERT(m_fadingTimeLine);
m_fadingTimeLine->stop();
}
update();
@@ -215,7 +215,7 @@ void SelectionToggle::refreshIcon()
void SelectionToggle::startFading()
{
- Q_ASSERT(m_fadingTimeLine == 0);
+ Q_ASSERT(!m_fadingTimeLine);
const bool animate = KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects;
const int duration = animate ? 600 : 1;
@@ -230,7 +230,7 @@ void SelectionToggle::startFading()
void SelectionToggle::stopFading()
{
- if (m_fadingTimeLine != 0) {
+ if (m_fadingTimeLine) {
m_fadingTimeLine->stop();
delete m_fadingTimeLine;
m_fadingTimeLine = 0;
diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp
index 0705d09b2..cef553060 100644
--- a/src/views/tooltips/filemetadatatooltip.cpp
+++ b/src/views/tooltips/filemetadatatooltip.cpp
@@ -84,7 +84,7 @@ void FileMetaDataToolTip::setPreview(const QPixmap& pixmap)
QPixmap FileMetaDataToolTip::preview() const
{
- if (m_preview->pixmap() != 0) {
+ if (m_preview->pixmap()) {
return *m_preview->pixmap();
}
return QPixmap();
diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp
index fdf83d13d..cb86b3355 100644
--- a/src/views/tooltips/tooltipmanager.cpp
+++ b/src/views/tooltips/tooltipmanager.cpp
@@ -51,7 +51,7 @@ ToolTipManager::ToolTipManager(QAbstractItemView* parent,
m_enabledPlugins()
{
static FileMetaDataToolTip* sharedToolTip = 0;
- if (sharedToolTip == 0) {
+ if (!sharedToolTip) {
sharedToolTip = new FileMetaDataToolTip();
// TODO: Using K_GLOBAL_STATIC would be preferable to maintain the
// instance, but the cleanup of KFileMetaDataWidget at this stage does
diff --git a/src/views/versioncontrol/pendingthreadsmaintainer.cpp b/src/views/versioncontrol/pendingthreadsmaintainer.cpp
index fc463aeb3..ee143a94a 100644
--- a/src/views/versioncontrol/pendingthreadsmaintainer.cpp
+++ b/src/views/versioncontrol/pendingthreadsmaintainer.cpp
@@ -41,7 +41,7 @@ PendingThreadsMaintainer::~PendingThreadsMaintainer()
void PendingThreadsMaintainer::append(QThread* thread)
{
- Q_ASSERT(thread != 0);
+ Q_ASSERT(thread);
m_threads.append(thread);
m_timer->start();
}
diff --git a/src/views/versioncontrol/pendingthreadsmaintainer.h b/src/views/versioncontrol/pendingthreadsmaintainer.h
index a1ad35516..3e99c8657 100644
--- a/src/views/versioncontrol/pendingthreadsmaintainer.h
+++ b/src/views/versioncontrol/pendingthreadsmaintainer.h
@@ -38,7 +38,7 @@ class QTimer;
* \code
* ThreadCreator::~ThreadCreator()
* {
- * if (m_thread != 0) {
+ * if (m_thread) {
* PendingThreadsMaintainer::instance().append(m_thread);
* m_thread = 0;
* }
diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp
index b04d66f17..e6bd761cc 100644
--- a/src/views/versioncontrol/updateitemstatesthread.cpp
+++ b/src/views/versioncontrol/updateitemstatesthread.cpp
@@ -53,7 +53,7 @@ void UpdateItemStatesThread::setData(KVersionControlPlugin* plugin,
void UpdateItemStatesThread::run()
{
Q_ASSERT(!m_itemStates.isEmpty());
- Q_ASSERT(m_plugin != 0);
+ Q_ASSERT(m_plugin);
// The items from m_itemStates may be located in different directory levels. The version
// plugin requires the root directory for KVersionControlPlugin::beginRetrieval(). Instead
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp
index 26528f974..62f50f30b 100644
--- a/src/views/versioncontrol/versioncontrolobserver.cpp
+++ b/src/views/versioncontrol/versioncontrolobserver.cpp
@@ -49,13 +49,14 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
m_plugin(0),
m_updateItemStatesThread(0)
{
- Q_ASSERT(view != 0);
+ Q_ASSERT(view);
QAbstractProxyModel* proxyModel = qobject_cast<QAbstractProxyModel*>(view->model());
- m_dolphinModel = (proxyModel == 0) ?
- qobject_cast<DolphinModel*>(view->model()) :
- qobject_cast<DolphinModel*>(proxyModel->sourceModel());
- if (m_dolphinModel != 0) {
+ m_dolphinModel = proxyModel ?
+ qobject_cast<DolphinModel*>(proxyModel->sourceModel()) :
+ qobject_cast<DolphinModel*>(view->model());
+
+ if (m_dolphinModel) {
m_dirLister = m_dolphinModel->dirLister();
connect(m_dirLister, SIGNAL(completed()),
this, SLOT(delayedDirectoryVerification()));
@@ -75,7 +76,7 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
VersionControlObserver::~VersionControlObserver()
{
- if (m_updateItemStatesThread != 0) {
+ if (m_updateItemStatesThread) {
if (m_updateItemStatesThread->isFinished()) {
delete m_updateItemStatesThread;
m_updateItemStatesThread = 0;
@@ -91,7 +92,7 @@ VersionControlObserver::~VersionControlObserver()
}
}
- if (m_plugin != 0) {
+ if (m_plugin) {
m_plugin->disconnect();
m_plugin = 0;
}
@@ -137,12 +138,12 @@ void VersionControlObserver::verifyDirectory()
return;
}
- if (m_plugin != 0) {
+ if (m_plugin) {
m_plugin->disconnect();
}
m_plugin = searchPlugin(versionControlUrl);
- if (m_plugin != 0) {
+ if (m_plugin) {
connect(m_plugin, SIGNAL(versionStatesChanged()),
this, SLOT(silentDirectoryVerification()));
connect(m_plugin, SIGNAL(infoMessage(QString)),
@@ -180,7 +181,7 @@ void VersionControlObserver::verifyDirectory()
void VersionControlObserver::slotThreadFinished()
{
- if (m_plugin == 0) {
+ if (!m_plugin) {
return;
}
@@ -222,8 +223,8 @@ void VersionControlObserver::slotThreadFinished()
void VersionControlObserver::updateItemStates()
{
- Q_ASSERT(m_plugin != 0);
- if (m_updateItemStatesThread == 0) {
+ Q_ASSERT(m_plugin);
+ if (!m_updateItemStatesThread) {
m_updateItemStatesThread = new UpdateItemStatesThread();
connect(m_updateItemStatesThread, SIGNAL(finished()),
this, SLOT(slotThreadFinished()));
@@ -282,7 +283,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) {
if (enabledPlugins.contains((*it)->name())) {
KVersionControlPlugin* plugin = (*it)->createInstance<KVersionControlPlugin>();
- if (plugin != 0) {
+ if (plugin) {
plugins.append(plugin);
}
}
@@ -330,7 +331,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
bool VersionControlObserver::isVersioned() const
{
- return m_dolphinModel->hasVersionData() && (m_plugin != 0);
+ return m_dolphinModel->hasVersionData() && m_plugin;
}
#include "versioncontrolobserver.moc"
diff --git a/src/views/viewextensionsfactory.cpp b/src/views/viewextensionsfactory.cpp
index adf9da3fc..1a395dea9 100644
--- a/src/views/viewextensionsfactory.cpp
+++ b/src/views/viewextensionsfactory.cpp
@@ -155,7 +155,7 @@ bool ViewExtensionsFactory::autoFolderExpandingEnabled() const
bool ViewExtensionsFactory::eventFilter(QObject* watched, QEvent* event)
{
Q_UNUSED(watched);
- if ((event->type() == QEvent::Wheel) && (m_selectionManager != 0)) {
+ if ((event->type() == QEvent::Wheel) && m_selectionManager) {
m_selectionManager->reset();
}
return false;
@@ -164,7 +164,7 @@ bool ViewExtensionsFactory::eventFilter(QObject* watched, QEvent* event)
void ViewExtensionsFactory::slotZoomLevelChanged()
{
m_previewGenerator->updateIcons();
- if (m_selectionManager != 0) {
+ if (m_selectionManager) {
m_selectionManager->reset();
}
}