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 <opie2/odebug.h> 00032 00033 #include <qpe/qpeapplication.h> 00034 00035 #include "otaskeditor.h" 00036 #include "todoeditor.h" 00037 00038 using namespace Opie; 00039 using namespace Todo; 00040 00041 Editor::Editor() { 00042 m_accepted = false; 00043 m_self = 0l; 00044 } 00045 Editor::~Editor() { 00046 delete m_self; 00047 m_self = 0; 00048 } 00049 OPimTodo Editor::newTodo( int cur, 00050 QWidget*) { 00051 00052 OTaskEditor *e = self(); 00053 e->setCaption( QObject::tr("Enter Task") ); 00054 e->init( cur ); 00055 00056 int ret = QPEApplication::execDialog( e ); 00057 00058 if ( QDialog::Accepted == ret ) { 00059 m_accepted = true; 00060 }else 00061 m_accepted = false; 00062 00063 OPimTodo ev = e->todo(); 00064 ev.setUid(1); 00065 00066 return ev; 00067 } 00068 OPimTodo Editor::edit( QWidget *, 00069 const OPimTodo& todo ) { 00070 OTaskEditor *e = self(); 00071 e->init( todo ); 00072 e->setCaption( QObject::tr( "Edit Task" ) ); 00073 00074 int ret = QPEApplication::execDialog( e ); 00075 00076 OPimTodo ev = e->todo(); 00077 if ( ret == QDialog::Accepted ) 00078 m_accepted = true; 00079 else 00080 m_accepted = false; 00081 00082 return ev; 00083 } 00084 bool Editor::accepted()const { 00085 return m_accepted; 00086 } 00087 OTaskEditor* Editor::self() { 00088 if (!m_self ) 00089 m_self = new OTaskEditor(0); 00090 00091 return m_self; 00092 }
1.4.2