Implement a way for setting the title in the main toolbar.

This commit is contained in:
Luis Ángel San Martín
2018-09-12 10:22:39 +02:00
committed by Luis Ángel San Martín
parent ca5096fba4
commit e7922a0e51
5 changed files with 27 additions and 15 deletions

View File

@ -1567,12 +1567,12 @@ void LibraryWindow::onAddComicsToLabel()
void LibraryWindow::setToolbarTitle(const QModelIndex &modelIndex)
{
#ifndef Q_OS_MAC
if (!modelIndex.isValid())
libraryToolBar->setCurrentFolderName(selectedLibrary->currentText());
else
libraryToolBar->setCurrentFolderName(modelIndex.data().toString());
#endif
if (!theme.isMacosNative) {
if (!modelIndex.isValid())
libraryToolBar->setTitle(selectedLibrary->currentText());
else
libraryToolBar->setTitle(modelIndex.data().toString());
}
}
void LibraryWindow::saveSelectedCoversTo()
@ -1839,20 +1839,23 @@ void LibraryWindow::rename(QString newName) //TODO replace
QString currentLibrary = selectedLibrary->currentText();
if (newName != currentLibrary) {
if (!libraries.contains(newName)) {
libraries.rename(currentLibrary, newName);
libraries.rename(currentLibrary,newName);
//selectedLibrary->removeItem(selectedLibrary->currentIndex());
//libraries.addLibrary(newName,path);
selectedLibrary->renameCurrentLibrary(newName);
libraries.save();
renameLibraryDialog->close();
#ifndef Q_OS_MAC
if (!foldersModelProxy->mapToSource(foldersView->currentIndex()).isValid())
libraryToolBar->setCurrentFolderName(selectedLibrary->currentText());
#endif
} else {
if (!theme.isMacosNative) {
if(!foldersModelProxy->mapToSource(foldersView->currentIndex()).isValid())
libraryToolBar->setTitle(selectedLibrary->currentText());
}
}
else {
libraryAlreadyExists(newName);
}
} else
}
else
renameLibraryDialog->close();
//selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
}