Commit e83f7882 authored by Andreas Traczyk's avatar Andreas Traczyk

settings: limit ringtone to opus files and start in last path

Change-Id: Id17b2428d9558fb5b0aa2a01bb181d33b280925c
parent 13b02723
......@@ -153,13 +153,15 @@ void
AdvancedSettingsWidget::openFileCustomRingtone()
{
QString fileUrl;
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a new ringtone"), QDir::currentPath() + QString("/ringtones/"));
auto oldPath = QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath);
auto openPath = oldPath.isEmpty() ? QDir::currentPath() + QString("/ringtones/") : QFileInfo(oldPath).absolutePath();
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a new ringtone"), openPath, tr("Opus Files (*.opus)"));
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtone->setText(QFileInfo(fileUrl).fileName());
} else {
} else if (oldPath.isEmpty()) {
ui->btnRingtone->setText(tr("Add a custom ringtone"));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment