foreach (const Nepomuk::Tag& tag, tags) {
const QString tagText = tag.label();
addCompletionItem(tagText,
- "tag:\"" + tagText + '\"',
- i18nc("Tag as in Nepomuk::Tag", "Tag"),
+ "hasTag:\"" + tagText + '\"',
+ i18nc("Tag as in Nepomuk::Tag", "Tag"), // TODO: change to "hasTag" after msg freeze
QString(),
KIcon("mail-tagged"));
}
DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
QWidget(parent),
m_searchInput(0),
- m_searchButton(0),
m_completer(0)
{
QHBoxLayout* hLayout = new QHBoxLayout(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()));
+ connect(m_searchInput, SIGNAL(textChanged(QString)),
+ this, SLOT(slotTextChanged(QString)));
+ connect(m_searchInput, SIGNAL(clearButtonClicked()),
+ this, SLOT(slotClearButtonClicked()));
}
DolphinSearchBox::~DolphinSearchBox()
{
}
+QString DolphinSearchBox::text() const
+{
+ return m_searchInput->text();
+}
+
bool DolphinSearchBox::event(QEvent* event)
{
if (event->type() == QEvent::Polish) {
if (m_completer == 0) {
m_completer = new DolphinSearchCompleter(m_searchInput);
}
- emit requestSearchOptions();
+ if (m_searchInput->text().isEmpty()) {
+ emit requestSearchOptions();
+ }
}
return QWidget::eventFilter(watched, event);
void DolphinSearchBox::emitSearchSignal()
{
- emit search(KUrl("nepomuksearch:/" + m_searchInput->text()));
+ emit search(m_searchInput->text());
+}
+
+void DolphinSearchBox::slotTextChanged(const QString& text)
+{
+ if (!text.isEmpty()) {
+ emit requestSearchOptions();
+ }
+ emit searchTextChanged(text);
}
#include "dolphinsearchbox.moc"