--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Henri Lampela - henri.lampela@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QHBoxLayout>
+#include <QLineEdit>
+#include <QPushButton>
+#include "common.h"
+
+#include "searchitem.h"
+
+SearchItem::SearchItem(QWidget *parent)
+ : QWidget(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ /// @todo fix sizes and position and add graphics (maybe even an animation?)
+
+ m_searchField = new QLineEdit(this);
+ m_searchField->setFixedWidth(DEFAULT_SCREEN_WIDTH - 200);
+ m_searchField->setFocus();
+
+
+ QPushButton *button = new QPushButton(tr("X"), this); /// @todo add icon etc.
+ connect(button, SIGNAL(clicked()),
+ this, SLOT(hide()));
+
+
+ button->setFixedWidth(150);
+
+ QHBoxLayout *layout = new QHBoxLayout(this);
+
+ layout->addWidget(m_searchField, 0, Qt::AlignLeft);
+ layout->addWidget(button, 0, Qt::AlignRight);
+
+ setLayout(layout);
+
+ setFixedSize((DEFAULT_SCREEN_WIDTH - 50), 70);
+ move(0, (DEFAULT_SCREEN_HEIGHT - 130));
+}
+
+void SearchItem::searchButtonPressed()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ emit searchLocation(m_searchField->text());
+ m_searchField->setText(""); // clear() method bugging in Qt 4.6, it leaves "dead" cursor
+ hide();
+}
+
+void SearchItem::showItem()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_searchField->setFocus();
+ show();
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Henri Lampela - henri.lampela@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef SEARCHITEM_H
+#define SEARCHITEM_H
+
+#include <QPaintEvent>
+#include <QPixmap>
+#include <QRect>
+#include <QSize>
+#include <QWidget>
+
+class QLineEdit;
+
+/**
+ * @brief Class for drawing search field and button
+ *
+ * @author Henri Lampela - henri.lampela@ixonos.com
+ *
+ * @class SearchItem searchitem.h "ui/searchitem.h"
+ */
+class SearchItem : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * @brief Constructor
+ *
+ * @param parent Instance of parent widget
+ */
+ SearchItem(QWidget *parent = 0);
+
+ /**
+ * @brief shows search item and focuses lineEdit
+ *
+ */
+ void showItem();
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+private slots:
+
+ /**
+ * @brief Interscepts clicked() signal from search button
+ *
+ */
+ void searchButtonPressed();
+
+signals:
+
+ /**
+ * @brief Signal to emit user's input
+ *
+ */
+ void searchLocation(QString location);
+
+private:
+
+ QLineEdit *m_searchField; ///< pointer to search field
+};
+
+#endif // SEARCHITEM_H