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

fix(profile): Fix for opening file dialog using Nautilus file manager

Importing a profile, saving a QR code image or setting an auto-accept directory using Nautilus as the default file manager, which many users use, was causing a hang in Qt's  method. Setting Qt to use it's own file manager in this circumstance fixes the issue. Closes #3436, closes #3443.
This commit is contained in:
Andrew Morgan 2016-06-27 22:23:08 -07:00 committed by Andrew Morgan
parent 9694d6b6d4
commit 881409b91f
No known key found for this signature in database
GPG Key ID: 174BEAB009FD176D
7 changed files with 40 additions and 19 deletions

View File

@ -478,7 +478,10 @@ void FileTransferWidget::handleButton(QPushButton *btn)
{ {
QString path = QFileDialog::getSaveFileName(parentWidget(), QString path = QFileDialog::getSaveFileName(parentWidget(),
tr("Save a file", "Title of the file saving dialog"), tr("Save a file", "Title of the file saving dialog"),
Settings::getInstance().getGlobalAutoAcceptDir() + "/" + fileInfo.fileName); Settings::getInstance().getGlobalAutoAcceptDir() + "/" + fileInfo.fileName,
0,
0,
QFileDialog::DontUseNativeDialog);
acceptTransfer(path); acceptTransfer(path);
} }
} }

View File

@ -60,8 +60,10 @@ void AboutUser::onAutoAcceptClicked()
} }
else if (ui->autoaccept->isChecked()) else if (ui->autoaccept->isChecked())
{ {
dir = QFileDialog::getExistingDirectory(this, tr("Choose an auto accept directory", dir = QFileDialog::getExistingDirectory(this,
"popup title"), dir); tr("Choose an auto accept directory", "popup title"),
dir,
QFileDialog::DontUseNativeDialog);
if(dir.isEmpty()) if(dir.isEmpty())
{ {
ui->autoaccept->setChecked(false); ui->autoaccept->setChecked(false);
@ -77,8 +79,10 @@ void AboutUser::onAutoAcceptClicked()
void AboutUser::onSelectDirClicked() void AboutUser::onSelectDirClicked()
{ {
QString dir; QString dir;
dir = QFileDialog::getExistingDirectory(this, tr("Choose an auto accept directory", dir = QFileDialog::getExistingDirectory(this,
"popup title"), dir); tr("Choose an auto accept directory", "popup title"),
dir,
QFileDialog::DontUseNativeDialog);
ui->autoaccept->setChecked(true); ui->autoaccept->setChecked(true);
Settings::getInstance().setAutoAcceptDir(this->toxId, dir); Settings::getInstance().setAutoAcceptDir(this->toxId, dir);
Settings::getInstance().saveGlobal(); Settings::getInstance().saveGlobal();

View File

@ -187,7 +187,11 @@ void ChatForm::onTextEditChanged()
void ChatForm::onAttachClicked() void ChatForm::onAttachClicked()
{ {
QStringList paths = QFileDialog::getOpenFileNames(this, QStringList paths = QFileDialog::getOpenFileNames(this,
tr("Send a file")); tr("Send a file"),
QDir::homePath(),
0,
0,
QFileDialog::DontUseNativeDialog);
if (paths.isEmpty()) if (paths.isEmpty())
return; return;

View File

@ -264,9 +264,11 @@ void ProfileForm::onAvatarClicked()
}; };
QString filename = QFileDialog::getOpenFileName(this, QString filename = QFileDialog::getOpenFileName(this,
tr("Choose a profile picture"), tr("Choose a profile picture"),
QDir::homePath(), QDir::homePath(),
Nexus::getSupportedImageFilter()); Nexus::getSupportedImageFilter(),
0,
QFileDialog::DontUseNativeDialog);
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
@ -342,8 +344,10 @@ void ProfileForm::onExportClicked()
QString current = Nexus::getProfile()->getName() + Core::TOX_EXT; QString current = Nexus::getProfile()->getName() + Core::TOX_EXT;
QString path = QFileDialog::getSaveFileName(this, QString path = QFileDialog::getSaveFileName(this,
tr("Export profile", "save dialog title"), tr("Export profile", "save dialog title"),
QDir::home().filePath(current), QDir::home().filePath(current),
tr("Tox save file (*.tox)", "save dialog filter")); tr("Tox save file (*.tox)", "save dialog filter"),
0,
QFileDialog::DontUseNativeDialog);
if (!path.isEmpty()) if (!path.isEmpty())
{ {
if (!Nexus::tryRemoveFile(path)) if (!Nexus::tryRemoveFile(path))
@ -415,8 +419,10 @@ void ProfileForm::onSaveQrClicked()
QString current = Nexus::getProfile()->getName() + ".png"; QString current = Nexus::getProfile()->getName() + ".png";
QString path = QFileDialog::getSaveFileName(this, QString path = QFileDialog::getSaveFileName(this,
tr("Save", "save qr image"), tr("Save", "save qr image"),
QDir::home().filePath(current), QDir::home().filePath(current),
tr("Save QrCode (*.png)", "save dialog filter")); tr("Save QrCode (*.png)", "save dialog filter"),
0,
QFileDialog::DontUseNativeDialog);
if (!path.isEmpty()) if (!path.isEmpty())
{ {
if (!Nexus::tryRemoveFile(path)) if (!Nexus::tryRemoveFile(path))

View File

@ -378,8 +378,8 @@ void GeneralForm::onAutoSaveDirChange()
QString previousDir = Settings::getInstance().getGlobalAutoAcceptDir(); QString previousDir = Settings::getInstance().getGlobalAutoAcceptDir();
QString directory = QFileDialog::getExistingDirectory(0, QString directory = QFileDialog::getExistingDirectory(0,
tr("Choose an auto accept directory", "popup title"), //opens in home directory tr("Choose an auto accept directory", "popup title"), //opens in home directory
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory) QDir::homePath(),
); QFileDialog::DontUseNativeDialog);
if (directory.isEmpty()) // cancel was pressed if (directory.isEmpty()) // cancel was pressed
directory = previousDir; directory = previousDir;

View File

@ -199,7 +199,10 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
} }
else if (autoAccept->isChecked()) else if (autoAccept->isChecked())
{ {
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir); dir = QFileDialog::getExistingDirectory(0,
tr("Choose an auto accept directory","popup title"),
dir,
QFileDialog::DontUseNativeDialog);
autoAccept->setChecked(true); autoAccept->setChecked(true);
qDebug() << "setting auto accept dir for" << friendId << "to" << dir; qDebug() << "setting auto accept dir for" << friendId << "to" << dir;
Settings::getInstance().setAutoAcceptDir(id, dir); Settings::getInstance().setAutoAcceptDir(id, dir);

View File

@ -36,11 +36,12 @@ ProfileImporter::ProfileImporter(QWidget *parent) : QWidget(parent)
bool ProfileImporter::importProfile() bool ProfileImporter::importProfile()
{ {
QString path = QFileDialog::getOpenFileName( this, QString path = QFileDialog::getOpenFileName(this,
tr("Import profile", "import dialog title"), tr("Import profile", "import dialog title"),
QDir::homePath(), QDir::homePath(),
tr("Tox save file (*.tox)", "import dialog filter") ); tr("Tox save file (*.tox)", "import dialog filter"),
0,
QFileDialog::DontUseNativeDialog);
if (path.isEmpty()) if (path.isEmpty())
return false; return false;