Use line edit widget for search edit.

This commit is contained in:
Florian Geyer 2012-05-20 21:09:34 +02:00
parent e5e7e5e406
commit 9faf550fa1
4 changed files with 10 additions and 17 deletions

View File

@ -122,7 +122,6 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer())); connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer()));
connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search())); connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search()));
connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch())); connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch()));
connect(m_searchUi->clearSearchButton, SIGNAL(clicked()), this, SLOT(clearSearchEdit()));
setCurrentIndex(0); setCurrentIndex(0);
} }
@ -384,12 +383,6 @@ void DatabaseWidget::showSearch()
m_searchUi->searchEdit->setFocus(); m_searchUi->searchEdit->setFocus();
} }
void DatabaseWidget::clearSearchEdit()
{
m_searchUi->searchEdit->clear();
m_searchUi->searchEdit->setFocus();
}
void DatabaseWidget::search() void DatabaseWidget::search()
{ {
Group* searchGroup = m_db->rootGroup(); Group* searchGroup = m_db->rootGroup();

View File

@ -83,7 +83,6 @@ private Q_SLOTS:
void updateMasterKey(bool accepted); void updateMasterKey(bool accepted);
void emitCurrentModeChanged(); void emitCurrentModeChanged();
void clearLastGroup(Group* group); void clearLastGroup(Group* group);
void clearSearchEdit();
void search(); void search();
void startSearchTimer(); void startSearchTimer();
void showSearch(); void showSearch();

View File

@ -32,17 +32,17 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="searchEdit"/> <widget class="LineEdit" name="searchEdit"/>
</item>
<item>
<widget class="QPushButton" name="clearSearchButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>LineEdit</class>
<extends>QLineEdit</extends>
<header>gui/LineEdit.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -24,6 +24,7 @@
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
#include <QtGui/QToolBar> #include <QtGui/QToolBar>
#include <QtGui/QToolButton>
#include "config-keepassx-tests.h" #include "config-keepassx-tests.h"
#include "tests.h" #include "tests.h"
@ -166,7 +167,7 @@ void TestGui::testSearch()
EntryView* entryView = dbWidget->findChild<EntryView*>("entryView"); EntryView* entryView = dbWidget->findChild<EntryView*>("entryView");
QLineEdit* searchEdit = dbWidget->findChild<QLineEdit*>("searchEdit"); QLineEdit* searchEdit = dbWidget->findChild<QLineEdit*>("searchEdit");
QPushButton* clearSearch = dbWidget->findChild<QPushButton*>("clearSearchButton"); QToolButton* clearSearch = dbWidget->findChild<QToolButton*>("clearButton");
QTest::keyClicks(searchEdit, "ZZZ"); QTest::keyClicks(searchEdit, "ZZZ");
QTest::qWait(120); QTest::qWait(120);