1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Add open directory option to completed file transfers

This commit is contained in:
TheLastProject 2015-02-17 20:07:25 +01:00
parent 9946a4642e
commit 4edb608777
3 changed files with 75 additions and 0 deletions

View File

@ -152,6 +152,7 @@
<file>ui/fileTransferInstance/no.svg</file>
<file>ui/fileTransferInstance/pause.svg</file>
<file>ui/fileTransferInstance/yes.svg</file>
<file>ui/fileTransferInstance/dir.svg</file>
<file>ui/fileTransferInstance/arrow_white.svg</file>
<file>ui/fileTransferInstance/browse.svg</file>
<file>ui/fileTransferInstance/filetransferWidget.css</file>

View File

@ -327,6 +327,10 @@ void FileTransferWidget::onFileTransferFinished(ToxFile file)
ui->topButton->setEnabled(openExtensions.contains(QFileInfo(file.fileName).suffix()));
ui->topButton->show();
ui->bottomButton->setIcon(QIcon(":/ui/fileTransferInstance/dir.svg"));
ui->bottomButton->setObjectName("dir");
ui->bottomButton->show();
// preview
if(fileInfo.direction == ToxFile::RECEIVING)
showPreview(fileInfo.filePath);
@ -427,6 +431,13 @@ void FileTransferWidget::handleButton(QPushButton *btn)
{
QDesktopServices::openUrl(QUrl("file:///" + fileInfo.filePath, QUrl::TolerantMode));
}
else if (btn->objectName() == "dir")
{
QString dirName = fileInfo.filePath;
dirName.chop(fileInfo.fileName.length());
QDesktopServices::openUrl(QUrl("file:///" + dirName, QUrl::TolerantMode));
}
}
void FileTransferWidget::showPreview(const QString &filename)

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="12"
height="12"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="browse.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1377"
id="namedview22"
showgrid="false"
inkscape:zoom="27.812867"
inkscape:cx="7.3552517"
inkscape:cy="6.238286"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="matrix(1.1423998,0,0,1.1423998,-0.85439881,-2392.0444)"
id="layer1">
<g
id="g6659"
style="fill:#999999">
<path
d="m 0.99206881,2098.1979 c -0.10310776,0 -0.18644079,0.07 -0.18644079,0.1559 l 0,5.9208 c 0,0.087 0.0833323,0.1566 0.18644079,0.1566 l 10.01586219,0 c 0.103108,0 0.186441,-0.07 0.186441,-0.1566 l 0,-5.9208 c 0,-0.087 -0.08334,-0.1559 -0.186441,-0.1559 l -1.8913078,0 0,4.4022 c 0,0.087 -0.083329,0.1567 -0.1864405,0.1567 l -5.8603649,0 c -0.1031078,0 -0.1864408,-0.07 -0.1864408,-0.1567 l 0,-4.4022 -1.8913082,0 z"
id="rect2985"
style="fill:#ffffff;fill-opacity:1;stroke:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB