Commit 4bbf2165 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Qt: trim the MRL before validating its content (fix #9289)

The default implementation of QLineEdit only calls the fixup method if the
user presses Enter and the content is not currently valid.
parent b2d1124e
...@@ -704,6 +704,7 @@ void NetOpenPanel::updateMRL() ...@@ -704,6 +704,7 @@ void NetOpenPanel::updateMRL()
QValidator::State UrlValidator::validate( QString& str, int& ) const QValidator::State UrlValidator::validate( QString& str, int& ) const
{ {
str = str.trimmed();
if( str.contains( ' ' ) ) if( str.contains( ' ' ) )
return QValidator::Invalid; return QValidator::Invalid;
if( !str.contains( "://" ) ) if( !str.contains( "://" ) )
...@@ -711,11 +712,6 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const ...@@ -711,11 +712,6 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
return QValidator::Acceptable; return QValidator::Acceptable;
} }
void UrlValidator::fixup( QString& str ) const
{
str = str.trimmed();
}
/************************************************************************** /**************************************************************************
* Open Capture device ( DVB, PVR, V4L, and similar ) * * Open Capture device ( DVB, PVR, V4L, and similar ) *
**************************************************************************/ **************************************************************************/
......
...@@ -153,8 +153,7 @@ class UrlValidator : public QValidator ...@@ -153,8 +153,7 @@ class UrlValidator : public QValidator
Q_OBJECT Q_OBJECT
public: public:
UrlValidator( QObject *parent ) : QValidator( parent ) { } UrlValidator( QObject *parent ) : QValidator( parent ) { }
void fixup( QString& ) const; virtual QValidator::State validate( QString&, int& ) const;
QValidator::State validate( QString&, int& ) const;
}; };
class DiscOpenPanel: public OpenPanel class DiscOpenPanel: public OpenPanel
......
Markdown is supported
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