mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5158
ezavod (2): fix(chatform): check for empty path when exporting profile refactor(chatform): consistent usage of file dialogs
This commit is contained in:
commit
9b46700c6a
@ -507,8 +507,7 @@ void FileTransferWidget::handleButton(QPushButton* btn)
|
||||
QFileDialog::getSaveFileName(Q_NULLPTR,
|
||||
tr("Save a file", "Title of the file saving dialog"),
|
||||
Settings::getInstance().getGlobalAutoAcceptDir() + "/"
|
||||
+ fileInfo.fileName,
|
||||
0, 0);
|
||||
+ fileInfo.fileName);
|
||||
acceptTransfer(path);
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ static inline bool checkIsValidId(const QString& id)
|
||||
|
||||
void AddFriendForm::onImportOpenClicked()
|
||||
{
|
||||
const QString path = QFileDialog::getOpenFileName(tabWidget, tr("Open contact list"));
|
||||
const QString path = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open contact list"));
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1067,8 +1067,7 @@ void ChatForm::onExportChat()
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
QList<History::HistMessage> msgs = history->getChatHistoryFromDate(pk, epochStart, now);
|
||||
|
||||
QString path = QFileDialog::getSaveFileName(0, tr("Save chat log"), QString{}, QString{}, 0,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QString path = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save chat log"));
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ void GenericChatForm::onEmoteInsertRequested(QString str)
|
||||
|
||||
void GenericChatForm::onSaveLogClicked()
|
||||
{
|
||||
QString path = QFileDialog::getSaveFileName(0, tr("Save chat log"));
|
||||
QString path = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save chat log"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
|
@ -348,10 +348,13 @@ void ProfileForm::onExportClicked()
|
||||
{
|
||||
const QString current = profileInfo->getProfileName() + Core::TOX_EXT;
|
||||
//:save dialog title
|
||||
const QString path = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Export profile"),
|
||||
QDir::home().filePath(current),
|
||||
const QString path = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Export profile"), current,
|
||||
//: save dialog filter
|
||||
tr("Tox save file (*.tox)"), nullptr);
|
||||
tr("Tox save file (*.tox)"));
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const IProfileInfo::SaveResult result = profileInfo->exportProfile(path);
|
||||
if (result == IProfileInfo::SaveResult::OK) {
|
||||
return;
|
||||
@ -413,8 +416,11 @@ void ProfileForm::onSaveQrClicked()
|
||||
{
|
||||
const QString current = profileInfo->getProfileName() + ".png";
|
||||
const QString path = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR, tr("Save", "save qr image"), QDir::home().filePath(current),
|
||||
tr("Save QrCode (*.png)", "save dialog filter"), nullptr);
|
||||
Q_NULLPTR, tr("Save", "save qr image"), current,
|
||||
tr("Save QrCode (*.png)", "save dialog filter"));
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const IProfileInfo::SaveResult result = profileInfo->saveQr(*qr->getImage(), path);
|
||||
if (result == IProfileInfo::SaveResult::OK) {
|
||||
|
@ -99,8 +99,7 @@ void AdvancedForm::on_cbMakeToxPortable_stateChanged()
|
||||
void AdvancedForm::on_btnExportLog_clicked()
|
||||
{
|
||||
QString savefile =
|
||||
QFileDialog::getSaveFileName(this, tr("Save File"), QDir::homePath(), tr("Logs (*.log)"), 0,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save File"), QString{}, tr("Logs (*.log)"));
|
||||
|
||||
if (savefile.isNull() || savefile.isEmpty()) {
|
||||
qDebug() << "Debug log save file was not properly chosen";
|
||||
|
@ -53,7 +53,7 @@ bool ProfileImporter::importProfile()
|
||||
// TODO: Change all QFileDialog instances across project to use
|
||||
// this instead of Q_NULLPTR. Possibly requires >Qt 5.9 due to:
|
||||
// https://bugreports.qt.io/browse/QTBUG-59184
|
||||
QString path = QFileDialog::getOpenFileName(Q_NULLPTR, title, dir, filter, 0);
|
||||
QString path = QFileDialog::getOpenFileName(Q_NULLPTR, title, dir, filter);
|
||||
|
||||
return importProfile(path);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user