[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenox/konq-embed
From: Stefan Eilers <stefan.eilers () basyskom ! de>
Date: 2008-05-23 10:29:53
Message-ID: 1211538593.267018.2775.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 811519 by eilers:
Protect user input (URL entry line) while loading is in progress.
M +2 -0 ChangeLog
M +22 -1 src/mainwindowbase.cc
M +2 -0 src/mainwindowbase.h
M +35 -5 src/urlcombo.cpp
M +8 -1 src/urlcombo.h
M +19 -5 src/view.cc
M +3 -0 src/view.h
--- trunk/kdenox/konq-embed/ChangeLog #811518:811519
@@ -1,3 +1,5 @@
+2008-05-23 Stefan Eilers <stefan.eilers@basyskom.de>
+ * User entry in URL line edit field will not be destroyed while page is loaded.
2008-05-21 Stefan Eilers <stefan.eilers@basyskom.de>
* Improve scrollbar handling in frames on small screen sizes
2008-02-25 Stefan Eilers <stefan.eilers@basyskom.de>
--- trunk/kdenox/konq-embed/src/mainwindowbase.cc #811518:811519
@@ -83,6 +83,7 @@
#include "view.h"
#include "htmlview.h"
#ifdef KONQ_GUI_ROAD
+#include "urlcombo.h"
#include "preferences_road.h"
#else
#include "preferencesimpl.h"
@@ -725,7 +726,9 @@
{
connect( view, SIGNAL( locationBarURLChanged( const QString & ) ),
this, SLOT( setLocationBarURL( const QString & ) ) );
- setLocationBarURL( view->locationBarURL() );
+ connect( view, SIGNAL( operationCompleted() ),
+ this, SLOT( operationCompleted() ) );
+ setLocationBarURL( view->locationBarURL() );
}
if ( m_findInput )
@@ -1456,6 +1459,24 @@
m_findInput->setPalette( palette );
}
+// This will be called when a load operation is finished.
+// We will reset the dirty flag in the URLCombo to reenable the url update..
+void MainWindowBase::operationCompleted()
+{
+ qDebug( "MainWindowBase::operationCompleted()" );
+ if ( ! m_locationCombo )
+ return;
+#ifdef KONQ_GUI_ROAD
+ QString url_class_name = m_locationCombo->metaObject()->className();
+ qDebug( "url class name: %s", url_class_name.latin1() );
+ if ( url_class_name != "URLCombo" )
+ return;
+
+ URLCombo* combo = static_cast<URLCombo*>( m_locationCombo );
+ combo->setDirtyFlag( false );
+#endif
+}
+
/*
void MainWindowBase::setEncoding( const QString &encoding )
{
--- trunk/kdenox/konq-embed/src/mainwindowbase.h #811518:811519
@@ -173,6 +173,8 @@
void findPrev();
void findBlinkOn();
void findBlinkOff();
+
+ void operationCompleted();
signals:
void zoomValueSelected( int );
--- trunk/kdenox/konq-embed/src/urlcombo.cpp #811518:811519
@@ -88,7 +88,7 @@
URLCombo::URLCombo( QWidget* parent, const char* name )
: QComboBox( true, parent, name )
- , m_justGotFocus( false ), m_isAutoCompletion( false )
+ , m_justGotFocus( false ), m_isAutoCompletion( false ), m_isDirty( false )
{
focusProxy()->installEventFilter( this );
KConfig* config = KGlobal::config();
@@ -114,6 +114,29 @@
}
+void URLCombo::setCurrentItem ( int index )
+{
+ if ( m_isDirty )
+ {
+ qDebug( "URLCombo::setCurrentItem: ignoring.." );
+ return;
+ }
+
+ qDebug( "URLCombo::setCurrentItem" );
+ QComboBox::setCurrentItem( index );
+}
+
+// The dirty flag is set when the lineEdit receives key press events (the user
+// enters something).
+void URLCombo::setDirtyFlag( bool dirty )
+{
+ qDebug( "URLCombo::setDirtyFlag( %s )", dirty ? "true" : "false" );
+ // if ( dirty == false ) __asm__("int3");
+ m_isDirty = dirty;
+}
+
+
+
void URLCombo::initHistoryList()
{
URLHistoryBuffer::self().loadURLHistory();
@@ -131,7 +154,10 @@
{
URLHistoryBuffer::self().addURL(url);
updateHistoryList();
- setCurrentItem( 0 );
+ if ( !m_isDirty )
+ {
+ setCurrentItem( 0 );
+ }
}
}
@@ -233,13 +259,16 @@
return;
case Qt::Key_Enter:
case Qt::Key_Return:
- //qDebug( "Return pressed" );
+ setDirtyFlag( false );
emit signalAccepted( currentText() );
URLHistoryBuffer::self().addURL( currentText() );
break;
- //default:
- //popup();
+ default:
+ // Pressed key means that we are dirty now:
+ setDirtyFlag( true );
+ break;
}
+
// Fall-Trough: Use parent keyhandler
QComboBox::keyPressEvent(evt);
@@ -271,6 +300,7 @@
}
+
//////////////////////////////////////////////////////////////////////////////////
--- trunk/kdenox/konq-embed/src/urlcombo.h #811518:811519
@@ -52,6 +52,12 @@
public:
URLCombo( QWidget* parent=NULL, const char* name=NULL );
virtual ~URLCombo();
+
+ virtual void setCurrentItem ( int index );
+
+ // If the URLCombo is set to dirty, all external URL-Updates
+ // will be stored to the history buffer but the view is not updated.
+ void setDirtyFlag( bool dirty );
public slots:
virtual void clearURLHistory();
@@ -63,7 +69,7 @@
protected:
void keyPressEvent(QKeyEvent* e);
- virtual bool eventFilter( QObject *o, QEvent *e );
+ bool eventFilter( QObject *o, QEvent *e );
protected slots:
virtual void slotTextChanged( const QString& text );
@@ -73,6 +79,7 @@
private:
bool m_justGotFocus;
bool m_isAutoCompletion;
+ bool m_isDirty; // Dirty means: The user entered some text.
};
--- trunk/kdenox/konq-embed/src/view.cc #811518:811519
@@ -270,7 +270,7 @@
// OK, this is a full web/file browser, add specific actions
m_stop = new KAction( i18n( "Stop" ), 0,
- this, SLOT( stop() ), actionCollection(), "go_stop" );
+ this, SLOT( actionStop() ), actionCollection(), "go_stop" );
m_back = KStdAction::back( this, SLOT( back() ), actionCollection() );
m_forward = KStdAction::forward( this, SLOT( forward() ), actionCollection() );
KStdAction::home( this, SLOT( home() ), actionCollection() );
@@ -385,9 +385,9 @@
return;
}
}
-
+
stop();
-
+
m_run = new Run( this, url, args );
connect( m_run, SIGNAL( error() ),
this, SLOT( runError() ) );
@@ -424,22 +424,34 @@
{
if ( m_run )
{
- setLocationBarURL( m_oldLocationBarURL );
+ //setLocationBarURL( m_oldLocationBarURL ); Why should we set the old URL \
content, when we stop loading? (se)
if ( m_run->job() )
m_run->job()->kill();
delete static_cast<Run *>( m_run );
+
+ emit operationCompleted();
+
}
-
+
m_doc->closeURL();
if ( m_stop ) m_stop->setEnabled( false );
if ( m_history.count() > 0 )
updateHistoryEntry();
+
}
+// Called when the stop action was triggered
+void BrowserView::actionStop()
+{
+ qDebug( "BrowserView::actionStop()" );
+ stop();
+ emit operationCompleted();
+}
+
KURL BrowserView::homeURL()
{
KConfig *cfg = KGlobal::config();
@@ -497,6 +509,8 @@
if ( m_back ) m_back->setEnabled( canGoBack() );
if ( m_forward ) m_forward->setEnabled( canGoForward() );
+
+ emit operationCompleted();
}
void BrowserView::infoMessage( KIO::Job *, const QString &text )
--- trunk/kdenox/konq-embed/src/view.h #811518:811519
@@ -115,6 +115,8 @@
void statusMessage( const QString &text, bool visible );
void actionChanged( const char * );
+
+ void operationCompleted();
protected slots:
void setLocationBarURL( const QString &url );
@@ -216,6 +218,7 @@
void forward();
void reload();
void stop();
+ void actionStop();
void find();
bool findNext();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic