- m_searchInput->setMinimumWidth(150);
- m_searchInput->setClickMessage(i18nc("@label:textbox", "Search..."));
- m_searchInput->installEventFilter(this);
- hLayout->addWidget(m_searchInput);
- connect(m_searchInput, SIGNAL(returnPressed()),
- this, SLOT(emitSearchSignal()));
-
- m_searchButton = new QToolButton(this);
- m_searchButton->setAutoRaise(true);
- m_searchButton->setIcon(KIcon("edit-find"));
- m_searchButton->setToolTip(i18nc("@info:tooltip", "Click to begin the search"));
- hLayout->addWidget(m_searchButton);
- connect(m_searchButton, SIGNAL(clicked()),
- this, SLOT(emitSearchSignal()));
+ m_searchInput->setFont(KGlobalSettings::generalFont());
+ connect(m_searchInput, SIGNAL(returnPressed(QString)),
+ this, SLOT(slotReturnPressed(QString)));
+ connect(m_searchInput, SIGNAL(textChanged(QString)),
+ this, SLOT(slotSearchTextChanged(QString)));
+
+ // Apply layout for the search input
+ QHBoxLayout* searchInputLayout = new QHBoxLayout();
+ searchInputLayout->setMargin(0);
+ searchInputLayout->addWidget(closeButton);
+ searchInputLayout->addWidget(searchLabel);
+ searchInputLayout->addWidget(m_searchInput);
+
+ // Create "From Here" and "Everywhere"button
+ m_fromHereButton = new QPushButton();
+ m_fromHereButton->setText(i18nc("action:button", "From Here"));
+ initButton(m_fromHereButton);
+
+ m_everywhereButton = new QPushButton(this);
+ m_everywhereButton->setText(i18nc("action:button", "Everywhere"));
+ initButton(m_everywhereButton);
+
+ QButtonGroup* searchLocationGroup = new QButtonGroup(this);
+ searchLocationGroup->addButton(m_fromHereButton);
+ searchLocationGroup->addButton(m_everywhereButton);
+
+ // Create "Filename" and "Content" button
+ m_fileNameButton = new QPushButton(this);
+ m_fileNameButton->setText(i18nc("action:button", "Filename"));
+ initButton(m_fileNameButton);
+
+ m_contentButton = new QPushButton();
+ m_contentButton->setText(i18nc("action:button", "Content"));
+ initButton(m_contentButton);;
+
+ QButtonGroup* searchWhatGroup = new QButtonGroup(this);
+ searchWhatGroup->addButton(m_fileNameButton);
+ searchWhatGroup->addButton(m_contentButton);
+
+ // Create "Filter" button
+ m_filterButton = new QToolButton(this);
+ m_filterButton->setIcon(KIcon("view-filter"));
+ m_filterButton->setAutoRaise(true);
+ m_filterButton->setCheckable(true);
+ m_filterButton->hide();
+ connect(m_filterButton, SIGNAL(toggled(bool)), this, SLOT(setFilterWidgetsVisible(bool)));
+
+ // Apply layout for the options
+ QHBoxLayout* optionsLayout = new QHBoxLayout();
+ optionsLayout->setMargin(0);
+ optionsLayout->addWidget(m_fromHereButton);
+ optionsLayout->addWidget(m_everywhereButton);
+ optionsLayout->addWidget(new KSeparator(Qt::Vertical));
+ optionsLayout->addWidget(m_fileNameButton);
+ optionsLayout->addWidget(m_contentButton);
+ optionsLayout->addStretch(1);
+ optionsLayout->addWidget(m_filterButton);
+
+ m_topLayout = new QVBoxLayout(this);
+ m_topLayout->addLayout(searchInputLayout);
+ m_topLayout->addLayout(optionsLayout);
+
+ searchLabel->setBuddy(m_searchInput);
+ loadSettings();
+
+ // The searching should be started automatically after the user did not change
+ // the text within one second
+ m_startSearchTimer = new QTimer(this);
+ m_startSearchTimer->setSingleShot(true);
+ m_startSearchTimer->setInterval(1000);
+ connect(m_startSearchTimer, SIGNAL(timeout()), this, SLOT(emitSearchSignal()));