@ -59,6 +59,8 @@
@@ -59,6 +59,8 @@
# include <QByteArray>
# include <QImageReader>
# include <QList>
# include <QDesktopServices>
# include <QProcess>
# include <tox/tox.h>
# ifdef Q_OS_ANDROID
@ -498,17 +500,25 @@ void Widget::onTransferClicked()
@@ -498,17 +500,25 @@ void Widget::onTransferClicked()
activeChatroomWidget = nullptr ;
}
bool Widget : : confirmExecutableOpen ( const QFileInfo file )
void Widget : : confirmExecutableOpen ( const QFileInfo file )
{
if ( file . isExecutable ( ) )
static const QStringList dangerousExtensions = { " app " , " bat " , " com " , " cpl " , " dmg " , " exe " , " hta " , " jar " , " js " , " jse " , " lnk " , " msc " , " msh " , " msh1 " , " msh1xml " , " msh2 " , " msh2xml " , " mshxml " , " msi " , " msp " , " pif " , " ps1 " , " ps1xml " , " ps2 " , " ps2xml " , " psc1 " , " psc2 " , " py " , " reg " , " scf " , " sh " , " src " , " vb " , " vbe " , " vbs " , " ws " , " wsc " , " wsf " , " wsh " } ;
if ( dangerousExtensions . contains ( file . suffix ( ) ) )
{
if ( ! GUI : : askQuestion ( tr ( " Executable file " , " popup title " ) , tr ( " You have asked qTox to open an executable file. Executable files can potentially damage your computer. Are you sure want to open this file? " , " popup text " ) , false , true ) )
{
return false ;
return ;
}
// The user wants to run this file, so make it executable and run it
QFile ( file . filePath ( ) ) . setPermissions ( file . permissions ( ) | QFile : : ExeOwner | QFile : : ExeUser | QFile : : ExeGroup | QFile : : ExeOther ) ;
QProcess : : startDetached ( file . filePath ( ) ) ;
}
else
{
QDesktopServices : : openUrl ( QUrl ( " file:// " + file . filePath ( ) , QUrl : : TolerantMode ) ) ;
}
return true ;
}
void Widget : : onIconClick ( QSystemTrayIcon : : ActivationReason reason )