summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-28 12:36:32 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-28 12:36:32 +0100
commit24a64d92d7444829edb77ba50ac618b6b0067b9d (patch)
tree6ec935393b4d9ec9c003d685d237946ce9a1a6c7 /src
parentAll the other (blank) tests.. (diff)
downloadrekonq-24a64d92d7444829edb77ba50ac618b6b0067b9d.tar.xz
Changing Findbar parent
Diffstat (limited to 'src')
-rw-r--r--src/findbar.cpp19
-rw-r--r--src/findbar.h3
-rw-r--r--src/tests/findbar_test.cpp15
3 files changed, 26 insertions, 11 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp
index 43b23035..bb693ab0 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -29,12 +29,14 @@
#include "findbar.h"
#include "findbar.moc"
+// Local Includes
+#include "mainwindow.h"
+
// KDE Includes
#include <KLineEdit>
#include <KIcon>
#include <KPushButton>
#include <klocalizedstring.h>
-#include <KMainWindow>
#include <KApplication>
// Qt Includes
@@ -47,8 +49,8 @@
#include <QtCore/QTimer>
-FindBar::FindBar(KMainWindow *mainwindow)
- : QWidget(mainwindow)
+FindBar::FindBar(QWidget *parent)
+ : QWidget(parent)
, m_lineEdit(new KLineEdit(this))
, m_matchCase(new QCheckBox(i18n("&Match case"), this))
, m_hideTimer(new QTimer(this))
@@ -73,24 +75,27 @@ FindBar::FindBar(KMainWindow *mainwindow)
QLabel *label = new QLabel(i18n("Find:"));
layout->addWidget(label);
+ // mainwindow pointer
+ MainWindow *window = qobject_cast<MainWindow *>(parent);
+
// lineEdit, focusProxy
setFocusProxy(m_lineEdit);
m_lineEdit->setMaximumWidth(250);
- connect(m_lineEdit, SIGNAL(textChanged(const QString &)), mainwindow, SLOT(find(const QString &)));
+ connect(m_lineEdit, SIGNAL(textChanged(const QString &)), window, SLOT(find(const QString &)));
layout->addWidget(m_lineEdit);
// buttons
KPushButton *findNext = new KPushButton(KIcon("go-down"), i18n("&Next"), this);
KPushButton *findPrev = new KPushButton(KIcon("go-up"), i18n("&Previous"), this);
- connect(findNext, SIGNAL(clicked()), mainwindow, SLOT(findNext()));
- connect(findPrev, SIGNAL(clicked()), mainwindow, SLOT(findPrevious()));
+ connect(findNext, SIGNAL(clicked()), window, SLOT(findNext()));
+ connect(findPrev, SIGNAL(clicked()), window, SLOT(findPrevious()));
layout->addWidget(findNext);
layout->addWidget(findPrev);
// Case sensitivity. Deliberately set so this is off by default.
m_matchCase->setCheckState(Qt::Unchecked);
m_matchCase->setTristate(false);
- connect(m_matchCase, SIGNAL(toggled(bool)), mainwindow, SLOT(matchCaseUpdate()));
+ connect(m_matchCase, SIGNAL(toggled(bool)), window, SLOT(matchCaseUpdate()));
layout->addWidget(m_matchCase);
// stretching widget on the left
diff --git a/src/findbar.h b/src/findbar.h
index c192b498..7a4efc59 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -40,7 +40,6 @@
#include <QtGui/QCheckBox>
// Forward Declarations
-class KMainWindow;
class QString;
@@ -49,7 +48,7 @@ class REKONQ_TESTS_EXPORT FindBar : public QWidget
Q_OBJECT
public:
- FindBar(KMainWindow *mainwindow);
+ FindBar(QWidget *parent);
~FindBar();
KLineEdit *lineEdit() const;
bool matchCase() const;
diff --git a/src/tests/findbar_test.cpp b/src/tests/findbar_test.cpp
index 0e332b6a..3fb0e244 100644
--- a/src/tests/findbar_test.cpp
+++ b/src/tests/findbar_test.cpp
@@ -26,7 +26,7 @@
#include <QtWebKit>
#include "findbar.h"
-
+#include "mainwindow.h"
class FindBarTest : public QObject
@@ -38,7 +38,8 @@ public slots:
void cleanupTestCase();
private slots:
-
+ void matchCase();
+ void notifyMatch();
private:
FindBar *bar;
@@ -50,13 +51,23 @@ private:
void FindBarTest::initTestCase()
{
+ MainWindow *w = new MainWindow;
+ bar = new FindBar(w);
}
void FindBarTest::cleanupTestCase()
{
+ delete bar;
}
+void FindBarTest::matchCase()
+{
+}
+
+void FindBarTest::notifyMatch()
+{
+}
// -------------------------------------------