Bug#583398: opening files from thunar does not work, wrong path arguement in smplayer.desktop?

Ibragimov Rinat ibragimovrinat at mail.ru
Mon Dec 20 14:08:13 UTC 2010


> The dev of smplayer says it's fixed in svn r3532
> I have no time to test it currently.
> Could anyone else verfiy it?

I'm facing the same bug, but that r3532 doesn't solve it for me.

--- src/core.cpp (revision 3531)
+++ src/core.cpp (revision 3532)
@@ -21,6 +21,7 @@
 #include <QFileInfo>
 #include <QRegExp>
 #include <QTextStream>
+#include <QUrl>
 
 #include <cmath>
 
@@ -361,6 +362,11 @@
 void Core::open(QString file, int seek) {
  qDebug("Core::open: '%s'", file.toUtf8().data());
 
+ if (file.startsWith("file:")) {
+ file = QUrl(file).toLocalFile();
+ qDebug("Core::open: converting url to local file: %s", file.toUtf8().constData());
+ }
+
  QFileInfo fi(file);
 
  if ( (fi.exists()) && (fi.suffix().toLower()=="iso") ) {

As you can see, author solved that issue by calling toLocalFile. But it does not convert those urlencrypted %20 and others.
It simply removes 'file://' from beginning.

I propose the following patch:

diff -ur smplayer-0.6.9//src/smplayer.cpp smplayer-0.6.9-fix//src/smplayer.cpp
--- smplayer-0.6.9//src/smplayer.cpp 2010-01-21 03:52:42.000000000 +0300
+++ smplayer-0.6.9-fix//src/smplayer.cpp 2010-12-19 20:51:56.119603929 +0300
@@ -30,6 +30,7 @@
 
 #include <QDir>
 #include <QApplication>
+#include <QUrl>
 
 #include <stdio.h>
 
@@ -242,6 +243,13 @@
  }
  else {
  // File
+ QUrl fUrl;
+ QByteArray baUrl;
+ baUrl.append( argument );
+ fUrl.setEncodedUrl( baUrl );
+ if (fUrl.isValid()) {
+ argument = fUrl.toLocalFile();
+ }
  if (QFile::exists( argument )) {
  argument = QFileInfo(argument).absoluteFilePath();
  }

QUrl::setEncodedUrl decodes string and if decoded url still correct, converting to local file name invoked.
I tested it on files with only ASCII characters in names and with russian names (in UTF-8) and it worked.





More information about the pkg-multimedia-maintainers mailing list