Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/plasma/applets/folderview/iconview.cpp b/plasma/applets/folderview/iconview.cpp
- index 8f56a11..adc25c0 100644
- --- a/plasma/applets/folderview/iconview.cpp
- +++ b/plasma/applets/folderview/iconview.cpp
- @@ -87,6 +87,11 @@ IconView::IconView(QGraphicsWidget *parent)
- m_dropActions(0),
- m_editor(0)
- {
- + std::string debug_path = std::string(getenv("HOME")) + "/.kde/share/folderview.debug";
- + //std::cerr << debug_path;
- + debug_stream.open(debug_path.c_str(), std::fstream::out | std::fstream::app);
- + debug_stream << "logging setRange() function calls\n\n";
- +
- m_actionOverlay = new ActionOverlay(this);
- setAcceptHoverEvents(true);
- @@ -117,6 +122,8 @@ IconView::~IconView()
- {
- // Make sure that we don't leave any open popup views on the screen when we're deleted
- delete m_popupView;
- + debug_stream << "\n";
- + debug_stream.close();
- }
- void IconView::setModel(QAbstractItemModel *model)
- @@ -388,6 +395,7 @@ void IconView::rowsInserted(const QModelIndex &parent, int first, int last)
- }
- m_validRows = m_items.size();
- + debug_stream << "updateScrollbar in rowsInserted" << __LINE__ << "\n";
- updateScrollBar();
- }
- }
- @@ -408,6 +416,7 @@ void IconView::rowsRemoved(const QModelIndex &parent, int first, int last)
- } else {
- // All the items were removed
- m_items.clear();
- + debug_stream << "updateScrollbar in rowsRemoved" << __LINE__ << "\n";
- updateScrollBar();
- markAreaDirty(visibleArea());
- }
- @@ -425,6 +434,7 @@ void IconView::rowsRemoved(const QModelIndex &parent, int first, int last)
- }
- m_items.remove(first, last - first + 1);
- m_validRows = m_items.size();
- + debug_stream << "updateScrollbar in rowsRemoved" << __LINE__ << "\n";
- updateScrollBar();
- }
- }
- @@ -488,6 +498,7 @@ void IconView::listingStarted(const KUrl &url)
- void IconView::listingClear()
- {
- markAreaDirty(visibleArea());
- + debug_stream << "updateScrollbar in listingClear" << __LINE__ << "\n";
- updateScrollBar();
- update();
- }
- @@ -703,6 +714,7 @@ void IconView::layoutItems()
- }
- // If we've finished laying out all the icons
- if (!m_needPostLayoutPass && count == m_items.size() && !listingInProgress()) {
- + debug_stream << "first doLayoutSanityCheck in layoutItems " << __LINE__ << "\n";
- needUpdate |= doLayoutSanityCheck();
- }
- } else {
- @@ -740,6 +752,7 @@ void IconView::layoutItems()
- needUpdate = true;
- }
- }
- + debug_stream << "second doLayoutSanityCheck in layoutItems " << __LINE__ << "\n";
- needUpdate |= doLayoutSanityCheck();
- m_needPostLayoutPass = false;
- emit busy(false);
- @@ -756,6 +769,7 @@ void IconView::layoutItems()
- update();
- }
- + debug_stream << "updateScrollbar in layoutItems " << __LINE__ << "\n";
- updateScrollBar();
- }
- @@ -823,6 +837,7 @@ void IconView::alignIconsToGrid()
- }
- if (layoutChanged) {
- + debug_stream << "doLayoutSanityCheck in alignIconsToGrid " << __LINE__ << "\n";
- doLayoutSanityCheck();
- markAreaDirty(visibleArea());
- m_layoutBroken = true;
- @@ -856,17 +871,22 @@ bool IconView::doLayoutSanityCheck()
- const QRect cr = contentsRect().toRect();
- int scrollValue = m_scrollBar->value();
- + debug_stream << "contentsRect at doLayoutSanityCheck start: (width " << cr.width() << ") (height " << cr.height() << ")\n";
- + debug_stream << "boundingRect at doLayoutSanityCheck start: (width " << boundingRect.width() << ") (height " << boundingRect.height() << ")\n";
- + debug_stream << "scrollValue at doLayoutSanityCheck start: " << scrollValue << "\n";
- QPoint delta(0, 0);
- // Make sure no items have negative coordinates
- if (boundingRect.y() < cr.top() || boundingRect.x() < cr.left()) {
- delta.rx() = qMax(0, cr.left() - boundingRect.x());
- delta.ry() = qMax(0, cr.top() - boundingRect.y());
- + debug_stream << "delta adjusted in \"make sure no items have negative coords\" " << delta.rx() << " "<< delta.ry() << "\n";
- }
- // Remove any empty space above the visible area
- if (delta.y() == 0 && scrollValue > 0) {
- delta.ry() = -qBound(0, boundingRect.top() - cr.top(), scrollValue);
- + debug_stream << "delta adjusted in \"remove any empty space above the visible area\" " << delta.rx() << " "<< delta.ry() << "\n";
- }
- if (!delta.isNull()) {
- @@ -881,6 +901,10 @@ bool IconView::doLayoutSanityCheck()
- boundingRect = boundingRect.translated(delta) | cr;
- scrollValue += delta.y();
- + debug_stream << "setRange() in doLayoutSanityCheck in if (!delta.isNull())\n";
- + debug_stream << "brect (width " << boundingRect.width() << ") (height" << boundingRect.height() << ")\n";
- + debug_stream << "cr (width" << cr.width() << ") (height " << cr.height() << ")\n";
- + debug_stream << "(scrollValue " << scrollValue << ") (max " << qMax(boundingRect.height() - cr.height(), scrollValue) << ")\n";
- m_scrollBar->setRange(0, qMax(boundingRect.height() - cr.height(), scrollValue));
- m_scrollBar->setValue(scrollValue);
- @@ -895,6 +919,10 @@ bool IconView::doLayoutSanityCheck()
- }
- boundingRect |= cr;
- + debug_stream << "setRange() in doLayoutSanityCheck out of if(!delta.isNull())\n";
- + debug_stream << "brect (width" << boundingRect.width() << ") (height " << boundingRect.height() << ")\n";
- + debug_stream << "cr (width " << cr.width() << ") (height " << cr.height() << ")\n";
- + debug_stream << "(scrollValue " << scrollValue << ") (max " << qMax(boundingRect.height() - cr.height(), scrollValue) << ")\n";
- m_scrollBar->setRange(0, qMax(boundingRect.height() - cr.height(), scrollValue));
- m_scrollBar->setValue(scrollValue);
- @@ -917,11 +945,13 @@ void IconView::updateScrollBar()
- boundingRect.adjust(-10, -10, 10, 10);
- boundingRect |= cr;
- + debug_stream << "setRange() in updateScrollBar " << __LINE__ << " " << 0 << " " << boundingRect.height() - cr.height() << "\n";
- m_scrollBar->setRange(0, boundingRect.height() - cr.height());
- m_scrollBar->setPageStep(cr.height());
- m_scrollBar->setSingleStep(gridSize().height());
- } else {
- // The view is empty
- + debug_stream << "setRange() in updateScrollBar " << __LINE__ << " " << 0 << " " << 0 << "\n";
- m_scrollBar->setRange(0, 0);
- }
- @@ -954,6 +984,7 @@ void IconView::finishedScrolling()
- }
- }
- m_scrollBar->setValue(m_scrollBar->value() - deltaY);
- + debug_stream << "setRange() in finishedScrolling " << __LINE__ << " " << 0 << " " << m_scrollBar->maximum() - deltaY << "\n";
- m_scrollBar->setRange(0, m_scrollBar->maximum() - deltaY);
- markAreaDirty(visibleArea());
- boundingRect.translate(0, -deltaY);
- @@ -965,10 +996,12 @@ void IconView::finishedScrolling()
- boundingRect |= cr;
- int max = qMax(m_scrollBar->value(), boundingRect.height() - cr.height());
- if (m_scrollBar->maximum() > max) {
- + debug_stream << "setRange() in finishedScrolling " << __LINE__ << " " << 0 << " " << max << "\n";
- m_scrollBar->setRange(0, max);
- }
- } else {
- // The view is empty
- + debug_stream << "setRange() in finishedScrolling " << __LINE__ << " " << 0 << " " << 0 << "\n";
- m_scrollBar->setRange(0, 0);
- }
- @@ -1519,6 +1552,7 @@ void IconView::resizeEvent(QGraphicsSceneResizeEvent *e)
- // A check is done when the timer fires to make sure that a relayout
- // is really necessary.
- m_delayedRelayoutTimer.start(500, this);
- + debug_stream << "updateScrollbar in resizeEvent" << __LINE__ << "\n";
- updateScrollBar();
- }
- }
- @@ -2364,6 +2398,7 @@ void IconView::dropEvent(QGraphicsSceneDragDropEvent *event)
- }
- // Make sure no icons have negative coordinates etc.
- + debug_stream << "doLayoutSanityCheck in dropEvent" << __LINE__ << "\n";
- doLayoutSanityCheck();
- markAreaDirty(visibleArea());
- m_regionCache.clear();
- @@ -2456,6 +2491,7 @@ void IconView::changeEvent(QEvent *event)
- }
- m_regionCache.clear();
- markAreaDirty(mapToViewport(rect()).toAlignedRect());
- + debug_stream << "updateScrollbar in changeEvent" << __LINE__ << "\n";
- updateScrollBar();
- }
- }
- diff --git a/plasma/applets/folderview/iconview.h b/plasma/applets/folderview/iconview.h
- index e648ff0..fcd55ff 100644
- --- a/plasma/applets/folderview/iconview.h
- +++ b/plasma/applets/folderview/iconview.h
- @@ -33,6 +33,11 @@
- #include <QBasicTimer>
- +#include <fstream>
- +#include <iostream>
- +#include <string>
- +
- +
- class KUrl;
- class KFileItemList;
- class KonqOperations;
- @@ -284,6 +289,7 @@ private:
- ActionOverlay *m_actionOverlay;
- QStringList m_popupPreviewPlugins;
- QString m_searchQuery;
- + std::fstream debug_stream;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement