Skip to content
Snippets Groups Projects
Commit e83f7882 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

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

Change-Id: Id17b2428d9558fb5b0aa2a01bb181d33b280925c
parent 13b02723
No related branches found
No related tags found
No related merge requests found
...@@ -153,13 +153,15 @@ void ...@@ -153,13 +153,15 @@ void
AdvancedSettingsWidget::openFileCustomRingtone() AdvancedSettingsWidget::openFileCustomRingtone()
{ {
QString fileUrl; 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()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString(); confProps.Ringtone.ringtonePath = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtone->setText(QFileInfo(fileUrl).fileName()); ui->btnRingtone->setText(QFileInfo(fileUrl).fileName());
} else { } else if (oldPath.isEmpty()) {
ui->btnRingtone->setText(tr("Add a custom ringtone")); ui->btnRingtone->setText(tr("Add a custom ringtone"));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment