Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

otaskeditor.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
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 ); // generate a new uid
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      * Add the Widgets
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 //    m_remind = new TaskEditorAlarms( m_tab );
00104 //    m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
00105 
00106 //    QLabel* lbl = new QLabel( m_tab );
00107 //    lbl->setText( tr("X-Ref") );
00108 //    m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
00109 
00110     m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this );
00111     m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
00112 
00113 
00114     /* signal and slots */
00115     connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
00116             m_rec, SLOT(setEnabled(bool) ) );
00117 
00118     /* connect due date changed to the recurrence tab */
00119     connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
00120             m_rec, SLOT(setStartDate(const QDate&) ) );
00121 
00122 
00123     m_tab->setCurrentTab( m_overView );
00124 }

Generated on Sat Nov 5 16:15:55 2005 for OPIE by  doxygen 1.4.2