mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
strip line breaking characters from URL on text input
This patch removes line-breaking chars when an URL is entered. Very handy if you paste URLs from e.g. an email which shows the complete URL broken into multiple lines. BUG: 159002 FIXED-IN: 4.9.1 REVIEW: 106184
This commit is contained in:
parent
396c2c3fcf
commit
38fda3bf75
2 changed files with 16 additions and 0 deletions
|
@ -142,6 +142,9 @@ KonqCombo::KonqCombo( QWidget *parent )
|
|||
setLineEdit( edit );
|
||||
setItemDelegate( new KonqComboItemDelegate( this ) );
|
||||
|
||||
connect( edit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(slotTextEdited(QString)) );
|
||||
|
||||
completionBox()->setTabHandling(true); // #167135
|
||||
completionBox()->setItemDelegate( new KonqComboItemDelegate( this ) );
|
||||
|
||||
|
@ -173,6 +176,18 @@ void KonqCombo::init( KCompletion *completion )
|
|||
loadItems();
|
||||
}
|
||||
|
||||
void KonqCombo::slotTextEdited( const QString &text )
|
||||
{
|
||||
QString txt = text;
|
||||
txt.remove( QChar('\n') );
|
||||
txt.remove( QChar(QChar::LineSeparator) );
|
||||
txt.remove( QChar(QChar::ParagraphSeparator) );
|
||||
|
||||
if ( txt != text ) {
|
||||
lineEdit()->setText( txt );
|
||||
}
|
||||
}
|
||||
|
||||
void KonqCombo::setURL( const QString& url )
|
||||
{
|
||||
//kDebug() << url << "returnPressed=" << m_returnPressed;
|
||||
|
|
|
@ -89,6 +89,7 @@ private Q_SLOTS:
|
|||
void slotCleared();
|
||||
void slotSetIcon( int index );
|
||||
void slotActivated( const QString& text );
|
||||
void slotTextEdited( const QString &text );
|
||||
|
||||
private:
|
||||
void updateItem( const QPixmap& pix, const QString&, int index, const QString& title );
|
||||
|
|
Loading…
Reference in a new issue