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:
@@ -98,6 +98,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
connect (&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
|
||||
connect (&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateUndoStack()));
|
||||
connect (QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
|
||||
connect (&undo_group, SIGNAL(cleanChanged(bool)), this, SLOT(activeUndoStackCleanChanged(bool)));
|
||||
|
||||
// lecture des parametres
|
||||
readSettings();
|
||||
@@ -630,6 +631,7 @@ void QETDiagramEditor::save() {
|
||||
if (ProjectView *project_view = currentProject()) {
|
||||
QETResult saved = project_view -> save();
|
||||
if (saved.isOk()) {
|
||||
save_file->setDisabled(true);
|
||||
QETApp::projectsRecentFiles() -> fileWasOpened(project_view -> project() -> filePath());
|
||||
//fake progressbar
|
||||
progressBar = new QProgressBar;
|
||||
@@ -1176,7 +1178,7 @@ void QETDiagramEditor::slot_updateActions() {
|
||||
|
||||
// actions ayant juste besoin d'un document ouvert
|
||||
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);
|
||||
prj_edit_prop -> setEnabled(opened_project);
|
||||
prj_add_diagram -> setEnabled(editable_project);
|
||||
@@ -1210,6 +1212,7 @@ void QETDiagramEditor::slot_updateUndoStack() {
|
||||
undo_group.setActiveStack(pv->project()->undoStack());
|
||||
undo -> setEnabled (undo_group.canUndo());
|
||||
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() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +157,9 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
void showError(const QString &);
|
||||
void addItemFinish();
|
||||
|
||||
private slots:
|
||||
void activeUndoStackCleanChanged (bool clean);
|
||||
|
||||
// attributes
|
||||
public:
|
||||
// Actions reachable through menus within QElectroTech
|
||||
|
||||
Reference in New Issue
Block a user