Commit f8d56527 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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

parent 852f0db9
......@@ -551,6 +551,8 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
}
else
mrlList = NULL;
ui.urlText->setValidator( new UrlValidator( this ) );
}
NetOpenPanel::~NetOpenPanel()
......@@ -624,6 +626,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 ) *
**************************************************************************/
......
......@@ -149,6 +149,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