mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
Save and restore the text selection.
BUG: 147896 FIXED-IN 4.8.0
This commit is contained in:
parent
839b15e4ff
commit
0379fd8b7f
|
@ -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()
|
||||
|
|
|
@ -104,6 +104,7 @@ private:
|
|||
int m_cursorPos;
|
||||
int m_currentIndex;
|
||||
QString m_currentText;
|
||||
QString m_selectedText;
|
||||
QPoint m_dragStart;
|
||||
int m_pageSecurity;
|
||||
|
||||
|
|
Loading…
Reference in a new issue