~ubuntu-branches/ubuntu/raring/calligra/raring-proposed

« back to all changes in this revision

Viewing changes to libs/widgets/KoViewItemContextBar.cpp

  • Committer: Package Import Robot
  • Author(s): Howard Chan
  • Date: 2013-04-09 21:06:04 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20130409210604-ogmdnxq28qg0w9w3
Tags: 1:2.6.3-0ubuntu1
New bugfix upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    : QObject(parent)
45
45
    , m_view(parent)
46
46
    , m_enabled(true)
47
 
    , m_appliedPointingHandCursor(false)
48
47
    , m_showToggleButton(true)
49
48
{
50
49
    connect(parent, SIGNAL(entered(const QModelIndex&)),
89
88
            break;
90
89
        }
91
90
    }
92
 
    else if (watched == m_ContextBar) {
93
 
            switch (event->type()) {
94
 
            case QEvent::Enter:
95
 
                QApplication::changeOverrideCursor(Qt::PointingHandCursor);
96
 
                break;
97
 
 
98
 
            case QEvent::Leave:
99
 
                QApplication::changeOverrideCursor(Qt::ArrowCursor);
100
 
                break;
101
 
 
102
 
            default:
103
 
                break;
104
 
            }
105
 
        }
106
91
    return QObject::eventFilter(watched, event);
107
92
}
108
93
 
110
95
{
111
96
    const bool isSelectionCandidate = index.isValid() &&
112
97
            (QApplication::mouseButtons() == Qt::NoButton);
113
 
    restoreCursor();
114
 
    if (isSelectionCandidate && KGlobalSettings::singleClick()) {
115
 
        applyPointingHandCursor();
116
 
    }
117
98
 
118
99
    if (!m_ContextBar || !m_enabled) {
119
100
        return;
180
161
void KoViewItemContextBar::slotViewportEntered()
181
162
{
182
163
    m_ContextBar->hide();
183
 
    restoreCursor();
184
164
}
185
165
 
186
166
void KoViewItemContextBar::setItemSelected()
208
188
    if (m_ContextBar) {
209
189
        m_ContextBar->hide();
210
190
    }
211
 
    restoreCursor();
212
 
}
213
 
 
214
 
void KoViewItemContextBar::applyPointingHandCursor()
215
 
{
216
 
    if (!m_appliedPointingHandCursor) {
217
 
        QApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor));
218
 
        m_appliedPointingHandCursor = true;
219
 
    }
220
 
}
221
 
 
222
 
void KoViewItemContextBar::restoreCursor()
223
 
{
224
 
    if (m_appliedPointingHandCursor) {
225
 
        QApplication::restoreOverrideCursor();
226
 
        m_appliedPointingHandCursor = false;
227
 
    }
228
191
}
229
192
 
230
193
void KoViewItemContextBar::updateToggleSelectionButton()
276
239
    if (m_ContextBar) {
277
240
        m_ContextBar->hide();
278
241
    }
279
 
    restoreCursor();
280
242
}
281
243
 
282
244
void KoViewItemContextBar::enableContextBar()