[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui
From: David Faure <faure () kde ! org>
Date: 2006-07-18 15:51:11
Message-ID: 1153237871.177651.2645.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 563823 by dfaure:
Forwardport fix for 130831: remember when the last replacement text was the empty string
M +6 -1 findreplace/kreplacedialog.cpp
M +25 -0 tests/kreplacetest.cpp
--- trunk/KDE/kdelibs/kdeui/findreplace/kreplacedialog.cpp #563822:563823
@@ -29,6 +29,7 @@
#include <kcombobox.h>
#include <klocale.h>
#include <kmessagebox.h>
+#include <kdebug.h>
/**
* we need to insert the strings after the dialog is set
@@ -102,7 +103,11 @@
QStringList KReplaceDialog::replacementHistory() const
{
- return m_replace->historyItems();
+ QStringList lst = m_replace->historyItems();
+ // historyItems() doesn't tell us about the case of replacing with an empty string
+ if ( m_replace->lineEdit()->text().isEmpty() )
+ lst.prepend( QString() );
+ return lst;
}
void KReplaceDialog::setOptions(long options)
--- trunk/KDE/kdelibs/kdeui/tests/kreplacetest.cpp #563822:563823
@@ -246,12 +246,37 @@
}
}
+static void testReplacementHistory( const QStringList& findHistory, const QStringList& replaceHistory )
+{
+ KReplaceDialog dlg( 0, 0, 0, findHistory, replaceHistory );
+ dlg.show();
+ kDebug() << "testReplacementHistory:" << dlg.replacementHistory() << endl;
+ assert( dlg.replacementHistory() == replaceHistory );
+}
+
+static void testReplacementHistory()
+{
+ QStringList findHistory;
+ QStringList replaceHistory;
+ findHistory << "foo" << "bar";
+ replaceHistory << "FOO" << "BAR";
+ testReplacementHistory( findHistory, replaceHistory );
+
+ findHistory.clear();
+ replaceHistory.clear();
+ findHistory << "foo" << "bar";
+ replaceHistory << QString() << "baz"; // #130831
+ testReplacementHistory( findHistory, replaceHistory );
+}
+
int main( int argc, char **argv )
{
KCmdLineArgs::init(argc, argv, "kreplacetest", "KReplaceTest", "kreplace test", 0);
//KApplication::disableAutoDcopRegistration();
KApplication app;
+ testReplacementHistory(); // #130831
+
testReplaceBlank( 0 );
testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialog::User3 ); // replace
testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialog::User1 ); // replace all
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic