Commit c0a12564 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Rémi Duraffort

Qt4: do not allow spaces in network URLs (fix #3870)

(cherry picked from commit f8d5652706916e4b7471a6d40f0d1c23854a79a4)
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 675c29fa
......@@ -513,6 +513,8 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
}
else
mrlList = NULL;
ui.urlText->setValidator( new UrlValidator( this ) );
}
NetOpenPanel::~NetOpenPanel()
......@@ -586,6 +588,20 @@ void NetOpenPanel::updateCompleter()
mrlList->setStringList( tempL );
}
void UrlValidator::fixup( QString& str ) const
{
str = str.trimmed();
}
QValidator::State UrlValidator::validate( QString& str, int& pos ) const
{
if( str.contains( ' ' ) )
return QValidator::Invalid;
if( !str.contains( "://" ) )
return QValidator::Intermediate;
return QValidator::Acceptable;
}
/**************************************************************************
* Open Capture device ( DVB, PVR, V4L, and similar ) *
**************************************************************************/
......
......@@ -144,6 +144,15 @@ private slots:
void updateCompleter();
};
class UrlValidator : public QValidator
{
Q_OBJECT
public:
UrlValidator( QObject *parent ) : QValidator( parent ) { }
void fixup( QString& ) const;
QValidator::State validate( QString&, int& ) const;
};
class DiscOpenPanel: public OpenPanel
{
Q_OBJECT
......
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