Skip to content
Extraits de code Groupes Projets

Add documents

Fusionnées Kubat a demandé de fusionner vivy-document vers master
1 file
+ 9
2
Comparer les modifications
  • Côte à côte
  • En ligne
+ 9
2
@@ -63,11 +63,18 @@ VivyDocument::detectDocumentType(const QFileInfo &file, VivyDocument::SubDocumen
bool
VivyDocument::rename(const QString &name) noexcept
{
/* Compute new paths */
const QString newNameWithExtension = name.right(filePrefix.size()) == filePrefix ? name : name + "." + filePrefix;
QFileInfo oldPath(documentLocation, documentName + "." + filePrefix);
QFileInfo newPath(documentLocation, newNameWithExtension);
QDir renamer;
if (renamer.rename(oldPath.absoluteFilePath(), newPath.absoluteFilePath())) {
/* Create folder if needed */
QDir dirOp;
const QString newAbsDirPath = newPath.dir().absolutePath();
if (!dirOp.exists(newAbsDirPath))
dirOp.mkpath(newAbsDirPath);
if (dirOp.rename(oldPath.absoluteFilePath(), newPath.absoluteFilePath())) {
documentLocation = newPath.dir();
documentName = newPath.baseName();
return true;
Chargement en cours