00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <qlayout.h>
00032
00033 #include <opie2/odebug.h>
00034
00035 #include "taskeditoroverview.h"
00036 #include "taskeditorstatus.h"
00037 #include "taskeditoralarms.h"
00038
00039 #include "otaskeditor.h"
00040
00041 using namespace Opie::Ui;
00042 using namespace Opie;
00043
00044 OTaskEditor::OTaskEditor(int cur)
00045 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
00046 init();
00047 init( cur );
00048 }
00049 OTaskEditor::OTaskEditor( const OPimTodo& to)
00050 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
00051 init();
00052 init( to );
00053 }
00054 OTaskEditor::~OTaskEditor() {
00055
00056 }
00057 void OTaskEditor::init( int cur ) {
00058 OPimTodo to;
00059 to.setUid( 1 );
00060 if ( cur != 0 )
00061 to.setCategories( cur );
00062 load(to);
00063 }
00064 void OTaskEditor::init( const OPimTodo& to ) {
00065 load( to );
00066 }
00067 OPimTodo OTaskEditor::todo()const{
00068 OPimTodo to ( m_todo );
00069 m_overView->save( to );
00070 m_stat->save( to );
00071 to.setRecurrence( m_rec->recurrence() );
00072 m_alarm->save( to );
00073
00074 return to;
00075 }
00076 void OTaskEditor::load(const OPimTodo& to) {
00077 m_overView->load( to );
00078 m_stat->load( to );
00079 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
00080 m_alarm->load( to );
00081
00082 m_todo = to;
00083 }
00084 void OTaskEditor::init() {
00085 setCaption(tr("Task Editor") );
00086
00087 QVBoxLayout* layo = new QVBoxLayout( this );
00088 m_tab = new OTabWidget( this );
00089 layo->addWidget( m_tab );
00090
00091
00092
00093
00094 m_overView = new TaskEditorOverView( m_tab );
00095 m_tab->addTab( m_overView, "todo/info", tr("Information") );
00096
00097 m_stat = new TaskEditorStatus( m_tab );
00098 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") );
00099
00100 m_alarm = new TaskEditorAlarms( m_tab );
00101 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") );
00102
00103
00104
00105
00106
00107
00108
00109
00110 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this );
00111 m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
00112
00113
00114
00115 connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
00116 m_rec, SLOT(setEnabled(bool) ) );
00117
00118
00119 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
00120 m_rec, SLOT(setStartDate(const QDate&) ) );
00121
00122
00123 m_tab->setCurrentTab( m_overView );
00124 }