Commit b52f67f7 authored by wmayer's avatar wmayer
Browse files

0000917: Task watcher doesn't update on object creation/destruction

parent 0d17470a
......@@ -284,6 +284,8 @@ Document* Application::newDocument(const char * Name, const char * UserName)
_pActiveDoc->signalChangedObject.connect(boost::bind(&App::Application::slotChangedObject, this, _1, _2));
_pActiveDoc->signalRenamedObject.connect(boost::bind(&App::Application::slotRenamedObject, this, _1));
_pActiveDoc->signalActivatedObject.connect(boost::bind(&App::Application::slotActivatedObject, this, _1));
_pActiveDoc->signalUndo.connect(boost::bind(&App::Application::slotUndoDocument, this, _1));
_pActiveDoc->signalRedo.connect(boost::bind(&App::Application::slotRedoDocument, this, _1));
// make sure that the active document is set in case no GUI is up
{
......@@ -827,6 +829,15 @@ void Application::slotActivatedObject(const App::DocumentObject&O)
this->signalActivatedObject(O);
}
void Application::slotUndoDocument(const App::Document& d)
{
this->signalUndoDocument(d);
}
void Application::slotRedoDocument(const App::Document& d)
{
this->signalRedoDocument(d);
}
//**************************************************************************
// Init, Destruct and singleton
......
......@@ -116,6 +116,10 @@ public:
boost::signal<void (const Document&)> signalStartRestoreDocument;
/// signal on restoring Document
boost::signal<void (const Document&)> signalFinishRestoreDocument;
/// signal on undo in document
boost::signal<void (const Document&)> signalUndoDocument;
/// signal on redo in document
boost::signal<void (const Document&)> signalRedoDocument;
//@}
......@@ -240,6 +244,8 @@ protected:
void slotChangedObject(const App::DocumentObject&, const App::Property& Prop);
void slotRenamedObject(const App::DocumentObject&);
void slotActivatedObject(const App::DocumentObject&);
void slotUndoDocument(const App::Document&);
void slotRedoDocument(const App::Document&);
//@}
private:
......
......@@ -239,6 +239,9 @@ bool Document::undo(void)
delete mUndoTransactions.back();
mUndoTransactions.pop_back();
signalUndo(*this);
return true;
}
return false;
......@@ -263,6 +266,9 @@ bool Document::redo(void)
delete mRedoTransactions.back();
mRedoTransactions.pop_back();
signalRedo(*this);
return true;
}
return false;
......
......@@ -92,6 +92,10 @@ public:
boost::signal<void (const App::DocumentObject&)> signalRenamedObject;
/// signal on activated Object
boost::signal<void (const App::DocumentObject&)> signalActivatedObject;
/// signal on undo
boost::signal<void (const App::Document&)> signalUndo;
/// signal on redo
boost::signal<void (const App::Document&)> signalRedo;
/** signal on load/save document
* this signal is given when the document gets streamed.
* you can use this hook to write additional information in
......
......@@ -204,6 +204,12 @@ TaskView::TaskView(QWidget *parent)
connectApplicationDeleteDocument =
App::GetApplication().signalDeletedDocument.connect
(boost::bind(&Gui::TaskView::TaskView::slotDeletedDocument, this));
connectApplicationUndoDocument =
App::GetApplication().signalUndoDocument.connect
(boost::bind(&Gui::TaskView::TaskView::slotUndoDocument, this, _1));
connectApplicationRedoDocument =
App::GetApplication().signalRedoDocument.connect
(boost::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, _1));
}
TaskView::~TaskView()
......@@ -259,6 +265,17 @@ void TaskView::slotDeletedDocument()
updateWatcher();
}
void TaskView::slotUndoDocument(const App::Document&)
{
if (!ActiveDialog)
updateWatcher();
}
void TaskView::slotRedoDocument(const App::Document&)
{
if (!ActiveDialog)
updateWatcher();
}
/// @cond DOXERR
void TaskView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
......
......@@ -127,6 +127,8 @@ protected:
void slotActiveDocument(const App::Document&);
void slotDeletedDocument();
void slotUndoDocument(const App::Document&);
void slotRedoDocument(const App::Document&);
std::vector<TaskWatcher*> ActiveWatcher;
......@@ -136,6 +138,8 @@ protected:
Connection connectApplicationActiveDocument;
Connection connectApplicationDeleteDocument;
Connection connectApplicationUndoDocument;
Connection connectApplicationRedoDocument;
};
} //namespace TaskView
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment