|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
kplato: critical bugs, ok to commit?Hi, just found 2 bugs in kplato:
* Crash when adding tasks from dependency editor. * Sometimes it is impossible to add dependencies because readwrite mode is not properly updated. Attatched patch fixes both, ok to commit? -- Mvh. Dag Andersen [depcrash.diff] Index: libs/ui/kpttaskdialog.cpp =================================================================== --- libs/ui/kpttaskdialog.cpp (revision 1039656) +++ libs/ui/kpttaskdialog.cpp (working copy) @@ -34,7 +34,7 @@ namespace KPlato { -TaskDialog::TaskDialog(Task &task, Accounts &accounts, QWidget *p) +TaskDialog::TaskDialog( Project &project, Task &task, Accounts &accounts, QWidget *p) : KPageDialog(p) { setCaption( i18n("Task Settings") ); @@ -47,11 +47,11 @@ // Create all the tabs. page = new KVBox(); addPage(page, i18n("&General")); - m_generalTab = new TaskGeneralPanel(task, page); + m_generalTab = new TaskGeneralPanel(project, task, page); page = new KVBox(); addPage(page, i18n("&Resources")); - m_resourcesTab = new RequestResourcesPanel(page, task); + m_resourcesTab = new RequestResourcesPanel(page, project, task); page = new KVBox(); addPage(page, i18n("&Documents")); @@ -127,8 +127,8 @@ } //--------------------------- -TaskAddDialog::TaskAddDialog(Task &task, Accounts &accounts, QWidget *p) - : TaskDialog(task, accounts, p) +TaskAddDialog::TaskAddDialog(Project &project, Task &task, Accounts &accounts, QWidget *p) + : TaskDialog(project, task, accounts, p) { // do not know wbs code yet m_generalTab->hideWbs(); Index: libs/ui/kptdependencyeditor.cpp =================================================================== --- libs/ui/kptdependencyeditor.cpp (revision 1039656) +++ libs/ui/kptdependencyeditor.cpp (working copy) @@ -461,7 +461,7 @@ void DependencyConnectorItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { - //qDebug()<<"DependencyConnectorItem::mousePressEvent:"<<node()->name(); + //qDebug()<<"DependencyConnectorItem::mousePressEvent:"<<node()->name()<<isEditable(); if ( ! isEditable() ) { event->ignore(); return; @@ -799,7 +799,7 @@ void DependencyNodeItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { - //kDebug(); + kDebug(); QGraphicsItem::GraphicsItemFlags f = flags(); if ( itemScene()->connectionMode() ) { itemScene()->clearConnection(); @@ -931,7 +931,8 @@ //-------------------- DependencyScene::DependencyScene( QWidget *parent ) : QGraphicsScene( parent ), - m_model( 0 ) + m_model( 0 ), + m_readwrite( false ) { m_connectionitem = new DependencyCreatorItem(); addItem( m_connectionitem ); @@ -1167,6 +1168,9 @@ if ( item->scene() != this ) { addItem( item ); } + item->setEditable( m_readwrite ); + item->startConnector()->setEditable( m_readwrite ); + item->finishConnector()->setEditable( m_readwrite ); //kDebug()<<item->text()<<item; int col = item->nodeLevel(); if ( parent ) { @@ -1274,6 +1278,7 @@ return; } DependencyLinkItem *dep = new DependencyLinkItem( parent, child, rel ); + dep->setEditable( m_readwrite ); addItem( dep ); //kDebug(); dep->createPath(); @@ -1555,6 +1560,7 @@ void DependencyScene::setReadWrite( bool on ) { + m_readwrite = on; foreach ( QGraphicsItem *i, items() ) { if ( i->type() == DependencyConnectorItem::Type ) { static_cast<DependencyConnectorItem*>( i )->setEditable( on ); @@ -1871,6 +1877,7 @@ void DependencyEditor::updateReadWrite( bool on ) { + qDebug()<<"DependencyEditor::updateReadWrite:"<<on; m_view->itemScene()->setReadWrite( on ); ViewBase::updateReadWrite( on ); } Index: libs/ui/kpttaskdialog.h =================================================================== --- libs/ui/kpttaskdialog.h (revision 1039656) +++ libs/ui/kpttaskdialog.h (working copy) @@ -36,6 +36,7 @@ class TaskCostPanel; class TaskDescriptionPanel; class Task; +class Project; class StandardWorktime; class MacroCommand; class RequestResourcesPanel; @@ -52,7 +53,7 @@ * @param accounts all defined accounts * @param parent parent widget */ - TaskDialog(Task &task, Accounts &accounts, QWidget *parent=0); + TaskDialog(Project &project, Task &task, Accounts &accounts, QWidget *parent=0); MacroCommand *buildCommand(); @@ -70,7 +71,7 @@ class KPLATOUI_EXPORT TaskAddDialog : public TaskDialog { Q_OBJECT public: - TaskAddDialog(Task &task, Accounts &accounts, QWidget *parent=0); + TaskAddDialog(Project &project, Task &task, Accounts &accounts, QWidget *parent=0); }; } //KPlato namespace Index: libs/ui/kptdependencyeditor.h =================================================================== --- libs/ui/kptdependencyeditor.h (revision 1039656) +++ libs/ui/kptdependencyeditor.h (working copy) @@ -391,6 +391,7 @@ private: Project *m_project; NodeItemModel *m_model; + bool m_readwrite; QList<DependencyNodeItem*> m_allItems; QMap<int, DependencyNodeItem*> m_visibleItems; QMap<int, DependencyNodeItem*> m_hiddenItems; Index: libs/ui/kptrequestresourcespanel.cpp =================================================================== --- libs/ui/kptrequestresourcespanel.cpp (revision 1039656) +++ libs/ui/kptrequestresourcespanel.cpp (working copy) @@ -34,7 +34,7 @@ namespace KPlato { -RequestResourcesPanel::RequestResourcesPanel(QWidget *parent, Task &task, bool) +RequestResourcesPanel::RequestResourcesPanel(QWidget *parent, Project &project, Task &task, bool) : QWidget(parent) { QVBoxLayout *l = new QVBoxLayout( this ); @@ -43,7 +43,7 @@ m_view->masterView()->header()->moveSection( ResourceAllocationModel::RequestType, m_view->masterView()->header()->count() - 1 ); m_view->setReadWrite( true ); l->addWidget( m_view ); - m_view->setProject( static_cast<Project*>( task.projectNode() ) ); + m_view->setProject( &project ); m_view->setTask( &task ); m_view->masterView()->header()->resizeSections( QHeaderView::ResizeToContents ); Index: libs/ui/kpttaskgeneralpanel.h =================================================================== --- libs/ui/kpttaskgeneralpanel.h (revision 1039656) +++ libs/ui/kpttaskgeneralpanel.h (working copy) @@ -99,7 +99,7 @@ class TaskGeneralPanel : public TaskGeneralPanelImpl { Q_OBJECT public: - explicit TaskGeneralPanel(Task &task, QWidget *parent=0, const char *name=0); + explicit TaskGeneralPanel(Project &project, Task &task, QWidget *parent=0, const char *name=0); MacroCommand *buildCommand(); Index: libs/ui/kptrequestresourcespanel.h =================================================================== --- libs/ui/kptrequestresourcespanel.h (revision 1039656) +++ libs/ui/kptrequestresourcespanel.h (working copy) @@ -30,6 +30,7 @@ { class Task; +class Project; class ResourceGroup; class Resource; class ResourceGroupRequest; @@ -41,7 +42,7 @@ { Q_OBJECT public: - RequestResourcesPanel(QWidget *parent, Task &task, bool baseline=false); + RequestResourcesPanel(QWidget *parent, Project &project, Task &task, bool baseline=false); MacroCommand *buildCommand(); Index: libs/ui/kpttaskgeneralpanel.cpp =================================================================== --- libs/ui/kpttaskgeneralpanel.cpp (revision 1039656) +++ libs/ui/kpttaskgeneralpanel.cpp (working copy) @@ -46,10 +46,10 @@ namespace KPlato { -TaskGeneralPanel::TaskGeneralPanel(Task &task, QWidget *p, const char *n) +TaskGeneralPanel::TaskGeneralPanel(Project &project, Task &task, QWidget *p, const char *n) : TaskGeneralPanelImpl(p, n), m_task(task), - m_project( static_cast<Project&>( *(task.projectNode()) ) ) + m_project( project ) { useTime = true; setStartValues( task ); Index: kptview.cpp =================================================================== --- kptview.cpp (revision 1039656) +++ kptview.cpp (working copy) @@ -1536,9 +1536,9 @@ // do is to add a first project. We will silently accept the challenge // and will not complain. Task * node = getProject().createTask( getPart() ->config().taskDefaults(), currentTask() ); - TaskAddDialog *dia = new TaskAddDialog( *node, getProject().accounts(), this ); + TaskAddDialog *dia = new TaskAddDialog( getProject(), *node, getProject().accounts(), this ); if ( dia->exec() == QDialog::Accepted) { - Node * currNode = currentTask(); + Node * currNode = currentNode(); if ( currNode ) { QUndoCommand *m = dia->buildCommand(); m->redo(); // do changes to task @@ -1557,9 +1557,9 @@ void View::slotAddTask() { Task * node = getProject().createTask( getPart() ->config().taskDefaults(), currentTask() ); - TaskAddDialog *dia = new TaskAddDialog( *node, getProject().accounts(), this ); + TaskAddDialog *dia = new TaskAddDialog( getProject(), *node, getProject().accounts(), this ); if ( dia->exec() == QDialog::Accepted) { - Node * currNode = currentTask(); + Node * currNode = currentNode(); if ( currNode ) { QUndoCommand * m = dia->buildCommand(); m->redo(); // do changes to task @@ -1580,9 +1580,9 @@ Task * node = getProject().createTask( currentTask() ); node->estimate() ->clear(); - TaskAddDialog *dia = new TaskAddDialog( *node, getProject().accounts(), this ); + TaskAddDialog *dia = new TaskAddDialog( getProject(), *node, getProject().accounts(), this ); if ( dia->exec() == QDialog::Accepted ) { - Node * currNode = currentTask(); + Node * currNode = currentNode(); if ( currNode ) { QUndoCommand * m = dia->buildCommand(); m->redo(); // do changes to task @@ -1724,7 +1724,7 @@ case Node::Type_Task: { Task *task = dynamic_cast<Task *>( node ); Q_ASSERT( task ); - TaskDialog *dia = new TaskDialog( *task, getProject().accounts(), this ); + TaskDialog *dia = new TaskDialog( getProject(), *task, getProject().accounts(), this ); if ( dia->exec() == QDialog::Accepted) { QUndoCommand * m = dia->buildCommand(); if ( m ) { @@ -1741,7 +1741,7 @@ // and hence, create a milestone Task *task = dynamic_cast<Task *>( node ); Q_ASSERT( task ); - TaskDialog *dia = new TaskDialog( *task, getProject().accounts(), this ); + TaskDialog *dia = new TaskDialog( getProject(), *task, getProject().accounts(), this ); if ( dia->exec() == QDialog::Accepted) { QUndoCommand * m = dia->buildCommand(); if ( m ) { _______________________________________________ koffice-devel mailing list koffice-devel@... https://mail.kde.org/mailman/listinfo/koffice-devel |
|
|
Re: kplato: critical bugs, ok to commit?On Saturday 24. October 2009 14.30.25 ext Dag Andersen wrote:
> Hi, just found 2 bugs in kplato: > * Crash when adding tasks from dependency editor. > * Sometimes it is impossible to add dependencies because readwrite mode is > not properly updated. > > Attatched patch fixes both, ok to commit? Looks good, reviewer=me -- Thomas Zander _______________________________________________ koffice-devel mailing list koffice-devel@... https://mail.kde.org/mailman/listinfo/koffice-devel |
| Free embeddable forum powered by Nabble | Forum Help |