-rw-r--r-- | core/pim/todo/mainwindow.cpp | 29 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 16 | ||||
-rw-r--r-- | core/pim/todo/quickedit.cpp | 22 | ||||
-rw-r--r-- | core/pim/todo/quickedit.h | 45 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 89 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.h | 34 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 14 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 8 |
8 files changed, 247 insertions, 10 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index a6d657c..8377573 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -26,33 +26,36 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include <qmenubar.h> | 31 | #include <qmenubar.h> |
32 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qwidgetstack.h> | 35 | #include <qwidgetstack.h> |
36 | #include <qaction.h> | 36 | #include <qaction.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | #include <qvbox.h> | ||
39 | #include <qlineedit.h> | ||
38 | 40 | ||
39 | #include <qpe/applnk.h> | 41 | #include <qpe/applnk.h> |
40 | #include <qpe/config.h> | 42 | #include <qpe/config.h> |
41 | #include <qpe/ir.h> | 43 | #include <qpe/ir.h> |
42 | #include <qpe/resource.h> | 44 | #include <qpe/resource.h> |
43 | #include <qpe/qpemessagebox.h> | 45 | #include <qpe/qpemessagebox.h> |
44 | 46 | ||
45 | #include <opie/otodoaccessvcal.h> | 47 | #include <opie/otodoaccessvcal.h> |
46 | 48 | ||
49 | #include "quickeditimpl.h" | ||
47 | #include "todotemplatemanager.h" | 50 | #include "todotemplatemanager.h" |
48 | #include "templateeditor.h" | 51 | #include "templateeditor.h" |
49 | #include "todoentryimpl.h" | 52 | #include "todoentryimpl.h" |
50 | #include "tableview.h" | 53 | #include "tableview.h" |
51 | 54 | ||
52 | #include "textviewshow.h" | 55 | #include "textviewshow.h" |
53 | #include "todoeditor.h" | 56 | #include "todoeditor.h" |
54 | #include "mainwindow.h" | 57 | #include "mainwindow.h" |
55 | 58 | ||
56 | 59 | ||
57 | using namespace Todo; | 60 | using namespace Todo; |
58 | 61 | ||
@@ -189,51 +192,58 @@ void MainWindow::initActions() { | |||
189 | 192 | ||
190 | } | 193 | } |
191 | /* m_curCat from Config */ | 194 | /* m_curCat from Config */ |
192 | void MainWindow::initConfig() { | 195 | void MainWindow::initConfig() { |
193 | Config config( "todo" ); | 196 | Config config( "todo" ); |
194 | config.setGroup( "View" ); | 197 | config.setGroup( "View" ); |
195 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 198 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
196 | m_curCat = config.readEntry( "Category", QString::null ); | 199 | m_curCat = config.readEntry( "Category", QString::null ); |
197 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 200 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
198 | m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); | 201 | m_overdue = config.readBoolEntry("ShowOverDue", TRUE ); |
199 | } | 202 | } |
200 | void MainWindow::initUI() { | 203 | void MainWindow::initUI() { |
201 | m_stack = new QWidgetStack(this, "main stack"); | 204 | m_mainBox = new QVBox(this, "main box "); |
202 | setCentralWidget( m_stack ); | 205 | m_curQuick = new QuickEditImpl(this, m_mainBox ); |
206 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | ||
207 | m_quickEdit.append( m_curQuick ); | ||
208 | |||
209 | |||
210 | |||
211 | m_stack = new QWidgetStack(m_mainBox, "main stack"); | ||
212 | setCentralWidget( m_mainBox ); | ||
203 | 213 | ||
204 | setToolBarsMovable( FALSE ); | 214 | setToolBarsMovable( FALSE ); |
205 | 215 | ||
206 | m_tool = new QToolBar( this ); | 216 | m_tool = new QToolBar( this ); |
207 | m_tool->setHorizontalStretchable( TRUE ); | 217 | m_tool->setHorizontalStretchable( TRUE ); |
208 | 218 | ||
209 | m_bar = new QMenuBar( m_tool ); | 219 | m_bar = new QMenuBar( m_tool ); |
210 | 220 | ||
211 | /** QPopupMenu */ | 221 | /** QPopupMenu */ |
212 | m_edit = new QPopupMenu( this ); | 222 | m_edit = new QPopupMenu( this ); |
213 | m_options = new QPopupMenu( this ); | 223 | m_options = new QPopupMenu( this ); |
214 | m_view = new QPopupMenu( this ); | 224 | m_view = new QPopupMenu( this ); |
215 | m_catMenu = new QPopupMenu( this ); | 225 | m_catMenu = new QPopupMenu( this ); |
216 | m_template = new QPopupMenu( this ); | 226 | m_template = new QPopupMenu( this ); |
217 | 227 | ||
218 | m_catMenu->setCheckable( TRUE ); | 228 | m_catMenu->setCheckable( TRUE ); |
219 | m_template->setCheckable( TRUE ); | 229 | m_template->setCheckable( TRUE ); |
220 | 230 | ||
221 | connect(m_catMenu, SIGNAL(activated(int) ), | 231 | connect(m_catMenu, SIGNAL(activated(int) ), |
222 | this, SLOT(setCategory(int) ) ); | 232 | this, SLOT(setCategory(int) ) ); |
223 | connect(m_template, SIGNAL(activated(int) ), | 233 | connect(m_template, SIGNAL(activated(int) ), |
224 | this, SLOT(slotNewFromTemplate(int) ) ); | 234 | this, SLOT(slotNewFromTemplate(int) ) ); |
225 | } | 235 | } |
226 | void MainWindow::initViews() { | 236 | void MainWindow::initViews() { |
227 | TableView* tableView = new TableView( this, this ); | 237 | TableView* tableView = new TableView( this, m_stack ); |
228 | m_stack->addWidget( tableView, m_counter++ ); | 238 | m_stack->addWidget( tableView, m_counter++ ); |
229 | m_views.append( tableView ); | 239 | m_views.append( tableView ); |
230 | m_curView = tableView; | 240 | m_curView = tableView; |
231 | connectBase( tableView ); | 241 | connectBase( tableView ); |
232 | /* add QString type + QString configname to | 242 | /* add QString type + QString configname to |
233 | * the View menu | 243 | * the View menu |
234 | * and subdirs for multiple views | 244 | * and subdirs for multiple views |
235 | */ | 245 | */ |
236 | } | 246 | } |
237 | void MainWindow::initEditor() { | 247 | void MainWindow::initEditor() { |
238 | m_curEdit = new Editor(); | 248 | m_curEdit = new Editor(); |
239 | } | 249 | } |
@@ -672,12 +682,25 @@ void MainWindow::updateTodo( const OTodo& ev) { | |||
672 | * update the view menu | 682 | * update the view menu |
673 | */ | 683 | */ |
674 | void MainWindow::slotUpdate3( QWidget* ) { | 684 | void MainWindow::slotUpdate3( QWidget* ) { |
675 | 685 | ||
676 | } | 686 | } |
677 | void MainWindow::updateList() { | 687 | void MainWindow::updateList() { |
678 | m_todoMgr.updateList(); | 688 | m_todoMgr.updateList(); |
679 | } | 689 | } |
680 | void MainWindow::setReadAhead( uint count ) { | 690 | void MainWindow::setReadAhead( uint count ) { |
681 | if (m_todoMgr.todoDB() ) | 691 | if (m_todoMgr.todoDB() ) |
682 | m_todoMgr.todoDB()->setReadAhead( count ); | 692 | m_todoMgr.todoDB()->setReadAhead( count ); |
683 | } | 693 | } |
694 | void MainWindow::slotQuickEntered() { | ||
695 | qWarning("entered"); | ||
696 | OTodo todo = quickEditor()->todo(); | ||
697 | if (todo.isEmpty() ) | ||
698 | return; | ||
699 | |||
700 | m_todoMgr.add( todo ); | ||
701 | currentView()->addEvent( todo ); | ||
702 | raiseCurrentView(); | ||
703 | } | ||
704 | QuickEditBase* MainWindow::quickEditor() { | ||
705 | return m_curQuick; | ||
706 | } | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 5a18e64..270cbd1 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -28,40 +28,42 @@ | |||
28 | 28 | ||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | #include <qmainwindow.h> | 33 | #include <qmainwindow.h> |
34 | 34 | ||
35 | #include <opie/otodoaccess.h> | 35 | #include <opie/otodoaccess.h> |
36 | #include <opie/otodo.h> | 36 | #include <opie/otodo.h> |
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | ||
40 | #include "todomanager.h" | 41 | #include "todomanager.h" |
41 | 42 | ||
42 | class QPopupMenu; | 43 | class QPopupMenu; |
43 | class QMenuBar; | 44 | class QMenuBar; |
44 | class QToolBar; | 45 | class QToolBar; |
45 | class QAction; | 46 | class QAction; |
46 | class QWidgetStack; | 47 | class QWidgetStack; |
47 | class Ir; | 48 | class Ir; |
48 | 49 | class QVBox; | |
49 | 50 | ||
50 | namespace Todo { | 51 | namespace Todo { |
51 | typedef TodoView View; | 52 | typedef TodoView View; |
52 | class TemplateManager; | 53 | class TemplateManager; |
53 | class Editor; | 54 | class Editor; |
54 | class TodoShow; | 55 | class TodoShow; |
55 | class TemplateEditor; | 56 | class TemplateEditor; |
57 | struct QuickEditBase; | ||
56 | 58 | ||
57 | class MainWindow : public QMainWindow { | 59 | class MainWindow : public QMainWindow { |
58 | Q_OBJECT | 60 | Q_OBJECT |
59 | public: | 61 | public: |
60 | MainWindow( QWidget *parent = 0, | 62 | MainWindow( QWidget *parent = 0, |
61 | const char* name = 0 ); | 63 | const char* name = 0 ); |
62 | ~MainWindow(); | 64 | ~MainWindow(); |
63 | 65 | ||
64 | /** return a context menu for an OTodo */ | 66 | /** return a context menu for an OTodo */ |
65 | QPopupMenu* contextMenu(int uid ); | 67 | QPopupMenu* contextMenu(int uid ); |
66 | QPopupMenu* options(); | 68 | QPopupMenu* options(); |
67 | QPopupMenu* edit(); | 69 | QPopupMenu* edit(); |
@@ -74,85 +76,97 @@ namespace Todo { | |||
74 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 76 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
75 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 77 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
76 | 78 | ||
77 | OTodo event(int uid ); | 79 | OTodo event(int uid ); |
78 | 80 | ||
79 | bool isSyncing()const; | 81 | bool isSyncing()const; |
80 | bool showCompleted()const; | 82 | bool showCompleted()const; |
81 | bool showDeadline()const; | 83 | bool showDeadline()const; |
82 | bool showOverDue()const; | 84 | bool showOverDue()const; |
83 | QString currentCategory()const; | 85 | QString currentCategory()const; |
84 | int currentCatId(); | 86 | int currentCatId(); |
85 | TemplateManager* templateManager(); | 87 | TemplateManager* templateManager(); |
88 | QuickEditBase* quickEditor(); | ||
86 | 89 | ||
87 | void updateTodo( const OTodo& ); | 90 | void updateTodo( const OTodo& ); |
88 | void populateTemplates(); | 91 | void populateTemplates(); |
89 | Editor* currentEditor(); | 92 | Editor* currentEditor(); |
90 | void setReadAhead(uint count ); | 93 | void setReadAhead(uint count ); |
91 | private slots: | 94 | private slots: |
95 | void slotQuickEntered(); | ||
92 | void populateCategories(); | 96 | void populateCategories(); |
93 | void slotReload(); | 97 | void slotReload(); |
94 | void slotFlush(); | 98 | void slotFlush(); |
95 | 99 | ||
96 | protected: | 100 | protected: |
97 | void closeEvent( QCloseEvent* e ); | 101 | void closeEvent( QCloseEvent* e ); |
98 | 102 | ||
99 | private: | 103 | private: |
100 | void receiveFile( const QString& filename ); | 104 | void receiveFile( const QString& filename ); |
101 | void connectBase( ViewBase* ); | 105 | void connectBase( ViewBase* ); |
102 | void initUI(); | 106 | void initUI(); |
103 | void initActions(); | 107 | void initActions(); |
104 | void initConfig(); | 108 | void initConfig(); |
105 | void initViews(); | 109 | void initViews(); |
106 | void initEditor(); | 110 | void initEditor(); |
107 | void initShow(); | 111 | void initShow(); |
108 | void initTemplate(); | 112 | void initTemplate(); |
109 | void raiseCurrentView(); | 113 | void raiseCurrentView(); |
110 | ViewBase* currentView(); | 114 | ViewBase* currentView(); |
111 | ViewBase* m_curView; | 115 | ViewBase* m_curView; |
116 | QuickEditBase* m_curQuick; | ||
112 | Editor* m_curEdit; | 117 | Editor* m_curEdit; |
113 | TodoShow* currentShow(); | 118 | TodoShow* currentShow(); |
114 | TodoShow* m_curShow; | 119 | TodoShow* m_curShow; |
115 | TemplateEditor* currentTemplateEditor(); | 120 | TemplateEditor* currentTemplateEditor(); |
116 | TemplateEditor* m_curTempEd; | 121 | TemplateEditor* m_curTempEd; |
117 | 122 | ||
118 | QMenuBar* m_bar; | 123 | QMenuBar* m_bar; |
119 | QToolBar* m_tool; | 124 | QToolBar* m_tool; |
120 | QAction* m_editAction, | 125 | QAction* m_editAction, |
121 | *m_deleteAction, | 126 | *m_deleteAction, |
122 | *m_findAction, | 127 | *m_findAction, |
123 | *m_completedAction, | 128 | *m_completedAction, |
124 | *m_showDeadLineAction, | 129 | *m_showDeadLineAction, |
125 | *m_deleteAllAction, | 130 | *m_deleteAllAction, |
126 | *m_deleteCompleteAction, | 131 | *m_deleteCompleteAction, |
127 | *m_duplicateAction, | 132 | *m_duplicateAction, |
128 | *m_showOverDueAction, | 133 | *m_showOverDueAction, |
129 | *m_effectiveAction; | 134 | *m_effectiveAction; |
130 | QWidgetStack *m_stack; | 135 | QWidgetStack *m_stack; |
131 | QPopupMenu* m_catMenu, | 136 | QPopupMenu* m_catMenu, |
132 | *m_edit, | 137 | *m_edit, |
133 | *m_options, | 138 | *m_options, |
134 | *m_view, | 139 | *m_view, |
135 | *m_template; | 140 | *m_template; |
141 | /* box with two rows | ||
142 | * top will be the quick edit | ||
143 | * this will bite my ass once | ||
144 | * we want to have all parts | ||
145 | * exchangeable | ||
146 | */ | ||
147 | QVBox* m_mainBox; | ||
136 | 148 | ||
137 | bool m_syncing:1; | 149 | bool m_syncing:1; |
138 | bool m_deadline:1; | 150 | bool m_deadline:1; |
139 | bool m_completed:1; | 151 | bool m_completed:1; |
140 | bool m_overdue:1; | 152 | bool m_overdue:1; |
141 | TodoManager m_todoMgr; | 153 | TodoManager m_todoMgr; |
142 | QString m_curCat; | 154 | QString m_curCat; |
143 | QList<ViewBase> m_views; | 155 | QList<ViewBase> m_views; |
156 | QList<QuickEditBase> m_quickEdit; | ||
144 | uint m_counter; | 157 | uint m_counter; |
145 | TemplateManager* m_tempManager; | 158 | TemplateManager* m_tempManager; |
146 | 159 | ||
160 | |||
147 | private slots: | 161 | private slots: |
148 | void slotShow(int); | 162 | void slotShow(int); |
149 | void slotEdit(int); | 163 | void slotEdit(int); |
150 | private slots: | 164 | private slots: |
151 | void slotUpdate3( QWidget* ); | 165 | void slotUpdate3( QWidget* ); |
152 | void slotNewFromTemplate(int id ); | 166 | void slotNewFromTemplate(int id ); |
153 | void slotNew(); | 167 | void slotNew(); |
154 | void slotDuplicate(); | 168 | void slotDuplicate(); |
155 | void slotDelete(); | 169 | void slotDelete(); |
156 | void slotDeleteAll(); | 170 | void slotDeleteAll(); |
157 | void slotDeleteCompleted(); | 171 | void slotDeleteCompleted(); |
158 | 172 | ||
diff --git a/core/pim/todo/quickedit.cpp b/core/pim/todo/quickedit.cpp new file mode 100644 index 0000000..edcd48a --- a/dev/null +++ b/core/pim/todo/quickedit.cpp | |||
@@ -0,0 +1,22 @@ | |||
1 | #include "mainwindow.h" | ||
2 | #include "quickedit.h" | ||
3 | |||
4 | using namespace Todo; | ||
5 | |||
6 | // not so interesting part base Implementation | ||
7 | QuickEdit::QuickEdit(MainWindow* main ) | ||
8 | : m_main( main ) { | ||
9 | m_sig = new QSignal(); | ||
10 | } | ||
11 | QuickEdit::~QuickEdit() { | ||
12 | delete m_sig; | ||
13 | } | ||
14 | QSignal* QuickEdit::signal() { | ||
15 | return m_sig; | ||
16 | } | ||
17 | MainWindow* QuickEdit::mainWindow() { | ||
18 | return m_main; | ||
19 | } | ||
20 | void QuickEdit::commit() { | ||
21 | m_sig->activate(); | ||
22 | } | ||
diff --git a/core/pim/todo/quickedit.h b/core/pim/todo/quickedit.h new file mode 100644 index 0000000..5fe74fe --- a/dev/null +++ b/core/pim/todo/quickedit.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef OPIE_QUICK_EDIT_H | ||
2 | #define OPIE_QUICK_EDIT_H | ||
3 | |||
4 | #include <qsignal.h> | ||
5 | #include <qwidget.h> | ||
6 | |||
7 | #include <opie/otodo.h> | ||
8 | |||
9 | namespace Todo{ | ||
10 | class MainWindow; | ||
11 | struct QuickEditBase { | ||
12 | virtual OTodo todo()const = 0l; | ||
13 | virtual QSignal* signal() = 0l; | ||
14 | virtual QWidget* widget() = 0l; | ||
15 | }; | ||
16 | /* | ||
17 | * this is my second try | ||
18 | * of signal and slots with namespaces | ||
19 | * and templates | ||
20 | * I use a different approach now | ||
21 | * I give a QSignal away | ||
22 | * and have a protected method called emit | ||
23 | */ | ||
24 | /** | ||
25 | * Quick edit is meant to quickly enter | ||
26 | * OTodos in a fast way | ||
27 | */ | ||
28 | class QuickEdit : public QuickEditBase{ | ||
29 | public: | ||
30 | QuickEdit(MainWindow* main ); | ||
31 | virtual ~QuickEdit(); | ||
32 | //OTodo todo()const; | ||
33 | QSignal* signal(); | ||
34 | //QWidget* widget(); | ||
35 | protected: | ||
36 | MainWindow* mainWindow(); | ||
37 | void commit(); | ||
38 | private: | ||
39 | MainWindow* m_main; | ||
40 | QSignal* m_sig; | ||
41 | }; | ||
42 | }; | ||
43 | |||
44 | |||
45 | #endif | ||
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp new file mode 100644 index 0000000..2dd5b61 --- a/dev/null +++ b/core/pim/todo/quickeditimpl.cpp | |||
@@ -0,0 +1,89 @@ | |||
1 | #include <qlineedit.h> | ||
2 | |||
3 | #include <opie/oclickablelabel.h> | ||
4 | |||
5 | #include "mainwindow.h" | ||
6 | #include "quickeditimpl.h" | ||
7 | |||
8 | |||
9 | QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent ) | ||
10 | : QHBox(arent), Todo::QuickEdit(win) { | ||
11 | m_lbl = new OClickableLabel(this ); | ||
12 | m_lbl->setMinimumWidth(12); | ||
13 | m_lbl->setText("3"); | ||
14 | |||
15 | m_edit = new QLineEdit(this ); | ||
16 | |||
17 | m_enter = new OClickableLabel(this); | ||
18 | m_enter->setText("Enter"); | ||
19 | |||
20 | m_more = new OClickableLabel(this); | ||
21 | m_more->setText("More"); | ||
22 | |||
23 | |||
24 | // connect | ||
25 | connect(m_lbl, SIGNAL(clicked() ), | ||
26 | this, SLOT(slotPrio()) ); | ||
27 | connect(m_enter, SIGNAL(clicked() ), | ||
28 | this, SLOT(slotEnter() ) ); | ||
29 | connect(m_more, SIGNAL(clicked() ), | ||
30 | this, SLOT(slotMore() ) ); | ||
31 | |||
32 | m_menu = 0l; | ||
33 | reinit(); | ||
34 | setMaximumHeight( m_edit->sizeHint().height() ); | ||
35 | } | ||
36 | QuickEditImpl::~QuickEditImpl() { | ||
37 | |||
38 | } | ||
39 | OTodo QuickEditImpl::todo()const { | ||
40 | return m_todo; | ||
41 | } | ||
42 | QWidget* QuickEditImpl::widget() { | ||
43 | return this; | ||
44 | } | ||
45 | QSize QuickEditImpl::sizeHint()const{ | ||
46 | return m_edit->sizeHint(); | ||
47 | } | ||
48 | void QuickEditImpl::slotEnter() { | ||
49 | OTodo todo; | ||
50 | |||
51 | |||
52 | if (!m_edit->text().isEmpty() ) { | ||
53 | todo.setUid(1 ); // new uid | ||
54 | todo.setPriority( m_lbl->text().toInt() ); | ||
55 | todo.setSummary( m_edit->text() ); | ||
56 | if ( mainWindow()->currentCatId() != 0 ) | ||
57 | todo.setCategories( mainWindow()->currentCatId() ); | ||
58 | |||
59 | m_todo = todo; | ||
60 | commit(); | ||
61 | } | ||
62 | m_todo = todo; | ||
63 | reinit(); | ||
64 | } | ||
65 | void QuickEditImpl::slotPrio() { | ||
66 | m_state++; | ||
67 | if (m_state > 2 ) | ||
68 | m_state = 0; | ||
69 | |||
70 | switch(m_state ) { | ||
71 | case 0: | ||
72 | m_lbl->setText( "1" ); | ||
73 | break; | ||
74 | case 2: | ||
75 | m_lbl->setText( "5" ); | ||
76 | break; | ||
77 | case 1: | ||
78 | default: | ||
79 | m_lbl->setText( "3"); | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | void QuickEditImpl::slotMore() { | ||
84 | } | ||
85 | void QuickEditImpl::reinit() { | ||
86 | m_state = 1; | ||
87 | m_lbl->setText("3"); | ||
88 | m_edit->clear(); | ||
89 | } | ||
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h new file mode 100644 index 0000000..d0f6c69 --- a/dev/null +++ b/core/pim/todo/quickeditimpl.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef OPIE_QUICK_EDIT_IMPL_H | ||
2 | #define OPIE_QUICK_EDIT_IMPL_H | ||
3 | |||
4 | #include <qhbox.h> | ||
5 | |||
6 | #include "quickedit.h" | ||
7 | |||
8 | class QLineEdit; | ||
9 | class QLabel; | ||
10 | |||
11 | class QuickEditImpl : public QHBox, public Todo::QuickEdit { | ||
12 | Q_OBJECT | ||
13 | public: | ||
14 | QuickEditImpl( Todo::MainWindow* win , QWidget* parent); | ||
15 | ~QuickEditImpl(); | ||
16 | OTodo todo()const; | ||
17 | QWidget* widget(); | ||
18 | QSize sizeHint()const; | ||
19 | private slots: | ||
20 | void slotEnter(); | ||
21 | void slotPrio(); | ||
22 | void slotMore(); | ||
23 | private: | ||
24 | void reinit(); | ||
25 | int m_state; | ||
26 | QLabel* m_lbl; | ||
27 | QLineEdit* m_edit; | ||
28 | QLabel* m_enter; | ||
29 | QLabel* m_more; | ||
30 | QPopupMenu* m_menu; | ||
31 | OTodo m_todo; | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index f4b898f..34b8b3c 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -117,67 +117,70 @@ int TableView::current() { | |||
117 | return uid; | 117 | return uid; |
118 | } | 118 | } |
119 | QString TableView::currentRepresentation() { | 119 | QString TableView::currentRepresentation() { |
120 | return text( currentRow(), 2); | 120 | return text( currentRow(), 2); |
121 | } | 121 | } |
122 | /* show overdue */ | 122 | /* show overdue */ |
123 | void TableView::showOverDue( bool ) { | 123 | void TableView::showOverDue( bool ) { |
124 | clear(); | 124 | clear(); |
125 | updateView(); | 125 | updateView(); |
126 | } | 126 | } |
127 | 127 | ||
128 | void TableView::updateView( ) { | 128 | void TableView::updateView( ) { |
129 | qWarning("update view"); | ||
129 | m_row = false; | 130 | m_row = false; |
130 | startTimer( 2000 ); | 131 | static int id; |
132 | id = startTimer(2000 ); | ||
131 | /* FIXME we want one page to be read! | 133 | /* FIXME we want one page to be read! |
132 | * | 134 | * |
133 | * Calculate that screensize | 135 | * Calculate that screensize |
134 | */ | 136 | */ |
135 | todoWindow()->setReadAhead( 4 ); | 137 | todoWindow()->setReadAhead( 4 ); |
136 | sort(); | 138 | sort(); |
137 | OTodoAccess::List::Iterator it, end; | 139 | OTodoAccess::List::Iterator it, end; |
138 | it = sorted().begin(); | 140 | it = sorted().begin(); |
139 | end = sorted().end(); | 141 | end = sorted().end(); |
140 | 142 | ||
141 | qWarning("setTodos"); | 143 | qWarning("setTodos"); |
142 | QTime time; | 144 | QTime time; |
143 | time.start(); | 145 | time.start(); |
144 | m_enablePaint = false; | 146 | m_enablePaint = false; |
145 | setUpdatesEnabled( false ); | 147 | setUpdatesEnabled( false ); |
146 | viewport()->setUpdatesEnabled( false ); | 148 | viewport()->setUpdatesEnabled( false ); |
147 | 149 | ||
148 | QTime t; | 150 | QTime t; |
149 | t.start(); | 151 | t.start(); |
150 | setNumRows( it.count() ); | 152 | setNumRows( it.count() ); |
153 | if ( it.count() == 0 ) | ||
154 | killTimer(id); | ||
151 | int elc = time.elapsed(); | 155 | int elc = time.elapsed(); |
152 | qWarning("Adding took %d", elc/1000 ); | 156 | qWarning("Adding took %d", elc/1000 ); |
153 | setUpdatesEnabled( true ); | 157 | setUpdatesEnabled( true ); |
154 | viewport()->setUpdatesEnabled( true ); | 158 | viewport()->setUpdatesEnabled( true ); |
155 | viewport()->update(); | 159 | viewport()->update(); |
156 | 160 | ||
157 | m_enablePaint = true; | 161 | m_enablePaint = true; |
158 | int el = time.elapsed(); | 162 | int el = time.elapsed(); |
159 | qWarning("adding took %d", el/1000 ); | 163 | qWarning("adding took %d", el/1000 ); |
160 | } | 164 | } |
161 | void TableView::setTodo( int, const OTodo&) { | 165 | void TableView::setTodo( int, const OTodo&) { |
162 | sort(); | 166 | sort(); |
163 | 167 | ||
164 | /* repaint */ | 168 | /* repaint */ |
165 | QTable::update(); | 169 | repaint(); |
166 | } | 170 | } |
167 | void TableView::addEvent( const OTodo&) { | 171 | void TableView::addEvent( const OTodo&) { |
168 | sort(); | ||
169 | 172 | ||
170 | /* fix problems of not showing the 'Haken' */ | 173 | /* fix problems of not showing the 'Haken' */ |
171 | QTable::repaint(); | 174 | updateView(); |
172 | } | 175 | } |
173 | /* | 176 | /* |
174 | * find the event | 177 | * find the event |
175 | * and then replace the complete row | 178 | * and then replace the complete row |
176 | */ | 179 | */ |
177 | void TableView::replaceEvent( const OTodo& ev) { | 180 | void TableView::replaceEvent( const OTodo& ev) { |
178 | addEvent( ev ); | 181 | addEvent( ev ); |
179 | } | 182 | } |
180 | /* | 183 | /* |
181 | * re aligning table can be slow too | 184 | * re aligning table can be slow too |
182 | * FIXME: look what performs better | 185 | * FIXME: look what performs better |
183 | * either this or the old align table | 186 | * either this or the old align table |
@@ -419,24 +422,27 @@ void TableView::setCellContentFromEditor(int row, int col ) { | |||
419 | } | 422 | } |
420 | void TableView::slotPriority() { | 423 | void TableView::slotPriority() { |
421 | setCellContentFromEditor( currentRow(), currentColumn() ); | 424 | setCellContentFromEditor( currentRow(), currentColumn() ); |
422 | } | 425 | } |
423 | /* | 426 | /* |
424 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 427 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
425 | * filled enough. | 428 | * filled enough. |
426 | * We will try to read ahead 4 items in both ways | 429 | * We will try to read ahead 4 items in both ways |
427 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 430 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
428 | * | 431 | * |
429 | */ | 432 | */ |
430 | void TableView::timerEvent( QTimerEvent* ev ) { | 433 | void TableView::timerEvent( QTimerEvent* ev ) { |
434 | if (sorted().count() == 0 ) | ||
435 | return; | ||
436 | |||
431 | int row = currentRow(); | 437 | int row = currentRow(); |
432 | qWarning("TimerEvent %d", row); | 438 | qWarning("TimerEvent %d", row); |
433 | if ( m_row ) { | 439 | if ( m_row ) { |
434 | int ro = row-4; | 440 | int ro = row-4; |
435 | if (ro < 0 ) ro = 0; | 441 | if (ro < 0 ) ro = 0; |
436 | sorted()[ro]; | 442 | sorted()[ro]; |
437 | 443 | ||
438 | ro = row+4; | 444 | ro = row+4; |
439 | sorted()[ro]; | 445 | sorted()[ro]; |
440 | } else { | 446 | } else { |
441 | int ro = row + 8; | 447 | int ro = row + 8; |
442 | sorted()[ro]; | 448 | sorted()[ro]; |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index f26acee..d432e78 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -6,41 +6,45 @@ HEADERS = smalltodo.h \ | |||
6 | todomanager.h \ | 6 | todomanager.h \ |
7 | mainwindow.h \ | 7 | mainwindow.h \ |
8 | todoview.h \ | 8 | todoview.h \ |
9 | todoentryimpl.h \ | 9 | todoentryimpl.h \ |
10 | tableview.h \ | 10 | tableview.h \ |
11 | tableitems.h \ | 11 | tableitems.h \ |
12 | todotemplatemanager.h \ | 12 | todotemplatemanager.h \ |
13 | todoeditor.h \ | 13 | todoeditor.h \ |
14 | todoshow.h \ | 14 | todoshow.h \ |
15 | textviewshow.h \ | 15 | textviewshow.h \ |
16 | templateeditor.h \ | 16 | templateeditor.h \ |
17 | templatedialog.h \ | 17 | templatedialog.h \ |
18 | templatedialogimpl.h | 18 | templatedialogimpl.h \ |
19 | quickedit.h \ | ||
20 | quickeditimpl.h | ||
19 | 21 | ||
20 | SOURCES= smalltodo.cpp \ | 22 | SOURCES= smalltodo.cpp \ |
21 | todomanager.cpp \ | 23 | todomanager.cpp \ |
22 | mainwindow.cpp \ | 24 | mainwindow.cpp \ |
23 | main.cpp \ | 25 | main.cpp \ |
24 | todoentryimpl.cpp \ | 26 | todoentryimpl.cpp \ |
25 | tableview.cpp \ | 27 | tableview.cpp \ |
26 | tableitems.cpp \ | 28 | tableitems.cpp \ |
27 | todoview.cpp \ | 29 | todoview.cpp \ |
28 | todotemplatemanager.cpp \ | 30 | todotemplatemanager.cpp \ |
29 | todoeditor.cpp \ | 31 | todoeditor.cpp \ |
30 | todoshow.cpp \ | 32 | todoshow.cpp \ |
31 | textviewshow.cpp \ | 33 | textviewshow.cpp \ |
32 | templateeditor.cpp \ | 34 | templateeditor.cpp \ |
33 | templatedialog.cpp \ | 35 | templatedialog.cpp \ |
34 | templatedialogimpl.cpp | 36 | templatedialogimpl.cpp \ |
37 | quickeditimpl.cpp \ | ||
38 | quickedit.cpp | ||
35 | 39 | ||
36 | INTERFACES= todoentry.ui | 40 | INTERFACES= todoentry.ui |
37 | TARGET = todolist | 41 | TARGET = todolist |
38 | INCLUDEPATH += $(OPIEDIR)/include | 42 | INCLUDEPATH += $(OPIEDIR)/include |
39 | DEPENDPATH+= $(OPIEDIR)/include | 43 | DEPENDPATH+= $(OPIEDIR)/include |
40 | LIBS += -lqpe -lopie | 44 | LIBS += -lqpe -lopie |
41 | 45 | ||
42 | TRANSLATIONS = ../../../i18n/de/todolist.ts \ | 46 | TRANSLATIONS = ../../../i18n/de/todolist.ts \ |
43 | ../../../i18n/en/todolist.ts \ | 47 | ../../../i18n/en/todolist.ts \ |
44 | ../../../i18n/es/todolist.ts \ | 48 | ../../../i18n/es/todolist.ts \ |
45 | ../../../i18n/fr/todolist.ts \ | 49 | ../../../i18n/fr/todolist.ts \ |
46 | ../../../i18n/hu/todolist.ts \ | 50 | ../../../i18n/hu/todolist.ts \ |