From 5dd33d3b1bde69b4ded0b1b35a874919c3007fe5 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 14 Dec 2010 19:20:31 +0000 Subject: added button to the detailsdialog, that opens up the directory of that file (based on patch by Panagiotis Papadopoulos) (Closes issue 361) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2010 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/detailsdialog.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/qmmpui/detailsdialog.cpp') diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index 5bb6b2be5..10cba244b 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Ilya Kotov * + * Copyright (C) 2009-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -17,11 +17,13 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include #include #include #include #include #include +#include #include #include #include @@ -43,7 +45,7 @@ DetailsDialog::DetailsDialog(PlayListItem *item, QWidget *parent) m_path = item->url(); setWindowTitle (m_path.section('/',-1)); m_ui->pathEdit->setText(m_path); - + m_ui->directoryButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); m_metaDataModel = MetaDataManager::instance()->createMetaDataModel(item->url(), this); if(m_metaDataModel) @@ -67,6 +69,28 @@ DetailsDialog::~DetailsDialog() delete m_ui; } +void DetailsDialog:: on_directoryButton_clicked() +{ + QString dir_path; + if(!m_path.contains("://")) //local file + dir_path = QFileInfo(m_path).absolutePath(); + else if (m_path.contains(":///")) //pseudo-protocol + { + dir_path = QUrl(m_path).path(); + dir_path.replace(QString(QUrl::toPercentEncoding("#")), "#"); + dir_path.replace(QString(QUrl::toPercentEncoding("?")), "?"); + dir_path.replace(QString(QUrl::toPercentEncoding("%")), "%"); + dir_path = QFileInfo(dir_path).absolutePath(); + } + else + return; +#ifdef Q_WS_X11 + QProcess::execute("xdg-open", QStringList() << dir_path); //works with lxde +#else + QDesktopServices::openUrl(QUrl::fromLocalFile(dir_path)); +#endif +} + void DetailsDialog::printInfo() { QList flist = MetaDataManager::instance()->createPlayList(m_path, true); -- cgit v1.2.3-13-gbd6f