From e6aaae74f39e3aed4dc3c186c56f92cef8c7da09 Mon Sep 17 00:00:00 2001 From: drw Date: Fri, 27 Dec 2002 15:13:20 +0000 Subject: Clean-up of advanced tab in edit task dialog. Next is QWhatsThis for everything. --- (limited to 'core') diff --git a/core/pim/todo/.cvsignore b/core/pim/todo/.cvsignore index c212d11..77e97da 100644 --- a/core/pim/todo/.cvsignore +++ b/core/pim/todo/.cvsignore @@ -1,6 +1,4 @@ Makefile* moc_* -taskeditoradvanced.cpp -taskeditoradvanced.h todoentry.cpp todoentry.h diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index e6ebf60..bde25ef 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp @@ -6,7 +6,7 @@ #include #include "taskeditoroverview.h" -#include "taskeditoradvancedimpl.h" +#include "taskeditoradvanced.h" #include "taskeditoralarms.h" #include "otaskeditor.h" @@ -40,14 +40,14 @@ OTodo OTaskEditor::todo()const{ OTodo to; to.setUid(m_uid ); m_overView->save( to ); - //m_adv->save( to ); + m_adv->save( to ); to.setRecurrence( m_rec->recurrence() ); return to; } void OTaskEditor::load(const OTodo& to) { m_overView->load( to ); - //m_adv->load( to ); + m_adv->load( to ); m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); } void OTaskEditor::init() { @@ -63,7 +63,7 @@ void OTaskEditor::init() { m_overView = new TaskEditorOverView( m_tab ); m_tab->addTab( m_overView, "TodoList", tr("Overview") ); - m_adv = new TaskEditorAdvancedImpl( m_tab ); + m_adv = new TaskEditorAdvanced( m_tab ); m_tab->addTab( m_adv, "todo/advanced", tr("Advanced") ); m_alarm = new TaskEditorAlarms( m_tab ); diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index d13e157..8232886 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h @@ -7,7 +7,7 @@ #include class TaskEditorOverView; -class TaskEditorAdvancedImpl; +class TaskEditorAdvanced; class TaskEditorAlarms; class ORecurranceWidget; class QMultiLineEdit; @@ -33,7 +33,7 @@ private: OTabWidget *m_tab; TaskEditorOverView *m_overView; - TaskEditorAdvancedImpl *m_adv; + TaskEditorAdvanced *m_adv; TaskEditorAlarms *m_alarm; TaskEditorAlarms *m_remind; ORecurranceWidget *m_rec; diff --git a/core/pim/todo/taskeditoradvanced.cpp b/core/pim/todo/taskeditoradvanced.cpp new file mode 100644 index 0000000..a431d47 --- a/dev/null +++ b/core/pim/todo/taskeditoradvanced.cpp @@ -0,0 +1,132 @@ +/* +               =. This file is part of the OPIE Project +             .=l. Copyright (c) 2002 <> +           .>+-= + _;:,     .>    :=|. This program is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU +..}^=.=       =       ; Library General Public License for more +++=   -.     .`     .: details. + :     =  ...= . :.=- + -.   .:....=;==+<; You should have received a copy of the GNU +  -_. . .   )=.  = General Public License along with +    --        :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include "taskeditoradvanced.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +TaskEditorAdvanced::TaskEditorAdvanced( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + QVBoxLayout *vb = new QVBoxLayout( this ); + + QScrollView *sv = new QScrollView( this ); + vb->addWidget( sv ); + sv->setResizePolicy( QScrollView::AutoOneFit ); + sv->setFrameStyle( QFrame::NoFrame ); + + QWidget *container = new QWidget( sv->viewport() ); + sv->addChild( container ); + + QGridLayout *layout = new QGridLayout( container, 5, 3, 4, 4 ); + + QLabel *label = new QLabel( tr( "State:" ), container ); + layout->addWidget( label, 0, 0 ); + + cmbState = new QComboBox( FALSE, container ); + cmbState->insertItem( tr( "Started" ) ); + cmbState->insertItem( tr( "Postponed" ) ); + cmbState->insertItem( tr( "Finished" ) ); + cmbState->insertItem( tr( "Not started" ) ); + layout->addMultiCellWidget( cmbState, 0, 0, 1, 2 ); + + label = new QLabel( tr( "Maintain Mode:" ), container ); + layout->addWidget( label, 1, 0 ); + + cmbMode = new QComboBox( FALSE, container ); + cmbMode->insertItem( tr( "Nothing" ) ); + cmbMode->insertItem( tr( "Responsible" ) ); + cmbMode->insertItem( tr( "Done By" ) ); + cmbMode->insertItem( tr( "Coordinating" ) ); + layout->addMultiCellWidget( cmbMode, 1, 1, 1, 2 ); + + label = new QLabel( tr( "Maintainer:" ), container ); + layout->addWidget( label, 2, 0 ); + + txtMaintainer = new QLabel( tr( "test" ), container ); + txtMaintainer->setTextFormat( QLabel::RichText ); + layout->addWidget( txtMaintainer, 2, 1 ); + + tbtMaintainer = new QToolButton( container ); + tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); + layout->addWidget( tbtMaintainer, 2, 2 ); + + label = new QLabel( tr( "Description:" ), container ); + layout->addWidget( label, 3, 0 ); + + m_edit = new QMultiLineEdit( this ); + m_edit->setWordWrap( QMultiLineEdit::WidgetWidth ); + layout->addMultiCellWidget( m_edit, 4, 4, 0, 2 ); +} + +TaskEditorAdvanced::~TaskEditorAdvanced() +{ +} + +void TaskEditorAdvanced::load( const OTodo &todo ) +{ + m_edit->setText( todo.description() ); + + /* OPimState */ + int state = todo.state().state(); + + /* defualt to not started */ + if ( state == OPimState::Undefined ) + state = OPimState::NotStarted; + + cmbState->setCurrentItem( state ); + + /* Maintainer Mode */ + state = todo.maintainer().mode(); + if ( state == OPimMaintainer::Undefined ) + state = OPimMaintainer::Nothing; + + cmbMode->setCurrentItem( state ); +} + +void TaskEditorAdvanced::save( OTodo &todo ) +{ + todo.setDescription( m_edit->text() ); + todo.setState( OPimState( cmbState->currentItem() ) ); + + /* Fix me resolve name to uid.....*/ + todo.setMaintainer( OPimMaintainer( cmbMode->currentItem(), -10 ) ); + qWarning("save"); +} diff --git a/core/pim/todo/taskeditoradvanced.h b/core/pim/todo/taskeditoradvanced.h new file mode 100644 index 0000000..65359e9 --- a/dev/null +++ b/core/pim/todo/taskeditoradvanced.h @@ -0,0 +1,73 @@ +/* +               =. This file is part of the OPIE Project +             .=l. Copyright (c) 2002 <> +           .>+-= + _;:,     .>    :=|. This program is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU +..}^=.=       =       ; Library General Public License for more +++=   -.     .`     .: details. + :     =  ...= . :.=- + -.   .:....=;==+<; You should have received a copy of the GNU +  -_. . .   )=.  = General Public License along with +    --        :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef TASKEDITORADVANCED_H +#define TASKEDITORADVANCED_H + +#include + +class OTodo; +class QComboBox; +class QLabel; +class QMultiLineEdit; +class QToolButton; + +/** + * This is the implementation of the Opie Task Editor Advanced tab + * it features the State! + * MaintainerMode + * Description + */ +class TaskEditorAdvanced : public QWidget +{ + Q_OBJECT + +public: + TaskEditorAdvanced( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~TaskEditorAdvanced(); + + /* + * I could have a struct which returns a QWidget* + * load and save to a OTodo + * and use multiple inheretence with all other widgets + * and then simply iterate over the list of structs + * this way I could easily have plugins for the whole editor.... + * but I do not do it -zecke + */ + void load( const OTodo& ); + void save( OTodo& ); + + QComboBox *cmbState; + QLabel *txtMaintainer; + QToolButton *tbtMaintainer; + QComboBox *cmbMode; + QMultiLineEdit *m_edit; + +}; + +#endif // TASKEDITORADVANCED_H diff --git a/core/pim/todo/taskeditoradvanced.ui b/core/pim/todo/taskeditoradvanced.ui deleted file mode 100644 index 3aac216..0000000 --- a/core/pim/todo/taskeditoradvanced.ui +++ b/dev/null @@ -1,224 +0,0 @@ - -TaskEditorAdvanced - - QWidget - - name - TaskEditorAdvanced - - - geometry - - 0 - 0 - 232 - 307 - - - - layoutMargin - - - layoutSpacing - - - - margin - 8 - - - spacing - 6 - - - QLayoutWidget - - name - Layout13 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - lblState - - - text - State: - - - - QComboBox - - - text - Started - - - - - text - Postponed - - - - - text - Finished - - - - - text - Not started - - - - name - cmbState - - - - - - QLayoutWidget - - name - Layout17 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - lblMaintainer - - - text - Maintainer - - - - QLabel - - name - txtMaintainer - - - text - test - - - textFormat - RichText - - - - QLayoutWidget - - name - Layout16 - - - - margin - 0 - - - spacing - 6 - - - QToolButton - - name - tbtMaintainer - - - text - ... - - - - - - - - QLayoutWidget - - name - Layout4 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - txtMode - - - text - Maintain Mode: - - - - QComboBox - - - text - Nothing - - - - - text - Responsible - - - - - text - Done By - - - - - text - Coordinating - - - - name - cmbMode - - - - - - - diff --git a/core/pim/todo/taskeditoradvancedimpl.cpp b/core/pim/todo/taskeditoradvancedimpl.cpp deleted file mode 100644 index 89f672c..0000000 --- a/core/pim/todo/taskeditoradvancedimpl.cpp +++ b/dev/null @@ -1,63 +0,0 @@ -#include -#include -#include -#include - - -#include -#include -#include - -#include "taskeditoradvancedimpl.h" - - -TaskEditorAdvancedImpl::TaskEditorAdvancedImpl( QWidget* parent, const char* name ) - : TaskEditorAdvanced( parent, name ) { - initUI(); -} -TaskEditorAdvancedImpl::~TaskEditorAdvancedImpl() { -} -void TaskEditorAdvancedImpl::load( const OTodo& todo) { - m_edit->setText( todo.description() ); - - /* OPimState */ - int state = todo.state().state(); - - /* defualt to not started */ - if ( state == OPimState::Undefined ) - state = OPimState::NotStarted; - - cmbState->setCurrentItem( state ); - - /* Maintainer Mode */ - state = todo.maintainer().mode(); - if ( state == OPimMaintainer::Undefined ) - state = OPimMaintainer::Nothing; - - cmbMode->setCurrentItem( state ); - -} -void TaskEditorAdvancedImpl::save( OTodo& todo) { - todo.setDescription( m_edit->text() ); - todo.setState( OPimState( cmbState->currentItem() ) ); - - /* Fix me resolve name to uid.....*/ - todo.setMaintainer( OPimMaintainer( cmbMode->currentItem(), -10 ) ); - qWarning("save"); -} -/* - * int the damn UI - */ -void TaskEditorAdvancedImpl::initUI() { - /* a MultiLineEdit */ - m_edit = new QMultiLineEdit( this ); - m_edit->setWordWrap( QMultiLineEdit::WidgetWidth ); - - /* a Label */ - QLabel* lbl = new QLabel(this ); - lbl->setText( tr("Description") ); - - /* add it to the QGridLayout of our base class */ - static_cast(layout() )->addWidget( lbl , 3, 0 ); - static_cast(layout() )->addWidget( m_edit, 4, 0 ); -} diff --git a/core/pim/todo/taskeditoradvancedimpl.h b/core/pim/todo/taskeditoradvancedimpl.h deleted file mode 100644 index 215d8cb..0000000 --- a/core/pim/todo/taskeditoradvancedimpl.h +++ b/dev/null @@ -1,37 +0,0 @@ -#ifndef OPIE_TASK_EDITOR_ADVANCED_IMPL_H -#define OPIE_TASK_EDITOR_ADVANCED_IMPL_H - -#include "taskeditoradvanced.h" - -/** - * This is the implementation of the Opie Task Editor Advanced tab - * it features the State! - * MaintainerMode - * Description - */ -class QMultiLineEdit; -class OTodo; -class TaskEditorAdvancedImpl : public TaskEditorAdvanced { - Q_OBJECT -public: - TaskEditorAdvancedImpl( QWidget* parent = 0, const char* name = 0 ); - ~TaskEditorAdvancedImpl(); - - /* - * I could have a struct which returns a QWidget* - * load and save to a OTodo - * and use multiple inheretence with all other widgets - * and then simply iterate over the list of structs - * this way I could easily have plugins for the whole editor.... - * but I do not do it -zecke - */ - void load( const OTodo& ); - void save( OTodo& ); - -private: - void initUI(); - QMultiLineEdit* m_edit; -}; - - -#endif diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp index 9aab76a..6906c26 100644 --- a/core/pim/todo/taskeditoroverview.cpp +++ b/core/pim/todo/taskeditoroverview.cpp @@ -40,8 +40,6 @@ #include #include #include -#include -#include #include TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) @@ -61,7 +59,6 @@ TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFla m_start = m_comp = m_due = curDate; QString curDateStr = TimeString::longDateString( curDate ); - // TODO - add QScrollView for contents QVBoxLayout *vb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 9960c65..697c005 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro @@ -18,7 +18,7 @@ HEADERS = smalltodo.h \ quickeditimpl.h \ otaskeditor.h \ taskeditoroverview.h \ - taskeditoradvancedimpl.h \ + taskeditoradvanced.h \ taskeditoralarms.h SOURCES = smalltodo.cpp \ @@ -38,10 +38,9 @@ SOURCES = smalltodo.cpp \ quickedit.cpp \ otaskeditor.cpp \ taskeditoroverview.cpp \ - taskeditoradvancedimpl.cpp \ + taskeditoradvanced.cpp \ taskeditoralarms.cpp -INTERFACES = taskeditoradvanced.ui TARGET = todolist INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -- cgit v0.9.0.2