summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-11-28 10:35:19 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-11-28 10:35:19 +0100
commitec154e126f4ae0febbbb7fef298ca6d98aee836d (patch)
treed86d494eab593c1495af58f2c0d349fb6028f14e
parentOther QAction -> KAction (diff)
downloadrekonq-ec154e126f4ae0febbbb7fef298ca6d98aee836d.tar.xz
New findbar implementation. Now it will be shown with CTRL+F, but NOT
hidden with ESC button. Also doesn't search
-rw-r--r--src/findbar.cpp48
-rw-r--r--src/findbar.h8
2 files changed, 20 insertions, 36 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp
index ae64b7f6..45de4246 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -26,57 +26,48 @@
#include <KToolBar>
#include <KStandardAction>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QEvent>
-#include <QPixmap>
-#include <QShortcut>
-#include <QResizeEvent>
+#include <QtGui>
FindBar::FindBar(QWidget *parent)
- : QWidget(parent)
+ : KToolBar(parent)
, m_lineEdit(0)
{
initializeFindWidget();
// we start off hidden
- setMaximumHeight(0);
-// m_widget->setGeometry(0, -1 * m_widget->height(), m_widget->width(), m_widget->height());
hide();
-
- new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(hide()));
}
+
FindBar::~FindBar()
{
delete m_lineEdit;
}
-void FindBar::initializeFindWidget()
+KLineEdit *FindBar::lineEdit()
{
- QHBoxLayout *layout = new QHBoxLayout();
+ return m_lineEdit;
+}
- KToolBar *bar1 = new KToolBar(this);
- bar1->addAction( KStandardAction::close(this, SLOT( hide() ) , this ) );
- layout->addWidget( bar1 );
+
+void FindBar::initializeFindWidget()
+{
+ addAction( KIcon("dialog-close") , "close" , this, SLOT( hide() ) );
QLabel *label = new QLabel("Find: ");
- layout->addWidget( label );
+ addWidget( label );
m_lineEdit = new KLineEdit();
connect( m_lineEdit, SIGNAL( returnPressed() ), this, SLOT( slotFindNext() ) );
connect( m_lineEdit, SIGNAL( textEdited(const QString &) ), this, SLOT( slotFindNext() ) );
- layout->addWidget( m_lineEdit );
-
- KToolBar *bar2 = new KToolBar(this);
- bar2->addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) );
- bar2->addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) );
- layout->addWidget( bar2 );
+ addWidget( m_lineEdit );
- layout->addStretch();
+ addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) );
+ addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) );
- setLayout(layout);
+ QLabel *spaceLabel = new QLabel(" "); // FIXME
+ addWidget( spaceLabel );
}
@@ -98,13 +89,6 @@ void FindBar::showFind()
}
-void FindBar::resizeEvent(QResizeEvent *event)
-{
-/* if (event->size().width() != m_widget->width())
- m_widget->resize(event->size().width(), m_widget->height());
- QWidget::resizeEvent(event);*/
-}
-
void FindBar::frameChanged(int frame)
{
diff --git a/src/findbar.h b/src/findbar.h
index 214a06e2..05dbf820 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -21,16 +21,18 @@
#define FINDBAR_H
#include <KLineEdit>
+#include <KToolBar>
#include <QWidget>
-class FindBar : public QWidget
+class FindBar : public KToolBar
{
Q_OBJECT
public:
FindBar(QWidget *parent = 0);
~FindBar();
+ KLineEdit *lineEdit();
public slots:
void clear();
@@ -38,9 +40,6 @@ public slots:
void slotFindNext();
void slotFindPrevious();
-protected:
- void resizeEvent(QResizeEvent *event);
-
private slots:
void frameChanged(int frame);
@@ -48,6 +47,7 @@ private:
void initializeFindWidget();
KLineEdit *m_lineEdit;
+ QWidget *m_centralWidget;
};
#endif