[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.3/kdelibs/khtml
From: David Faure <faure () kde ! org>
Date: 2009-10-08 15:13:19
Message-ID: 1255014799.802029.18171.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1032809 by dfaure:
Backport r1032808, fix for bug 203069:
Allow to focus readonly form elements which makes it possible to copy their text, too.
On the other hand, don't allow Ctrl+X and Ctrl+V to work in such widgets.
M +1 -1 html/html_formimpl.cpp
M +18 -12 khtml_ext.cpp
M +2 -2 rendering/render_form.cpp
--- branches/KDE/4.3/kdelibs/khtml/html/html_formimpl.cpp #1032808:1032809
@@ -1005,7 +1005,7 @@
bool HTMLGenericFormElementImpl::isFocusable() const
{
- if (disabled() || readOnly())
+ if (disabled())
return false;
//Non-widget INPUT TYPE="image" and <BUTTON> support focus, too.
--- branches/KDE/4.3/kdelibs/khtml/khtml_ext.cpp #1032808:1032809
@@ -200,10 +200,12 @@
if ( !m_editableFormWidget )
return;
- if ( m_editableFormWidget->inherits( "QLineEdit" ) )
- static_cast<QLineEdit *>( &(*m_editableFormWidget) )->cut();
- else if ( m_editableFormWidget->inherits( "QTextEdit" ) )
- static_cast<QTextEdit *>( &(*m_editableFormWidget) )->cut();
+ QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
+ if ( lineEdit && !lineEdit->isReadOnly() )
+ lineEdit->cut();
+ QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
+ if ( textEdit && !textEdit->isReadOnly() )
+ textEdit->cut();
}
void KHTMLPartBrowserExtension::copy()
@@ -249,10 +251,12 @@
}
else
{
- if ( m_editableFormWidget->inherits( "QLineEdit" ) )
- static_cast<QLineEdit *>( &(*m_editableFormWidget) )->copy();
- else if ( m_editableFormWidget->inherits( "QTextEdit" ) )
- static_cast<QTextEdit *>( &(*m_editableFormWidget) )->copy();
+ QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
+ if ( lineEdit )
+ lineEdit->copy();
+ QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
+ if ( textEdit )
+ textEdit->copy();
}
}
@@ -292,10 +296,12 @@
if ( !m_editableFormWidget )
return;
- if ( m_editableFormWidget->inherits( "QLineEdit" ) )
- static_cast<QLineEdit *>( &(*m_editableFormWidget) )->paste();
- else if ( m_editableFormWidget->inherits( "QTextEdit" ) )
- static_cast<QTextEdit *>( &(*m_editableFormWidget) )->paste();
+ QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
+ if ( lineEdit && !lineEdit->isReadOnly() )
+ lineEdit->paste();
+ QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
+ if ( textEdit && !textEdit->isReadOnly() )
+ textEdit->paste();
}
void KHTMLPartBrowserExtension::callExtensionProxyMethod( const char *method )
--- branches/KDE/4.3/kdelibs/khtml/rendering/render_form.cpp #1032808:1032809
@@ -265,10 +265,10 @@
{
m_widget->setEnabled(!element()->disabled());
- // If we've disabled/made r/o a focused element, clear its focus,
+ // If we've disabled a focused element, clear its focus,
// so Qt doesn't do funny stuff like let one type into a disabled
// line edit.
- if ((element()->disabled() || element()->readOnly()) && element()->focused())
+ if (element()->disabled() && element()->focused())
document()->quietResetFocus();
RenderWidget::updateFromElement();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic