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

taskeditoroverview.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 "taskeditoroverview.h"
00032 
00033 //#include <opie2/opimrecurrence.h>
00034 
00035 #include <opie2/oresource.h>
00036 
00037 #include <qpe/categoryselect.h>
00038 #include <qpe/datebookmonth.h>
00039 
00040 #include <qcheckbox.h>
00041 #include <qlabel.h>
00042 #include <qlayout.h>
00043 #include <qmultilineedit.h>
00044 #include <qwhatsthis.h>
00045 
00046 TaskEditorOverView::TaskEditorOverView( QWidget* parent,  const char* name, WFlags fl )
00047     : QWidget( parent, name, fl )
00048 {
00049     // Load icons
00050     // TODO - probably should be done globally somewhere else,
00051     //        see also quickeditimpl.cpp/h, tableview.cpp/h
00052     QString namestr;
00053     for ( unsigned int i = 1; i < 6; i++ ) {
00054         namestr = "todo/priority";
00055         namestr.append( QString::number( i ) );
00056         m_pic_priority[ i - 1 ] = Opie::Core::OResource::loadPixmap( namestr );
00057     }
00058 
00059     QVBoxLayout *vb = new QVBoxLayout( this );
00060 
00061     QScrollView *sv = new QScrollView( this );
00062     vb->addWidget( sv );
00063     sv->setResizePolicy( QScrollView::AutoOneFit );
00064     sv->setFrameStyle( QFrame::NoFrame );
00065 
00066     QWidget *container = new QWidget( sv->viewport() );
00067     sv->addChild( container );
00068 
00069     QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 );
00070 
00071     // Description
00072     QLabel *label = new QLabel( tr( "Summary:" ), container );
00073     layout->addWidget( label, 0, 0 );
00074     QWhatsThis::add( label, tr( "Enter brief description of the task here." ) );
00075     cmbDesc = new QComboBox( TRUE, container );
00076     cmbDesc->insertItem( tr( "Complete " ) );
00077     cmbDesc->insertItem( tr( "Work on " ) );
00078     cmbDesc->insertItem( tr( "Buy " ) );
00079     cmbDesc->insertItem( tr( "Organize " ) );
00080     cmbDesc->insertItem( tr( "Get " ) );
00081     cmbDesc->insertItem( tr( "Update " ) );
00082     cmbDesc->insertItem( tr( "Create " ) );
00083     cmbDesc->insertItem( tr( "Plan " ) );
00084     cmbDesc->insertItem( tr( "Call " ) );
00085     cmbDesc->insertItem( tr( "Mail " ) );
00086     cmbDesc->clearEdit();
00087     layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 );
00088     QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) );
00089 
00090     // Priority
00091     label = new QLabel( QWidget::tr( "Priority:" ), container );
00092     layout->addWidget( label, 2, 0 );
00093     QWhatsThis::add( label, tr( "Select priority of task here." ) );
00094     cmbPriority = new QComboBox( FALSE, container );
00095     cmbPriority->setMinimumHeight( 26 );
00096     cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) );
00097     cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) );
00098     cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) );
00099     cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) );
00100     cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) );
00101     cmbPriority->setCurrentItem( 2 );
00102     layout->addWidget( cmbPriority, 2, 1 );
00103     QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) );
00104 
00105     // Category
00106     label = new QLabel( tr( "Category:" ), container );
00107     layout->addWidget( label, 3, 0 );
00108     QWhatsThis::add( label, tr( "Select category to organize this task with." ) );
00109     cmbCategory = new CategorySelect( container );
00110     layout->addWidget( cmbCategory, 3, 1 );
00111     QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) );
00112 
00113     // Recurrence
00114     ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container );
00115     layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 );
00116     QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis.  If selected, frequency can be set on the Recurrence tab." ) );
00117     connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) );
00118 
00119     // Notes
00120     label = new QLabel( tr( "Description:" ), container );
00121     layout->addWidget( label, 5, 0 );
00122     QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) );
00123     mleNotes = new QMultiLineEdit( container );
00124     mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth );
00125     layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 );
00126     QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) );
00127 }
00128 
00129 TaskEditorOverView::~TaskEditorOverView()
00130 {
00131 }
00132 
00133 void TaskEditorOverView::load( const OPimTodo& todo )
00134 {
00135     // Description
00136     cmbDesc->insertItem( todo.summary(), 0 );
00137     cmbDesc->setCurrentItem( 0 );
00138 
00139     // Priority
00140     cmbPriority->setCurrentItem( todo.priority() - 1 );
00141 
00142     // Category
00143     cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) );
00144 
00145     // Recurrence
00146     ckbRecurrence->setChecked( todo.hasRecurrence() );
00147     emit recurranceEnabled( todo.hasRecurrence() );
00148 
00149     // Notes
00150     mleNotes->setText( todo.description() );
00151 
00152 }
00153 
00154 void TaskEditorOverView::save( OPimTodo &todo )
00155 {
00156     // Description
00157     todo.setSummary( cmbDesc->currentText() );
00158 
00159     // Priority
00160     todo.setPriority( cmbPriority->currentItem() + 1 );
00161 
00162     // Category
00163     if ( cmbCategory->currentCategory() != -1 )
00164     {
00165         QArray<int> arr = cmbCategory->currentCategories();
00166         todo.setCategories( arr );
00167     }
00168 
00169     // Recurrence - don't need to save here...
00170 
00171     // Notes
00172     todo.setDescription( mleNotes->text() );
00173 }
00174 
00175 void TaskEditorOverView::slotRecClicked()
00176 {
00177     emit recurranceEnabled( ckbRecurrence->isChecked() );
00178 }

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