]> git.sesse.net Git - vlc/commitdiff
Qt: trim the MRL before validating its content (fix #9289)
authorLudovic Fauvet <etix@videolan.org>
Mon, 2 Sep 2013 15:57:06 +0000 (17:57 +0200)
committerLudovic Fauvet <etix@videolan.org>
Mon, 2 Sep 2013 16:23:15 +0000 (18:23 +0200)
The default implementation of QLineEdit only calls the fixup method if the
user presses Enter and the content is not currently valid.

modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/components/open_panels.hpp

index 24f9e0f001a7c91e6e909833522d611f96be4e24..740ac0470188667c05ac12346f09145a48914591 100644 (file)
@@ -704,6 +704,7 @@ void NetOpenPanel::updateMRL()
 
 QValidator::State UrlValidator::validate( QString& str, int& ) const
 {
+    str = str.trimmed();
     if( str.contains( ' ' ) )
         return QValidator::Invalid;
     if( !str.contains( "://" ) )
@@ -711,11 +712,6 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
     return QValidator::Acceptable;
 }
 
-void UrlValidator::fixup( QString& str ) const
-{
-    str = str.trimmed();
-}
-
 /**************************************************************************
  * Open Capture device ( DVB, PVR, V4L, and similar )                     *
  **************************************************************************/
index 70082ba40dc065692f0271a831b0ae8e6080dbd0..c936da848d45e41c87ca09d390b365f8569522ee 100644 (file)
@@ -153,8 +153,7 @@ class UrlValidator : public QValidator
    Q_OBJECT
 public:
    UrlValidator( QObject *parent ) : QValidator( parent ) { }
-   void fixup( QString& ) const;
-   QValidator::State validate( QString&, int& ) const;
+   virtual QValidator::State validate( QString&, int& ) const;
 };
 
 class DiscOpenPanel: public OpenPanel