From 39225590f65749fe628ba6b91482f0eb6124dcb6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 16 Mar 2011 19:46:55 +0100 Subject: Delete url popup on resize/move --- src/mainwindow.cpp | 32 +++++++++++++++++++++++++++----- src/mainwindow.h | 4 +++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 34587b12..b3c03ce6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -108,7 +108,7 @@ MainWindow::MainWindow() , m_userAgentMenu(new KMenu(this)) , m_bookmarksBar(0) , m_popup(new KPassivePopup(this)) - , m_hidePopup(new QTimer(this)) + , m_hidePopupTimer(new QTimer(this)) , m_toolsMenu(0) , m_developerMenu(0) { @@ -277,7 +277,7 @@ void MainWindow::postLaunch() connect(rApp, SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide())); m_popup->setFrameShape(QFrame::NoFrame); m_popup->setLineWidth(0); - connect(m_hidePopup, SIGNAL(timeout()), m_popup, SLOT(hide())); + connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide())); // notification system connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); @@ -1117,11 +1117,11 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) // deleting popus if empty msgs if (msg.isEmpty()) { - m_hidePopup->start(250); + m_hidePopupTimer->start(250); return; } - m_hidePopup->stop(); + m_hidePopupTimer->stop(); switch (status) @@ -1129,7 +1129,7 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) case Rekonq::Url: break; case Rekonq::Info: - m_hidePopup->start(500); + m_hidePopupTimer->start(500); break; case Rekonq::Success: break; @@ -1537,3 +1537,25 @@ void MainWindow::showUserAgentSettings() dialog->deleteLater(); } + + +void MainWindow::moveEvent(QMoveEvent *event) +{ + if (m_hidePopupTimer) + m_hidePopupTimer->stop(); + if (m_popup) + m_popup->hide(); + + KMainWindow::moveEvent(event); +} + + +void MainWindow::resizeEvent(QResizeEvent *event) +{ + if (m_hidePopupTimer) + m_hidePopupTimer->stop(); + if (m_popup) + m_popup->hide(); + + KMainWindow::resizeEvent(event); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 6c2c12be..9853ca39 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -135,6 +135,8 @@ protected: * Filters out ESC key to show/hide the search bar */ void keyPressEvent(QKeyEvent *event); + void moveEvent(QMoveEvent *event); + void resizeEvent(QResizeEvent *event); bool event(QEvent *event); bool queryClose(); @@ -206,7 +208,7 @@ private: QString m_lastSearch; KPassivePopup *m_popup; - QTimer *m_hidePopup; + QTimer *m_hidePopupTimer; KMenu *m_toolsMenu; KActionMenu *m_developerMenu; -- cgit v1.2.1