[vlc-devel] commit: Open a file location. Very dumb and incomplete. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Aug 22 01:51:54 CEST 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Aug 21 16:45:37 2008 -0700| [179b740ce8b99c6d69fb40be8791d15bf52ea52b] | committer: Jean-Baptiste Kempf 

Open a file location. Very dumb and incomplete.

Close #1459

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=179b740ce8b99c6d69fb40be8791d15bf52ea52b
---

 .../gui/qt4/components/playlist/playlist_model.cpp |   24 +++++++++++++++-----
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 61f16f5..9eba591 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -812,10 +812,8 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
             menu->addAction( qfu(I_POP_SORT), this, SLOT( popupSort() ) );
             menu->addAction( qfu(I_POP_ADD), this, SLOT( popupAdd() ) );
         }
-#ifdef WIN32
         menu->addSeparator();
         menu->addAction( qfu( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
-#endif
         menu->popup( point );
     }
     else
@@ -898,12 +896,26 @@ void PLModel::popupSave()
      msg_Err( p_playlist, "Save not implemented" );
 }
 
+#include <QUrl>
+#include <QFileInfo>
+#include <QDesktopServices>
 void PLModel::popupExplore()
 {
-#ifdef WIN32
-#include <shellapi.h>
-    ShellExecute( NULL, "explore", "C:\\", NULL, NULL, SW_SHOWNORMAL );
-#endif
+    playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
+                                                    i_popup_item,
+                                                    pl_Unlocked );
+    if( p_item )
+    {
+       input_item_t *p_input = p_item->p_input;
+       char *psz_meta = input_item_GetURI( p_input );
+       if( psz_meta )
+       {
+           /* FIXME add a MRLSplit like function */
+           QFileInfo info( qfu( psz_meta ) );
+           QDesktopServices::openUrl( QUrl::fromLocalFile( info.absolutePath() ) );
+           free( psz_meta );
+       }
+    }
 }
 
 /**********************************************************************




More information about the vlc-devel mailing list