mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Prevent any invalid access of URL bar edit widget.
BUG: 320500 FIXED-IN: 4.13.3 REVIEW: 118749
This commit is contained in:
parent
82768a686c
commit
1e171b4230
|
@ -555,15 +555,16 @@ void KonqMainWindow::openUrl(KonqView *_view, const KUrl &_url,
|
|||
mimeType = "text/html";
|
||||
}
|
||||
|
||||
QString nameFilter = detectNameFilter( url );
|
||||
if ( !nameFilter.isEmpty() )
|
||||
{
|
||||
req.nameFilter = nameFilter;
|
||||
url.setFileName( QString() );
|
||||
}
|
||||
const QString nameFilter = detectNameFilter(url);
|
||||
if (!nameFilter.isEmpty()) {
|
||||
req.nameFilter = nameFilter;
|
||||
url.setFileName( QString() );
|
||||
}
|
||||
|
||||
if (m_combo)
|
||||
m_combo->lineEdit()->setModified(false);
|
||||
QLineEdit* edit = comboEdit();
|
||||
if (edit) {
|
||||
edit->setModified(false);
|
||||
}
|
||||
|
||||
KonqView *view = _view;
|
||||
|
||||
|
@ -600,7 +601,7 @@ void KonqMainWindow::openUrl(KonqView *_view, const KUrl &_url,
|
|||
}
|
||||
}
|
||||
|
||||
const QString oldLocationBarURL = (m_combo ? m_combo->currentText() : QString());
|
||||
const QString oldLocationBarURL = locationBarURL();
|
||||
if ( view )
|
||||
{
|
||||
if ( view == m_currentView )
|
||||
|
@ -1549,8 +1550,10 @@ void KonqMainWindow::slotSendFile()
|
|||
void KonqMainWindow::slotOpenLocation()
|
||||
{
|
||||
focusLocationBar();
|
||||
if (m_combo)
|
||||
m_combo->lineEdit()->selectAll();
|
||||
QLineEdit* edit = comboEdit();
|
||||
if (edit) {
|
||||
edit->selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
void KonqMainWindow::slotOpenFile()
|
||||
|
@ -3033,7 +3036,7 @@ void KonqMainWindow::checkDisableClearButton()
|
|||
break;
|
||||
}
|
||||
}
|
||||
KLineEdit* lineEdit = (m_combo ? qobject_cast<KLineEdit*>(m_combo->lineEdit()) : 0);
|
||||
KLineEdit* lineEdit = qobject_cast<KLineEdit*>(comboEdit());
|
||||
if (lineEdit)
|
||||
lineEdit->setClearButtonShown(enable);
|
||||
}
|
||||
|
@ -3333,8 +3336,9 @@ void KonqMainWindow::slotClipboardDataChanged()
|
|||
|
||||
void KonqMainWindow::slotCheckComboSelection()
|
||||
{
|
||||
if (m_combo) {
|
||||
const bool hasSelection = m_combo->lineEdit()->hasSelectedText();
|
||||
QLineEdit* edit = comboEdit();
|
||||
if (edit) {
|
||||
const bool hasSelection = edit->hasSelectedText();
|
||||
//kDebug() << "m_combo->lineEdit()->hasMarkedText():" << hasSelection;
|
||||
m_paCopy->setEnabled( hasSelection );
|
||||
m_paCut->setEnabled( hasSelection );
|
||||
|
@ -3459,7 +3463,8 @@ void KonqMainWindow::setLocationBarURL( const QString &url )
|
|||
{
|
||||
// Don't set the location bar URL if it hasn't changed
|
||||
// or if the user had time to edit the url since the last call to openUrl (#64868)
|
||||
if (m_combo && url != m_combo->lineEdit()->text() && !m_combo->lineEdit()->isModified()) {
|
||||
QLineEdit* edit = comboEdit();
|
||||
if (edit && url != edit->text() && !edit->isModified()) {
|
||||
//kDebug() << "url=" << url;
|
||||
m_combo->setURL( url );
|
||||
updateWindowIcon();
|
||||
|
@ -5242,9 +5247,10 @@ void KonqMainWindow::slotIntro()
|
|||
|
||||
void KonqMainWindow::goURL()
|
||||
{
|
||||
QLineEdit *lineEdit = m_combo ? m_combo->lineEdit() : 0;
|
||||
if ( !lineEdit )
|
||||
QLineEdit *lineEdit = comboEdit();
|
||||
if (!lineEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
QKeyEvent event( QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, QChar('\n') );
|
||||
QApplication::sendEvent( lineEdit, &event );
|
||||
|
@ -5296,7 +5302,10 @@ void KonqMainWindow::slotAddClosedUrl(KonqFrameBase *tab)
|
|||
void KonqMainWindow::slotLocationLabelActivated()
|
||||
{
|
||||
focusLocationBar();
|
||||
m_combo->lineEdit()->selectAll();
|
||||
QLineEdit* edit = comboEdit();
|
||||
if (edit) {
|
||||
edit->selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
void KonqMainWindow::slotOpenURL( const KUrl& url )
|
||||
|
@ -5909,4 +5918,9 @@ void KonqMainWindow::applyWindowSizeFromProfile(const KConfigGroup& profileGroup
|
|||
restoreWindowSize(profileGroup); // example: "Width 1400=1120"
|
||||
}
|
||||
|
||||
QLineEdit* KonqMainWindow::comboEdit()
|
||||
{
|
||||
return m_combo ? m_combo->lineEdit() : 0;
|
||||
}
|
||||
|
||||
#include "konqmainwindow.moc"
|
||||
|
|
|
@ -74,6 +74,7 @@ class KUrlRequester;
|
|||
class KBookmarkManager;
|
||||
class KonqHistoryDialog;
|
||||
struct HistoryEntry;
|
||||
class QLineEdit;
|
||||
|
||||
namespace KParts {
|
||||
class BrowserExtension;
|
||||
|
@ -614,6 +615,8 @@ private:
|
|||
|
||||
QObject* lastFrame( KonqView *view );
|
||||
|
||||
QLineEdit* comboEdit();
|
||||
|
||||
private: // members
|
||||
KonqUndoManager* m_pUndoManager;
|
||||
|
||||
|
|
Loading…
Reference in a new issue