summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-25 22:12:35 (UTC)
committer zecke <zecke>2002-10-25 22:12:35 (UTC)
commitb682e9d2276c10a5c26773c6797ba1ac176ea4cf (patch) (side-by-side diff)
tree9780ad571f14943e3ad6c3ec34a4e787f8a85217
parent595407074ac5724eb33aeb151ce27e38fbca21d5 (diff)
downloadopie-b682e9d2276c10a5c26773c6797ba1ac176ea4cf.zip
opie-b682e9d2276c10a5c26773c6797ba1ac176ea4cf.tar.gz
opie-b682e9d2276c10a5c26773c6797ba1ac176ea4cf.tar.bz2
MainWindow i18n change 'Show only over due' to avoid misunderstanding
then 'share' and 'preload' the taskeditor on first request it'll be created but on destroyed until Destruction the interface. This will happen when the apps quits. This should speed up editing and entering quite a lot
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/otaskeditor.cpp19
-rw-r--r--core/pim/todo/otaskeditor.h7
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp12
-rw-r--r--core/pim/todo/todoeditor.cpp32
-rw-r--r--core/pim/todo/todoeditor.h4
6 files changed, 59 insertions, 17 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 71e6750..9b2423b 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -172,13 +172,13 @@ void MainWindow::initActions() {
m_bar->insertItem( tr("Data") ,m_edit );
m_bar->insertItem( tr("Category"), m_catMenu );
m_bar->insertItem( tr("Options"), m_options );
/* initialize the view menu */
- a = new QAction( QString::null, tr("Show over due"),
+ a = new QAction( QString::null, tr("Show only over due"),
0, this, 0, TRUE );
a->addTo( m_view );
a->setOn( showOverDue() );
connect(a, SIGNAL(toggled(bool)),
this, SLOT(slotShowDue(bool) ) );
m_view->insertSeparator();
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index e8e922f..1a68eb5 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -11,26 +11,33 @@
#include "otaskeditor.h"
OTaskEditor::OTaskEditor(int cur)
: QDialog(0, 0, TRUE ) {
init();
- OTodo to;
- to.setCategories( cur );
- load(to);
- m_uid = 1; // generate a new one
+ init( cur );
}
OTaskEditor::OTaskEditor( const OTodo& to)
: QDialog(0, 0, TRUE ) {
init();
- load( to );
- m_uid = to.uid();
+ init( to );
}
OTaskEditor::~OTaskEditor() {
}
+void OTaskEditor::init( int cur ) {
+ OTodo to;
+ if ( cur != 0 )
+ to.setCategories( cur );
+ load(to);
+ m_uid = 1; // generate a new one
+}
+void OTaskEditor::init( const OTodo& to ) {
+ load( to );
+ m_uid = to.uid();
+}
OTodo OTaskEditor::todo()const{
qWarning("saving!");
OTodo to;
to.setUid(m_uid );
m_overView->save( to );
to.setDescription( m_line->text() );
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h
index 5842fdc..bcbd543 100644
--- a/core/pim/todo/otaskeditor.h
+++ b/core/pim/todo/otaskeditor.h
@@ -15,12 +15,19 @@ class OTaskEditor : public QDialog {
Q_OBJECT
public:
OTaskEditor(int cur);
OTaskEditor( const OTodo& todo );
~OTaskEditor();
+ /*
+ * same as the c'tor but this gives us the
+ * power to 'preload' the dialog
+ */
+ void init( int cur );
+ void init( const OTodo& todo );
+
OTodo todo()const;
private:
void load( const OTodo& );
void init();
OTabWidget *m_tab;
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp
index b9b2ae6..c10ad40 100644
--- a/core/pim/todo/taskeditoroverviewimpl.cpp
+++ b/core/pim/todo/taskeditoroverviewimpl.cpp
@@ -17,12 +17,22 @@ TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* nam
: TaskEditorOverView( parent, name ) {
init();
}
TaskEditorOverViewImpl::~TaskEditorOverViewImpl() {
}
void TaskEditorOverViewImpl::load( const OTodo& todo) {
+ /*
+ * now that we're 'preloaded' we
+ * need to disable the buttons
+ * holding the dat
+ */
+ btnDue-> setEnabled( FALSE );
+ btnComp-> setEnabled( FALSE );
+ btnStart->setEnabled( FALSE );
+
+
QDate date = QDate::currentDate();
QString str = TimeString::longDateString( date );
emit recurranceEnabled( FALSE );
ckbStart->setChecked( FALSE );
btnStart->setText( str );
@@ -66,12 +76,14 @@ void TaskEditorOverViewImpl::save( OTodo& to) {
*/
void TaskEditorOverViewImpl::init() {
QDate curDate = QDate::currentDate();
m_start = m_comp = m_due = curDate;
QString str = TimeString::longDateString( curDate );
+
+
/* Start Date Picker */
m_startPop = new QPopupMenu(this);
m_startBook = new DateBookMonth(m_startPop, 0, TRUE );
m_startPop->insertItem( m_startBook );
connect( m_startBook, SIGNAL( dateClicked(int, int, int) ),
this, SLOT(slotStartChanged(int, int, int) ) );
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index e19ab8d..9b8c5cb 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -3,53 +3,65 @@
#include "todoeditor.h"
using namespace Todo;
Editor::Editor() {
m_accepted = false;
+ m_self = 0l;
}
Editor::~Editor() {
+ delete m_self;
+ m_self = 0;
}
OTodo Editor::newTodo( int cur,
- QWidget* par) {
+ QWidget*) {
- OTaskEditor e( cur);
+ OTaskEditor *e = self();
+ e->setCaption( QObject::tr("Enter Task") );
+ e->init( cur );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
+ e->showMaximized();
#endif
- int ret = e.exec();
+ int ret = e->exec();
if ( QDialog::Accepted == ret ) {
m_accepted = true;
}else
m_accepted = false;
- OTodo ev = e.todo();
+ OTodo ev = e->todo();
qWarning("Todo uid");
qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() );
ev.setUid(1);
return ev;
}
OTodo Editor::edit( QWidget *wid,
const OTodo& todo ) {
- OTaskEditor e( todo );
- e.setCaption( QObject::tr( "Edit Task" ) );
+ OTaskEditor *e = self();
+ e->init( todo );
+ e->setCaption( QObject::tr( "Edit Task" ) );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
+ e->showMaximized();
#endif
- int ret = e.exec();
+ int ret = e->exec();
- OTodo ev = e.todo();
+ OTodo ev = e->todo();
if ( ret == QDialog::Accepted )
m_accepted = true;
else
m_accepted = false;
return ev;
}
bool Editor::accepted()const {
return m_accepted;
}
+OTaskEditor* Editor::self() {
+ if (!m_self )
+ m_self = new OTaskEditor(0);
+
+ return m_self;
+}
diff --git a/core/pim/todo/todoeditor.h b/core/pim/todo/todoeditor.h
index bbfdcb5..fe30634 100644
--- a/core/pim/todo/todoeditor.h
+++ b/core/pim/todo/todoeditor.h
@@ -1,12 +1,13 @@
#ifndef OPIE_TODO_EDITOR_H
#define OPIE_TODO_EDITOR_H
#include <opie/otodo.h>
+class OTaskEditor;
namespace Todo {
class Editor {
public:
Editor();
~Editor();
@@ -14,12 +15,15 @@ namespace Todo {
QWidget* par );
OTodo edit( QWidget* par,
const OTodo& ev = OTodo() );
bool accepted()const;
+ protected:
+ OTaskEditor* self();
private:
bool m_accepted: 1;
+ OTaskEditor* m_self;
};
};
#endif