Commit a44a76b8 authored by Robert Knight's avatar Robert Knight
Browse files

Only disconnect views from the session's bell signal when another view...

Only disconnect views from the session's bell signal when another view associated with the session is given focus.  This stops an interesting warning where disconnecting one of the view's slots when it lost focus failed because the QEvent::FocusOut event occurred after the TerminalDisplay's destructor had executed, at which point the display widget was, as far as Qt is concerned, just an ordinary QWidget without the slots defined in the TerminalDisplay class.

svn path=/branches/work/konsole-split-view/; revision=646757
parent 2b11add4
......@@ -53,7 +53,6 @@ MainWindow::MainWindow()
// where the menu bar has a lower border
setContentsMargins(0,2,0,0);
// create actions for menus
setupActions();
......@@ -67,7 +66,6 @@ MainWindow::MainWindow()
// create menus
createGUI();
}
ViewManager* MainWindow::viewManager() const
......
......@@ -74,7 +74,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
}
SessionController::~SessionController()
{
{
}
KUrl SessionController::url() const
......@@ -107,16 +107,19 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event)
{
if ( event->type() == QEvent::FocusIn )
{
// notify the world that the view associated with this session has been focused
// used by the view manager to update the title of the MainWindow widget containing the view
emit focused(this);
// when the view is focused, set bell events from the associated session to be delivered
// by the focused view
// first, disconnect any other views which are listening for bell signals from the session
disconnect( _session , SIGNAL(bellRequest(const QString&)) , 0 , 0 );
// second, connect the newly focused view to listen for the session's bell signal
connect( _session , SIGNAL(bellRequest(const QString&)) ,
_view , SLOT(bell(const QString&)) );
}
if ( event->type() == QEvent::FocusOut )
{
disconnect( _session , SIGNAL(bellRequest(const QString&)) ,
_view , SLOT(bell(const QString&)) );
}
}
return false;
......
......@@ -403,7 +403,10 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
// konsole in opaque mode.
bY = bX = 1;
// create scrollbar for scrolling output up and down
// set the scrollbar's slider to occupy the whole area of the scrollbar initially
scrollbar = new QScrollBar(this);
setScroll(0,0);
scrollbar->setCursor( Qt::ArrowCursor );
connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
......@@ -1572,12 +1575,13 @@ void TerminalDisplay::scrollChanged(int)
{
_screenWindow->scrollTo( scrollbar->value() );
// if the thumb has been moved to the bottom of the scrollbar then set
// the display to automatically track new output, that is, scroll down automatically
// to how new lines as they are added
const bool atEndOfOutput = (scrollbar->value() == scrollbar->maximum());
_screenWindow->setTrackOutput( atEndOfOutput );
updateImage();
//emit changedHistoryCursor(scrollbar->value()); //expose
}
int TerminalDisplay::scrollPosition()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment