mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Save icon is disable when undo stack is empty
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3541 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -95,9 +95,10 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
setWindowState(Qt::WindowMaximized);
|
setWindowState(Qt::WindowMaximized);
|
||||||
|
|
||||||
// connexions signaux / slots pour une interface sensee
|
// connexions signaux / slots pour une interface sensee
|
||||||
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
|
connect (&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
|
||||||
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateUndoStack()));
|
connect (&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateUndoStack()));
|
||||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
|
connect (QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
|
||||||
|
connect (&undo_group, SIGNAL(cleanChanged(bool)), this, SLOT(activeUndoStackCleanChanged(bool)));
|
||||||
|
|
||||||
// lecture des parametres
|
// lecture des parametres
|
||||||
readSettings();
|
readSettings();
|
||||||
@@ -630,6 +631,7 @@ void QETDiagramEditor::save() {
|
|||||||
if (ProjectView *project_view = currentProject()) {
|
if (ProjectView *project_view = currentProject()) {
|
||||||
QETResult saved = project_view -> save();
|
QETResult saved = project_view -> save();
|
||||||
if (saved.isOk()) {
|
if (saved.isOk()) {
|
||||||
|
save_file->setDisabled(true);
|
||||||
QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath());
|
QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath());
|
||||||
//fake progressbar
|
//fake progressbar
|
||||||
progressBar = new QProgressBar;
|
progressBar = new QProgressBar;
|
||||||
@@ -1176,7 +1178,7 @@ void QETDiagramEditor::slot_updateActions() {
|
|||||||
|
|
||||||
// actions ayant juste besoin d'un document ouvert
|
// actions ayant juste besoin d'un document ouvert
|
||||||
close_file -> setEnabled(opened_project);
|
close_file -> setEnabled(opened_project);
|
||||||
save_file -> setEnabled(editable_project);
|
save_file -> setEnabled(editable_project && undo_group.activeStack()->count());
|
||||||
save_file_as -> setEnabled(opened_project);
|
save_file_as -> setEnabled(opened_project);
|
||||||
prj_edit_prop -> setEnabled(opened_project);
|
prj_edit_prop -> setEnabled(opened_project);
|
||||||
prj_add_diagram -> setEnabled(editable_project);
|
prj_add_diagram -> setEnabled(editable_project);
|
||||||
@@ -1210,6 +1212,7 @@ void QETDiagramEditor::slot_updateUndoStack() {
|
|||||||
undo_group.setActiveStack(pv->project()->undoStack());
|
undo_group.setActiveStack(pv->project()->undoStack());
|
||||||
undo -> setEnabled (undo_group.canUndo());
|
undo -> setEnabled (undo_group.canUndo());
|
||||||
redo -> setEnabled (undo_group.canRedo());
|
redo -> setEnabled (undo_group.canRedo());
|
||||||
|
save_file -> setEnabled (undo_group.activeStack()->count() && !pv -> project() -> isReadOnly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1979,3 +1982,15 @@ void QETDiagramEditor::showError(const QString &error) {
|
|||||||
void QETDiagramEditor::addItemFinish() {
|
void QETDiagramEditor::addItemFinish() {
|
||||||
m_add_item_actions_group.checkedAction()->setChecked(false);
|
m_add_item_actions_group.checkedAction()->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETDiagramEditor::activeUndoStackCleanChanged
|
||||||
|
* Enable the QAction save_file when @clean is set to false
|
||||||
|
* @clean at true do nothing;
|
||||||
|
* @param clean
|
||||||
|
*/
|
||||||
|
void QETDiagramEditor::activeUndoStackCleanChanged(bool clean) {
|
||||||
|
if (!clean) {
|
||||||
|
save_file -> setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
void showError(const QETResult &);
|
void showError(const QETResult &);
|
||||||
void showError(const QString &);
|
void showError(const QString &);
|
||||||
void addItemFinish();
|
void addItemFinish();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void activeUndoStackCleanChanged (bool clean);
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user