~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to apps/dolphin/src/dolphinviewautoscroller.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-12-19 18:29:39 UTC
  • mfrom: (1.1.36 upstream)
  • Revision ID: james.westby@ubuntu.com-20091219182939-i4q5c16348k7vxuk
Tags: 4:4.3.85-0ubuntu1
* New upstream release
  - Bump build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    QObject(parent),
33
33
    m_rubberBandSelection(false),
34
34
    m_keyPressed(false),
 
35
    m_initializedTimestamp(false),
35
36
    m_horizontalScrollInc(0),
36
37
    m_verticalScrollInc(0),
37
38
    m_itemView(parent),
38
 
    m_timer(0)
 
39
    m_timer(0),
 
40
    m_timestamp()
39
41
{
40
42
    m_itemView->setAutoScroll(false);
41
43
    m_itemView->viewport()->installEventFilter(this);
124
126
 
125
127
void DolphinViewAutoScroller::scrollViewport()
126
128
{
 
129
    if (m_timestamp.elapsed() < QApplication::startDragTime()) {
 
130
        return;
 
131
    }
 
132
 
127
133
    QScrollBar* verticalScrollBar = m_itemView->verticalScrollBar();
128
134
    if (verticalScrollBar != 0) {
129
135
        const int value = verticalScrollBar->value();
156
162
                                     m_itemView->horizontalScrollBar()->isVisible();
157
163
    if (!verticalScrolling && !horizontalScrolling) {
158
164
        // no scrollbars are shown at all, so no autoscrolling is necessary
 
165
        stopAutoScroll();
159
166
        return;
160
167
    }
161
168
 
170
177
 
171
178
    if (m_timer->isActive()) {
172
179
        if ((m_horizontalScrollInc == 0) && (m_verticalScrollInc == 0)) {
173
 
            m_timer->stop();
 
180
            stopAutoScroll();
174
181
        }
175
182
    } else if ((m_horizontalScrollInc != 0) || (m_verticalScrollInc != 0)) {
 
183
        if (!m_initializedTimestamp) {
 
184
            m_initializedTimestamp = true;
 
185
            m_timestamp.start();
 
186
        }
176
187
        m_timer->start();
177
188
    }
178
189
}
182
193
    m_timer->stop();
183
194
    m_horizontalScrollInc = 0;
184
195
    m_verticalScrollInc = 0;
 
196
    m_initializedTimestamp = false;
185
197
}
186
198
 
187
199
int DolphinViewAutoScroller::calculateScrollIncrement(int cursorPos, int rangeSize) const