Commit 36df9814 authored by Joachim Eibl's avatar Joachim Eibl

Find dialog: Select text (by Eike Sauer)

If text is selected in either input or output window use that text in find dialog.

git-svn-id: https://kdiff3.svn.sourceforge.net/svnroot/kdiff3/trunk@161 c8aa9fed-2811-0410-8543-893ada326672
parent 277cf202
......@@ -7,6 +7,10 @@
- Fixed mouse wheel problem. (Patch by David Hay)
- Change an encoding in diff text window via click on encoding label. (Patch by Alexey Kostromin)
- Fix for tab-key moving focus instead of adding a tab character in MergeResultWindow.
- Regression test framework (by Maurice van der Pot)
- Documentation patch (by Burkard Lück)
- Select text in Find dialog (by Eike Sauer)
- If text is selected in either input or output window use that in Find dialog.
Version 0.9.96 - 2011-09-02
===========================
......
......@@ -1866,6 +1866,17 @@ void KDiff3App::slotEditFind()
m_pFindDialog->currentLine = 0;
m_pFindDialog->currentPos = 0;
m_pFindDialog->currentWindow = 1;
// Use currently selected text:
QString s;
if ( m_pDiffTextWindow1!=0 ) s = m_pDiffTextWindow1->getSelection();
if ( s.isNull() && m_pDiffTextWindow2!=0 ) s = m_pDiffTextWindow2->getSelection();
if ( s.isNull() && m_pDiffTextWindow3!=0 ) s = m_pDiffTextWindow3->getSelection();
if ( s.isNull() && m_pMergeResultWindow!=0 ) s = m_pMergeResultWindow->getSelection();
if ( !s.isNull() && !s.contains('\n') )
{
m_pFindDialog->m_pSearchString->setText( s );
}
if ( QDialog::Accepted == m_pFindDialog->exec() )
{
......
......@@ -400,6 +400,12 @@ FindDialog::FindDialog(QWidget* pParent)
hide();
}
void FindDialog::setVisible( bool bVisible )
{
QDialog::setVisible( bVisible );
m_pSearchString->selectAll();
m_pSearchString->setFocus();
}
RegExpTester::RegExpTester( QWidget* pParent, const QString& autoMergeRegExpToolTip,
const QString& historyStartRegExpToolTip, const QString& historyEntryStartRegExpToolTip, const QString& historySortKeyOrderToolTip )
......
......@@ -69,6 +69,7 @@ class FindDialog : public QDialog
Q_OBJECT
public:
FindDialog(QWidget* pParent);
void setVisible(bool); //override QDialog::setVisible()
signals:
void findNext();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment