Home
Phabricator
Search
Log In
Paste
P126
Masterwork From Distant Lands
Active
Public
Actions
Authored by
dkazakov
on Oct 30 2017, 11:37 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
diff --git a/libs/ui/kis_change_file_layer_command.h b/libs/ui/kis_change_file_layer_command.h
index ab13530..88ae8b9 100644
--- a/libs/ui/kis_change_file_layer_command.h
+++ b/libs/ui/kis_change_file_layer_command.h
@@ -44,14 +44,16 @@ public:
public:
void redo() override {
m_node->setScalingMethod(m_newMethod);
+
+ // setFileName() automatically issues a setDirty call
m_node->setFileName(m_newPath, m_newFileName);
- m_node->setDirty();
}
void undo() override {
m_node->setScalingMethod(m_oldMethod);
+
+ // setFileName() automatically issues a setDirty call
m_node->setFileName(m_oldPath, m_oldFileName);
- m_node->setDirty();
}
private:
KisFileLayerSP m_node;
diff --git a/libs/ui/kis_layer_manager.cc b/libs/ui/kis_layer_manager.cc
index 721cb4a..3222d4b 100644
--- a/libs/ui/kis_layer_manager.cc
+++ b/libs/ui/kis_layer_manager.cc
@@ -340,30 +340,27 @@ void KisLayerManager::layerProperties()
dlg.setScalingMethod(scalingMethodOld);
if (dlg.exec() == QDialog::Accepted) {
- flayer->setName(dlg.layerName());
- KisFileLayer::ScalingMethod scalingMethod = dlg.scaleToImageResolution();
- flayer->setScalingMethod(scalingMethod);
- QString fileName = dlg.fileName();
+ const QString fileNameNew = dlg.fileName();
+ KisFileLayer::ScalingMethod scalingMethodNew = dlg.scaleToImageResolution();
- if(fileName.isEmpty()){
+ if(fileNameNew.isEmpty()){
QMessageBox::critical(m_view->mainWindow(), i18nc("@title:window", "Krita"), i18n("No file name specified"));
return;
}
- flayer->setFileName(basePath, fileName);
- if (fileNameOld!= fileName || scalingMethodOld != scalingMethod) {
+ flayer->setName(dlg.layerName());
+
+ if (fileNameOld != fileNameNew || scalingMethodOld != scalingMethodNew) {
KisChangeFileLayerCmd *cmd
= new KisChangeFileLayerCmd(flayer,
basePath,
fileNameOld,
scalingMethodOld,
basePath,
- fileName,
- scalingMethod);
- // FIXME: check whether is needed
- cmd->redo();
+ fileNameNew,
+ scalingMethodNew);
+
m_view->undoAdapter()->addCommand(cmd);
- m_view->document()->setModified(true);
}
}
} else { // If layer == normal painting layer, vector layer, or group layer
dkazakov
edited the content of this paste.
(Show Details)
Oct 30 2017, 11:37 AM
dkazakov
changed the title of this paste from untitled to
Masterwork From Distant Lands
.
dkazakov
updated the paste's language from
autodetect
to
autodetect
.
dkazakov
mentioned this in
D8359: Add properties dialog to change file layer properties.
.
Oct 30 2017, 11:41 AM
Log In to Comment