1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

SessionManager: Use completeBaseName for session names

This commit is contained in:
David Rosca 2018-01-22 14:21:20 +01:00
parent 7b0aa61975
commit 81d7917ade

View File

@ -123,7 +123,7 @@ void SessionManager::renameSession(QString sessionFilePath, SessionFlags flags)
} }
bool ok; bool ok;
const QString suggestedName = QFileInfo(sessionFilePath).baseName() + (flags.testFlag(CloneSession) ? tr("_cloned") : tr("_renamed")); const QString suggestedName = QFileInfo(sessionFilePath).completeBaseName() + (flags.testFlag(CloneSession) ? tr("_cloned") : tr("_renamed"));
QString newName = QInputDialog::getText(mApp->activeWindow(), (flags.testFlag(CloneSession) ? tr("Clone Session") : tr("Rename Session")), QString newName = QInputDialog::getText(mApp->activeWindow(), (flags.testFlag(CloneSession) ? tr("Clone Session") : tr("Rename Session")),
tr("Please enter a new name:"), QLineEdit::Normal, tr("Please enter a new name:"), QLineEdit::Normal,
suggestedName, &ok); suggestedName, &ok);
@ -197,7 +197,7 @@ void SessionManager::cloneSession(const QString &filePath)
void SessionManager::deleteSession(const QString &filePath) void SessionManager::deleteSession(const QString &filePath)
{ {
QMessageBox::StandardButton result = QMessageBox::information(mApp->activeWindow(), tr("Delete Session"), tr("Are you sure you want to delete session '%1'?") QMessageBox::StandardButton result = QMessageBox::information(mApp->activeWindow(), tr("Delete Session"), tr("Are you sure you want to delete session '%1'?")
.arg(QFileInfo(filePath).baseName()), QMessageBox::Yes | QMessageBox::No); .arg(QFileInfo(filePath).completeBaseName()), QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
QFile::remove(filePath); QFile::remove(filePath);
} }
@ -284,15 +284,15 @@ void SessionManager::fillSessionsMetaDataListIfNeeded()
continue; continue;
SessionMetaData metaData; SessionMetaData metaData;
metaData.name = fileInfo.baseName(); metaData.name = fileInfo.completeBaseName();
if (fileInfo == QFileInfo(defaultSessionPath())) { if (fileInfo == QFileInfo(defaultSessionPath())) {
metaData.name = tr("Default Session"); metaData.name = tr("Default Session");
metaData.isDefault = true; metaData.isDefault = true;
} else if (fileNames.contains(fileInfo.baseName())) { } else if (fileNames.contains(fileInfo.completeBaseName())) {
metaData.name = fileInfo.fileName(); metaData.name = fileInfo.fileName();
} else { } else {
metaData.name = fileInfo.baseName(); metaData.name = fileInfo.completeBaseName();
} }
if (isActive(fileInfo)) { if (isActive(fileInfo)) {