diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-14 22:51:32 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-14 22:54:30 +0200 |
commit | 96f63e6078ec3153b4db568a2fa7ed5efb546d12 (patch) | |
tree | ed0b8b47a978b6834e0cbc8b27cf3cb15d693df9 | |
parent | 537dfe482fc0378151406ee37a98c99283b5a3f0 (diff) |
Remove mountpoint when storing folders to talk.
When using Rockbox Utility some later time the mountpoint might have changed.
This would invalidate the list of folders to voice even if the folders are
still present on the player. Remove the mountpoint part before storing the
folders, and add it when loading the settings.
Change-Id: Ic4ed98b205d20f6a0b3a1e1da396bbdcd02c255e
-rw-r--r-- | rbutil/rbutilqt/installtalkwindow.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp index dedb19cb38..521cd0db7a 100644 --- a/rbutil/rbutilqt/installtalkwindow.cpp +++ b/rbutil/rbutilqt/installtalkwindow.cpp @@ -52,11 +52,13 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) void InstallTalkWindow::saveSettings(void) { + QString mp = RbSettings::value(RbSettings::Mountpoint).toString(); QModelIndexList si = ui.treeView->selectionModel()->selectedIndexes(); QStringList foldersToTalk; for(int i = 0; i < si.size(); i++) { if(si.at(i).column() == 0) { - foldersToTalk.append(fsm->filePath(si.at(i))); + QString current = fsm->filePath(si.at(i)); + foldersToTalk.append(current.remove(QRegExp("^" + mp))); } } RbSettings::setValue(RbSettings::TalkFolders, foldersToTalk); @@ -118,6 +120,7 @@ void InstallTalkWindow::accept() void InstallTalkWindow::updateSettings(void) { + QString mp = RbSettings::value(RbSettings::Mountpoint).toString(); QString ttsName = RbSettings::value(RbSettings::Tts).toString(); TTSBase* tts = TTSBase::getTTS(this,ttsName); if(tts->configOk()) @@ -129,7 +132,7 @@ void InstallTalkWindow::updateSettings(void) QStringList folders = RbSettings::value(RbSettings::TalkFolders).toStringList(); for(int i = 0; i < folders.size(); ++i) { - QModelIndex mi = fsm->index(folders.at(i)); + QModelIndex mi = fsm->index(mp + folders.at(i)); ui.treeView->selectionModel()->select(mi, QItemSelectionModel::Select); // make sure all parent items are expanded. while((mi = mi.parent()) != QModelIndex()) { |