]> git.sven.stormbind.net Git - sven/vym.git/blobdiff - src/vymmodel.cpp
New upstream version 2.9.27
[sven/vym.git] / src / vymmodel.cpp
index d3ce38483e9a1943381cdeb552e06cb486793094..f1378219f6b909e45e5c5c9564246c3763e3b4c2 100644 (file)
@@ -1135,6 +1135,8 @@ bool VymModel::renameMap(const QString &newPath)
             qWarning() << "VymModel::renameMap failed to release lock for " << oldPath;
         vymLock = newLock;
         setFilePath(newPath);
+        if (readonly)
+            setReadOnly(false);
         return true;
     }
     qWarning() << "VymModel::renameMap failed to get lockfile. state=" << vymLock.getState();
@@ -1196,13 +1198,14 @@ void VymModel::fileChanged()
 {
     // Check if file on disk has changed meanwhile
     if (!filePath.isEmpty()) {
-        if (readonly) {
+        if (readonly && vymLock.getState() != VymLock::LockedByMyself) {
             // unset readonly if lockfile is gone
+            // but only, if map was LockedByOther before
             if (vymLock.tryLock())
                 setReadOnly(false);
         }
         else {
-            // We could check, if somebody else removed/replaced lockfile
+            // FIXME-5 We could check, if somebody else removed/replaced lockfile
             // (A unique vym ID would be needed)
 
             QDateTime tmod = QFileInfo(filePath).lastModified();
@@ -4843,6 +4846,21 @@ bool VymModel::exportLastAvailable(QString &description, QString &command,
         return false;
 }
 
+void VymModel::setExportLastCommand(const QString &cmd)
+{
+    settings.setLocalValue(filePath, "/export/last/command", cmd);
+}
+
+void VymModel::setExportLastDescription(const QString &desc)
+{
+    settings.setLocalValue(filePath, "/export/last/description", desc);
+}
+
+void VymModel::setExportLastDestination(const QString &displayedDest)
+{
+    settings.setLocalValue(filePath, "/export/last/displayedDestination", displayedDest);
+}
+
 void VymModel::exportLast()
 {
     QString desc, command,