Save and restore the text selection.

BUG: 147896
FIXED-IN 4.8.0
This commit is contained in:
Dawit Alemayehu 2012-01-04 13:13:22 -05:00
parent 839b15e4ff
commit 0379fd8b7f
2 changed files with 12 additions and 1 deletions

View file

@ -292,13 +292,23 @@ void KonqCombo::saveState()
{
m_cursorPos = cursorPosition();
m_currentText = currentText();
m_selectedText = lineEdit()->selectedText();
m_currentIndex = currentIndex();
}
void KonqCombo::restoreState()
{
setTemporary( m_currentText );
lineEdit()->setCursorPosition( m_cursorPos );
if (m_selectedText.isEmpty()) {
lineEdit()->setCursorPosition( m_cursorPos );
} else {
const int index = m_currentText.indexOf(m_selectedText);
if (index == -1) {
lineEdit()->setCursorPosition( m_cursorPos );
} else {
lineEdit()->setSelection(index, m_selectedText.length());
}
}
}
void KonqCombo::updatePixmaps()

View file

@ -104,6 +104,7 @@ private:
int m_cursorPos;
int m_currentIndex;
QString m_currentText;
QString m_selectedText;
QPoint m_dragStart;
int m_pageSecurity;