mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
2a69abe570
Removed the chat and call toaster. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3900 b45a01b8-16f6-495d-af2f-9b41ad6348cc
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
/****************************************************************
|
|
* This file is distributed under the following license:
|
|
*
|
|
* Copyright (C) 2007 - 2010 Xesc & Technology
|
|
* Copyright (c) 2010 RetroShare Team
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
*************************************************************************/
|
|
|
|
#include <QDesktopServices>
|
|
#include <QMessageBox>
|
|
#include <QFileInfo>
|
|
#include <QUrl>
|
|
|
|
#include "DownloadToaster.h"
|
|
|
|
#include <retroshare/rsfiles.h>
|
|
|
|
DownloadToaster::DownloadToaster(const std::string &hash, const QString &name) : QWidget(NULL)
|
|
{
|
|
ui.setupUi(this);
|
|
|
|
fileHash = hash;
|
|
|
|
/* connect buttons */
|
|
connect(ui.spbClose, SIGNAL(clicked()), this, SLOT(hide()));
|
|
connect(ui.startButton, SIGNAL(clicked()), this, SLOT(play()));
|
|
|
|
/* set informations */
|
|
ui.labelTitle->setText(name);
|
|
}
|
|
|
|
void DownloadToaster::play()
|
|
{
|
|
/* look up path */
|
|
FileInfo fi;
|
|
if (!rsFiles->FileDetails(fileHash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_SPEC_ONLY, fi)) {
|
|
return;
|
|
}
|
|
|
|
std::string filename = fi.path + "/" + fi.fname;
|
|
|
|
/* open file with a suitable application */
|
|
QFileInfo qinfo;
|
|
qinfo.setFile(filename.c_str());
|
|
if (qinfo.exists()) {
|
|
QDesktopServices::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()));
|
|
}else{
|
|
// QMessageBox::information(this, "RetroShare", tr("File %1 does not exist at location.").arg(fi.path.c_str()));
|
|
}
|
|
|
|
hide();
|
|
}
|