-rw-r--r-- | core/pim/todo/mainwindow.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 83 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 37 | ||||
-rw-r--r-- | core/pim/todo/taskeditoradvanced.ui | 222 | ||||
-rw-r--r-- | core/pim/todo/taskeditoralarms.ui | 148 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverview.ui | 542 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 169 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.h | 54 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 12 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 12 | ||||
-rw-r--r-- | core/pim/todo/todoentry.ui | 481 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 189 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.h | 65 |
13 files changed, 1271 insertions, 746 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 8377573..bf9fc23 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -428,4 +428,5 @@ void MainWindow::slotNew() { //todo.assignUid(); - currentView()->addEvent( todo ); m_todoMgr.add( todo ); + currentView()->addEvent( todo ); + diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp new file mode 100644 index 0000000..e8e922f --- a/dev/null +++ b/core/pim/todo/otaskeditor.cpp @@ -0,0 +1,83 @@ +#include <qdatetime.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qmultilineedit.h> + +#include <opie/orecurrancewidget.h> + +#include "taskeditoroverviewimpl.h" +#include "taskeditoradvanced.h" +#include "taskeditoralarms.h" + +#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 +} +OTaskEditor::OTaskEditor( const OTodo& to) + : QDialog(0, 0, TRUE ) { + init(); + load( to ); + m_uid = to.uid(); +} +OTaskEditor::~OTaskEditor() { + +} +OTodo OTaskEditor::todo()const{ + qWarning("saving!"); + OTodo to; + to.setUid(m_uid ); + m_overView->save( to ); + to.setDescription( m_line->text() ); + + return to; +} +void OTaskEditor::load(const OTodo& to) { + m_overView->load( to ); + m_line->setText( to.description() ); +} +void OTaskEditor::init() { + QVBoxLayout* lay = new QVBoxLayout(this); + setCaption("Task Editor"); + m_tab = new OTabWidget(this); + + /* + * Add the Widgets + */ + m_overView = new TaskEditorOverViewImpl(m_tab ); + m_tab->addTab( m_overView, QString::null, tr("Overview") ); + + m_adv = new TaskEditorAdvanced( m_tab ); + m_line = new QMultiLineEdit(m_adv ); + QLabel* label = new QLabel(m_adv ); + label->setText( tr("Description") ); + ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 ); + ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 ); + m_tab->addTab( m_adv, QString::null, tr("Advanced") ); + + m_alarm = new TaskEditorAlarms( m_tab ); + m_tab->addTab( m_alarm, QString::null, tr("Alarms") ); + + m_remind = new TaskEditorAlarms( m_tab ); + m_tab->addTab( m_remind, QString::null, tr("Reminders") ); + + QLabel* lbl = new QLabel(m_tab ); + lbl->setText( tr("X-Ref") ); + m_tab->addTab( lbl, QString::null, tr("X-Ref") ); + + m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); + m_tab->addTab( m_rec, QString::null, tr("Recurrance") ); + + lay->addWidget(m_tab ); + + /* signal and slots */ + connect(m_overView, SIGNAL(recurranceEnabled(bool) ), + m_rec, SLOT(setEnabled(bool) ) ); + + m_tab->setCurrentTab( m_overView ); +} diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h new file mode 100644 index 0000000..5842fdc --- a/dev/null +++ b/core/pim/todo/otaskeditor.h @@ -0,0 +1,37 @@ +#ifndef OPIE_TASK_EDITOR_H +#define OPIE_TASK_EDITOR_H + +#include <qdialog.h> + +#include <opie/otodo.h> +#include <opie/otabwidget.h> + +class TaskEditorOverViewImpl; +class TaskEditorAdvanced; +class TaskEditorAlarms; +class ORecurranceWidget; +class QMultiLineEdit; +class OTaskEditor : public QDialog { + Q_OBJECT +public: + OTaskEditor(int cur); + OTaskEditor( const OTodo& todo ); + ~OTaskEditor(); + + OTodo todo()const; +private: + void load( const OTodo& ); + void init(); + + OTabWidget *m_tab; + TaskEditorOverViewImpl* m_overView; + TaskEditorAdvanced *m_adv; + TaskEditorAlarms *m_alarm; + TaskEditorAlarms* m_remind; + ORecurranceWidget* m_rec; + QMultiLineEdit* m_line; + int m_uid; + +}; + +#endif diff --git a/core/pim/todo/taskeditoradvanced.ui b/core/pim/todo/taskeditoradvanced.ui new file mode 100644 index 0000000..3ea1346 --- a/dev/null +++ b/core/pim/todo/taskeditoradvanced.ui @@ -0,0 +1,222 @@ +<!DOCTYPE UI><UI> +<class>TaskEditorAdvanced</class> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>TaskEditorAdvanced</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>236</width> + <height>307</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form2</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>8</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout13</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>lblState</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>State:</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Started</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Postponed</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Finished</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Not started</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>cmbState</cstring> + </property> + </widget> + </hbox> + </widget> + <widget row="2" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout17</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>lblMaintainer</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Maintainer</string> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtMaintainer</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>test</string> + </property> + <property stdset="1"> + <name>textFormat</name> + <enum>RichText</enum> + </property> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout16</cstring> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QToolButton</class> + <property stdset="1"> + <name>name</name> + <cstring>tbtMaintainer</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>...</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget row="1" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout4</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtMode</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Maintain Mode:</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Responsible</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Done By</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Coordinating</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>cmbMode</cstring> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +</UI> diff --git a/core/pim/todo/taskeditoralarms.ui b/core/pim/todo/taskeditoralarms.ui new file mode 100644 index 0000000..ab21796 --- a/dev/null +++ b/core/pim/todo/taskeditoralarms.ui @@ -0,0 +1,148 @@ +<!DOCTYPE UI><UI> +<class>TaskEditorAlarms</class> +<author>zecke</author> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>TaskEditorAlarms</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>195</width> + <height>271</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form3</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>8</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout19</cstring> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtAlarm</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>empty</string> + </property> + </widget> + <widget> + <class>QListView</class> + <property stdset="1"> + <name>name</name> + <cstring>lstAlarms</cstring> + </property> + </widget> + </vbox> + </widget> + <widget row="1" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout23</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>alAdd</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>&Add</string> + </property> + <property stdset="1"> + <name>autoResize</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>alEdit</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>&Edit</string> + </property> + <property stdset="1"> + <name>autoResize</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>alRemove</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Remove</string> + </property> + <property stdset="1"> + <name>autoResize</name> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +</UI> diff --git a/core/pim/todo/taskeditoroverview.ui b/core/pim/todo/taskeditoroverview.ui new file mode 100644 index 0000000..a6bf645 --- a/dev/null +++ b/core/pim/todo/taskeditoroverview.ui @@ -0,0 +1,542 @@ +<!DOCTYPE UI><UI> +<class>TaskEditorOverView</class> +<author>zecke</author> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>TaskEditorOverView</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>308</width> + <height>445</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form1</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>4</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="5" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout11</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtPrio</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Priority</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>1 - Very High</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>2 - High</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>3 - Normal</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>4 - Low</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>5 - Very Low</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>cmbPrio</cstring> + </property> + </widget> + </hbox> + </widget> + <widget row="4" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout11</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtProgress</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Progress</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>0 %</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>20 %</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>40 %</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>60 %</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>80 %</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>100 %</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>cmbProgress</cstring> + </property> + </widget> + </hbox> + </widget> + <widget row="2" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout9</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>ckbDue</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Due Date:</string> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>btnDue</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>1 Januar 2002</string> + </property> + </widget> + </hbox> + </widget> + <widget row="1" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout8</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>ckbStart</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Start Date:</string> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>btnStart</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>1 Januar 2001</string> + </property> + </widget> + </hbox> + </widget> + <widget row="0" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout7</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>lblSum</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Summary</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Complete</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>work on</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>buy</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>organize</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>get</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Update</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Create</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Plan</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Call</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Mail</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>cmbSum</cstring> + </property> + <property stdset="1"> + <name>editable</name> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget row="3" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout10</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>ckbComp</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>Completed Date</string> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>btnComp</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>1 Januar 2002</string> + </property> + </widget> + </hbox> + </widget> + <widget row="6" column="0" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>ckbCompleted</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Completed</string> + </property> + </widget> + <widget row="7" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout12</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtCategory</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Category</string> + </property> + </widget> + <widget> + <class>CategorySelect</class> + <property stdset="1"> + <name>name</name> + <cstring>comboCategory</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </widget> + </hbox> + </widget> + <widget row="8" column="0" rowspan="1" colspan="2" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>CheckBox7</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Enable Recurrance</string> + </property> + </widget> + <spacer row="9" column="1" > + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>CategorySelect</class> + <header location="global">qpe/categoryselect.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>7</hordata> + <verdata>1</verdata> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image> + <name>image0</name> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> +<connections> + <connection> + <sender>ckbStart</sender> + <signal>clicked()</signal> + <receiver>TaskEditorOverView</receiver> + <slot>slotStartChecked()</slot> + </connection> + <connection> + <sender>ckbDue</sender> + <signal>clicked()</signal> + <receiver>TaskEditorOverView</receiver> + <slot>slotDueChecked()</slot> + </connection> + <connection> + <sender>ckbComp</sender> + <signal>clicked()</signal> + <receiver>TaskEditorOverView</receiver> + <slot>slotCompletedChecked()</slot> + </connection> + <slot access="protected">slotCompletedChecked()</slot> + <slot access="protected">slotDueChecked()</slot> + <slot access="protected">slotStartChecked()</slot> +</connections> +</UI> diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp new file mode 100644 index 0000000..b9b2ae6 --- a/dev/null +++ b/core/pim/todo/taskeditoroverviewimpl.cpp @@ -0,0 +1,169 @@ +#include <qapplication.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qpopupmenu.h> + +#include <qpe/datebookmonth.h> +#include <qpe/categoryselect.h> +#include <qpe/timestring.h> + +#include "taskeditoroverviewimpl.h" + +/* + * we need to hack + */ + +TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) + : TaskEditorOverView( parent, name ) { + init(); +} +TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { +} +void TaskEditorOverViewImpl::load( const OTodo& todo) { + QDate date = QDate::currentDate(); + QString str = TimeString::longDateString( date ); + + emit recurranceEnabled( FALSE ); + ckbStart->setChecked( FALSE ); + btnStart->setText( str ); + + ckbComp->setChecked( FALSE ); + btnComp->setText( str ); + + cmbProgress->setCurrentItem( todo.progress()/20 ); + cmbSum->insertItem( todo.summary(), 0 ); + cmbSum->setCurrentItem( 0 ); + + ckbDue->setChecked( todo.hasDueDate() ); + btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); + + cmbPrio->setCurrentItem( todo.priority() -1 ); + ckbCompleted->setChecked( todo.isCompleted() ); + + comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); + +} +void TaskEditorOverViewImpl::save( OTodo& to) { + qWarning("save it now"); + if ( ckbDue->isChecked() ) { + to.setDueDate( m_due ); + to.setHasDueDate( true ); + }else + to.setHasDueDate( false ); + if ( comboCategory->currentCategory() != -1 ) { + QArray<int> arr = comboCategory->currentCategories(); + to.setCategories( arr ); + } + to.setPriority( cmbPrio->currentItem() + 1 ); + to.setCompleted( ckbCompleted->isChecked() ); + to.setSummary( cmbSum->currentText() ); + to.setProgress( cmbProgress->currentItem() * 20 ); +} +/* + * here we will init the basic view + * one Popup for each Date Button + * and some other signal and slots connection + */ +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) ) ); + + + /* Due Date Picker */ + m_duePop = new QPopupMenu(this); + m_dueBook = new DateBookMonth(m_duePop, 0, TRUE ); + m_duePop->insertItem( m_dueBook ); + connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ), + this, SLOT(slotDueChanged(int, int, int) ) ); + + m_compPop = new QPopupMenu(this); + m_compBook = new DateBookMonth(m_compPop, 0, TRUE ); + m_compPop->insertItem(m_compBook ); + connect( m_compBook, SIGNAL(dateClicked(int, int, int) ), + this, SLOT(slotCompletedChanged(int, int, int) ) ); + + + /* + * another part of the hack + * it's deprecated in Qt2 but + * still available in my qt-copy of Qt3.1beta2 + */ + btnDue->setIsMenuButton( TRUE ); + btnStart->setIsMenuButton( TRUE ); + btnComp->setIsMenuButton( TRUE ); + + /* now connect the hack */ + connect(btnDue, SIGNAL(clicked() ), + this, SLOT(hackySlotHack2() ) ); + connect(btnStart, SIGNAL(clicked() ), + this, SLOT(hackySlotHack1() ) ); + connect(btnComp, SIGNAL(clicked() ), + this, SLOT(hackySlotHack3() ) ); + + /* recurrance */ + connect(CheckBox7, SIGNAL(clicked() ), + this, SLOT(slotRecClicked() ) ); +} + +void TaskEditorOverViewImpl::slotStartChecked() { + qWarning("slotStartChecked"); + btnStart->setEnabled( ckbStart->isChecked() ); +} +void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { + m_start.setYMD( y, m, d ); + btnStart->setText( TimeString::longDateString( m_start ) ); +} +void TaskEditorOverViewImpl::slotDueChecked() { + btnDue->setEnabled( ckbDue->isChecked() ); + qWarning("slotDueChecked"); +} +void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { + m_due.setYMD(y, m, d ); + btnDue->setText( TimeString::longDateString( m_due ) ); +} +void TaskEditorOverViewImpl::slotCompletedChecked() { + btnComp->setEnabled( ckbComp->isChecked() ); + qWarning("slotCompletedChecked"); +} +void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { + m_comp.setYMD( y, m, d ); + btnComp->setText( TimeString::longDateString( m_comp ) ); +} +/* + * called by a button pressed event... + * three slots to avoid ugly name() tests + * to sender() + */ +void TaskEditorOverViewImpl::hackySlotHack1() { + btnStart->setDown( FALSE ); + popup( btnStart, m_startPop ); +} +void TaskEditorOverViewImpl::hackySlotHack2() { + btnDue->setDown( FALSE ); + popup( btnDue, m_duePop ); +} +void TaskEditorOverViewImpl::hackySlotHack3() { + btnComp->setDown( FALSE ); + popup( btnComp, m_compPop ); +} +void TaskEditorOverViewImpl::slotRecClicked() { + qWarning("enabled recurrance"); + emit recurranceEnabled( CheckBox7->isChecked() ); +} +/* + * GPL from TT QPushButton code + */ +void TaskEditorOverViewImpl::popup( QPushButton* pu, QPopupMenu* pop) { + if ( pu->mapToGlobal( QPoint(0, pu->rect().bottom() ) ).y() + pop->sizeHint().height() <= qApp->desktop()->height() ) + pop->exec( pu->mapToGlobal( pu->rect().bottomLeft() ) ); + else + pop->exec( pu->mapToGlobal( pu->rect().topLeft() - QPoint(0, pu->sizeHint().height() ) ) ); +} diff --git a/core/pim/todo/taskeditoroverviewimpl.h b/core/pim/todo/taskeditoroverviewimpl.h new file mode 100644 index 0000000..4fab381 --- a/dev/null +++ b/core/pim/todo/taskeditoroverviewimpl.h @@ -0,0 +1,54 @@ +#ifndef OPIE_TASK_EDITOR_VIEW_IMPL_H +#define OPIE_TASK_EDITOR_VIEW_IMPL_H + +#include <qsize.h> + +#include <opie/otodo.h> + +#include "taskeditoroverview.h" + +class DateBookMonth; +class QPushButton; +class QPopupMenu; +class TaskEditorOverViewImpl : public TaskEditorOverView { + Q_OBJECT +public: + TaskEditorOverViewImpl(QWidget* parent, const char* name = 0); + ~TaskEditorOverViewImpl(); + + void load( const OTodo& ); + void save( OTodo& ); +signals: + void recurranceEnabled( bool ); + +private: + void init(); + void popup(QPushButton*, QPopupMenu*); + DateBookMonth* m_dueBook; + DateBookMonth* m_startBook; + DateBookMonth* m_compBook; + QDate m_start; + QDate m_comp; + QDate m_due; + QPopupMenu* m_startPop; + QPopupMenu* m_compPop; + QPopupMenu* m_duePop; + bool m_bDue : 1; + +private slots: + void slotStartChecked(); + void slotStartChanged(int, int, int ); + void slotDueChecked(); + void slotDueChanged(int, int, int ); + void slotCompletedChecked(); + void slotCompletedChanged(int, int, int ); + + void hackySlotHack1(); + void hackySlotHack2(); + void hackySlotHack3(); + + void slotRecClicked(); +}; + + +#endif diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index d432e78..8f21416 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro @@ -8,3 +8,2 @@ HEADERS = smalltodo.h \ todoview.h \ - todoentryimpl.h \ tableview.h \ @@ -19,3 +18,5 @@ HEADERS = smalltodo.h \ quickedit.h \ - quickeditimpl.h + quickeditimpl.h \ + otaskeditor.h \ + taskeditoroverviewimpl.h @@ -25,3 +26,2 @@ SOURCES = smalltodo.cpp \ main.cpp \ - todoentryimpl.cpp \ tableview.cpp \ @@ -37,5 +37,7 @@ SOURCES = smalltodo.cpp \ quickeditimpl.cpp \ - quickedit.cpp + quickedit.cpp \ + otaskeditor.cpp \ + taskeditoroverviewimpl.cpp -INTERFACES = todoentry.ui +INTERFACES = taskeditoradvanced.ui taskeditoralarms.ui taskeditoroverview.ui TARGET = todolist diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index c9ade20..e19ab8d 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp @@ -1,3 +1,3 @@ -#include "todoentryimpl.h" +#include "otaskeditor.h" #include "todoeditor.h" @@ -14,3 +14,3 @@ OTodo Editor::newTodo( int cur, - NewTaskDialog e( cur, par, 0, TRUE ); + OTaskEditor e( cur); @@ -27,3 +27,5 @@ OTodo Editor::newTodo( int cur, - OTodo ev = e.todoEntry(); + OTodo ev = e.todo(); + qWarning("Todo uid"); + qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); ev.setUid(1); @@ -34,3 +36,3 @@ OTodo Editor::edit( QWidget *wid, const OTodo& todo ) { - NewTaskDialog e( todo, wid, 0, TRUE ); + OTaskEditor e( todo ); e.setCaption( QObject::tr( "Edit Task" ) ); @@ -42,3 +44,3 @@ OTodo Editor::edit( QWidget *wid, - OTodo ev = e.todoEntry(); + OTodo ev = e.todo(); if ( ret == QDialog::Accepted ) diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui deleted file mode 100644 index 60547f2..0000000 --- a/core/pim/todo/todoentry.ui +++ b/dev/null @@ -1,481 +0,0 @@ -<!DOCTYPE UI><UI> -<class>NewTaskDialogBase</class> -<comment>********************************************************************* -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -*********************************************************************</comment> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>NewTaskDialogBase</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>239</width> - <height>320</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>New Task</string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>4</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout19</cstring> - </property> - <property> - <name>layoutSpacing</name> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget row="3" column="1" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout6</cstring> - </property> - <property> - <name>layoutSpacing</name> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget> - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>0%</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>20%</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>40%</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>60%</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>80%</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>100%</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>cmbProg</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>maximumSize</name> - <size> - <width>32767</width> - <height>32767</height> - </size> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>checkCompleted</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Completed</string> - </property> - </widget> - </hbox> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Priority:</string> - </property> - </widget> - <widget row="4" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>buttonDate</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>1 Jan 2001</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>txtProg</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>MShape</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>MShadow</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>Progress:</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>selectGroupButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Select</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>txtProg_2</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>MShape</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>MShadow</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>Group:</string> - </property> - </widget> - <widget row="4" column="0" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>checkDate</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>D&ue</string> - </property> - </widget> - <widget row="1" column="1" > - <class>CategorySelect</class> - <property stdset="1"> - <name>name</name> - <cstring>comboCategory</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>minimumSize</name> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - </widget> - <widget row="0" column="1" > - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>1 - Very High</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>2 - High</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>3 - Normal</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>4 - Low</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>5 - Very Low</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>comboPriority</cstring> - </property> - <property stdset="1"> - <name>currentItem</name> - <number>2</number> - </property> - </widget> - <widget row="5" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Summary:</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>NoFrame</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>Category:</string> - </property> - </widget> - <widget row="5" column="1" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout8</cstring> - </property> - <property> - <name>layoutSpacing</name> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>lneSum</cstring> - </property> - </widget> - <widget> - <class>OClickableLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>lblDown</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>minimumSize</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property stdset="1"> - <name>maximumSize</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </widget> - </hbox> - </widget> - </grid> - </widget> - <widget> - <class>QMultiLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtTodo</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>7</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>wordWrap</name> - <enum>WidgetWidth</enum> - </property> - </widget> - </vbox> -</widget> -<customwidgets> - <customwidget> - <class>CategorySelect</class> - <header location="global">qpe/categoryselect.h</header> - <sizehint> - <width>-1</width> - <height>-1</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>7</hordata> - <verdata>1</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - </customwidget> - <customwidget> - <class>OClickableLabel</class> - <header location="global">opie/oclickablelabel.h</header> - <sizehint> - <width>-1</width> - <height>-1</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>5</hordata> - <verdata>5</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - <signal>clicked()</signal> - <signal>toggled(bool)</signal> - <slot access="public">slotOn(bool)</slot> - </customwidget> -</customwidgets> -<images> - <image> - <name>image0</name> - <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> - </image> -</images> -<connections> - <connection> - <sender>checkDate</sender> - <signal>toggled(bool)</signal> - <receiver>buttonDate</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>lblDown</sender> - <signal>clicked()</signal> - <receiver>NewTaskDialogBase</receiver> - <slot>slotCopy()</slot> - </connection> - <slot access="protected">dateChanged( const QString & )</slot> - <slot access="protected">dateChanged( int, int, int )</slot> - <slot access="protected">slotCopy()</slot> -</connections> -<tabstops> - <tabstop>comboPriority</tabstop> - <tabstop>comboCategory</tabstop> - <tabstop>selectGroupButton</tabstop> - <tabstop>cmbProg</tabstop> - <tabstop>checkCompleted</tabstop> - <tabstop>checkDate</tabstop> - <tabstop>buttonDate</tabstop> - <tabstop>lneSum</tabstop> - <tabstop>lblDown</tabstop> - <tabstop>txtTodo</tabstop> -</tabstops> -</UI> diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp deleted file mode 100644 index 4211ae2..0000000 --- a/core/pim/todo/todoentryimpl.cpp +++ b/dev/null @@ -1,189 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** Copyright (C) 2002 zecke -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#include "todoentryimpl.h" - -#include <opie/oclickablelabel.h> -#include <opie/otodo.h> - -#include <qpe/categoryselect.h> -#include <qpe/datebookmonth.h> -#include <qpe/global.h> -#include <qpe/resource.h> -#include <qpe/imageedit.h> -#include <qpe/timestring.h> -#include <qpe/palmtoprecord.h> - -#include <qlayout.h> -#include <qmessagebox.h> -#include <qpopupmenu.h> -#include <qtoolbutton.h> -#include <qcombobox.h> -#include <qcheckbox.h> -#include <qlineedit.h> -#include <qmultilineedit.h> -#include <qlabel.h> -#include <qtimer.h> -#include <qapplication.h> -#include <qvaluelist.h> - -NewTaskDialog::NewTaskDialog( const OTodo& task, QWidget *parent, - const char *name, bool modal, WFlags fl ) - : NewTaskDialogBase( parent, name, modal, fl ), - todo( task ) -{ - todo.setCategories( task.categories() ); - if ( todo.hasDueDate() ) - date = todo.dueDate(); - else - date = QDate::currentDate(); - - init(); - comboPriority->setCurrentItem( task.priority() - 1 ); - - checkCompleted->setChecked( task.isCompleted() ); - checkDate->setChecked( task.hasDueDate() ); - buttonDate->setText( TimeString::longDateString( date ) ); - - txtTodo->setText( task.description() ); - lneSum->setText( task.summary() ); - cmbProg->setCurrentItem( task.progress()/20 ); -} - -/* - * Constructs a NewTaskDialog which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal, - WFlags fl ) - : NewTaskDialogBase( parent, name, modal, fl ), - date( QDate::currentDate() ) -{ - if ( id != -1 ) - todo.setCategories( id ); - init(); -} - -void NewTaskDialog::init() -{ - if( layout() != 0 ){ - layout()->setMargin( 2 ); - } - QPopupMenu *m1 = new QPopupMenu( this ); - picker = new DateBookMonth( m1, 0, TRUE ); - m1->insertItem( picker ); - buttonDate->setPopup( m1 ); - comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); - - connect( picker, SIGNAL( dateClicked( int, int, int ) ), - this, SLOT( dateChanged( int, int, int ) ) ); - - connect ( selectGroupButton, SIGNAL( clicked() ), - this, SLOT( groupButtonClicked () ) ); - - buttonDate->setText( TimeString::longDateString( date ) ); - picker->setDate( date.year(), date.month(), date.day() ); - lblDown->setPixmap(Resource::loadPixmap("down") ); -} - -/* - * Destroys the object and frees any allocated resources - */ -NewTaskDialog::~NewTaskDialog() -{ - // no need to delete child widgets, Qt does it all for us -} -void NewTaskDialog::dateChanged( int y, int m, int d ) -{ - date = QDate( y, m, d ); - buttonDate->setText( TimeString::longDateString( date ) ); -} -void NewTaskDialog::groupButtonClicked () -{ -/* OContactSelectorDialog cd( this ); - QArray<int> todo_relations = todo.relations ( "addressbook" ); - QValueList<int> selectedContacts; - - for ( uint i=0; i < todo_relations.size(); i++ ){ - printf ("old: %d\n", todo_relations[i]); - selectedContacts.append( todo_relations[i] ); - } - cd.setSelected (selectedContacts); - cd.showMaximized(); - if ( cd.exec() == QDialog::Accepted ){ - selectedContacts = cd.selected (); - QValueListIterator<int> it; - todo.clearRelated("addressbook"); - for( it = selectedContacts.begin(); it != selectedContacts.end(); ++it ){ - printf ("Adding: %d\n", (*it)); - todo.addRelated( "addressbook", (*it) ); - } - - } -*/ -} - -OTodo NewTaskDialog::todoEntry() -{ - if( checkDate->isChecked() ){ - todo.setDueDate( date ); - todo.setHasDueDate( true ); - }else{ - todo.setHasDueDate( false ); - } - if ( comboCategory->currentCategory() != -1 ) { - QArray<int> arr = comboCategory->currentCategories(); - QStringList list; - todo.setCategories( arr ); - } - todo.setPriority( comboPriority->currentItem() + 1 ); - todo.setCompleted( checkCompleted->isChecked() ); - - todo.setDescription( txtTodo->text() ); - todo.setSummary( lneSum->text() ); - QString text = cmbProg->currentText(); - todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() ); - return todo; -} -void NewTaskDialog::slotCopy() -{ - txtTodo->clear(); - txtTodo->setText( lneSum->text() ); -} - -/*! - -*/ - -void NewTaskDialog::accept() -{ - QString strText = txtTodo->text(); - QString strSumm = lneSum->text(); - if ( strSumm.isEmpty() && strText.isEmpty() ) { - // hmm... just decline it then, the user obviously didn't care about it - QDialog::reject(); - return; - } - QDialog::accept(); -} diff --git a/core/pim/todo/todoentryimpl.h b/core/pim/todo/todoentryimpl.h deleted file mode 100644 index 2dfdd22..0000000 --- a/core/pim/todo/todoentryimpl.h +++ b/dev/null @@ -1,65 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#ifndef NEWTASKDIALOG_H -#define NEWTASKDIALOG_H - -#include "todoentry.h" - -#include <opie/otodo.h> -//#include <opie/ocontactselector.h> - -#include <qdatetime.h> -#include <qpalette.h> - -class QLabel; -class QTimer; -class DateBookMonth; - - - -class NewTaskDialog : public NewTaskDialogBase -{ - Q_OBJECT - -public: - NewTaskDialog( const OTodo& task, QWidget *parent = 0, const char* name = 0, - bool modal = FALSE, WFlags fl = 0 ); - NewTaskDialog( int id, QWidget* parent = 0, const char* name = 0, - bool modal = FALSE, WFlags fl = 0 ); - ~NewTaskDialog(); - - OTodo todoEntry(); - -protected slots: - void dateChanged( int y, int m, int d ); - void groupButtonClicked (); - void slotCopy(); -protected: - virtual void accept(); - -private: - void init(); - OTodo todo; - QDate date; - DateBookMonth *picker; -}; - -#endif // NEWTASKDIALOG_H |