Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 29 |
1 files changed, 26 insertions, 3 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 | |||
@@ -14,57 +14,60 @@ | |||
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
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 | ||
59 | MainWindow::MainWindow( QWidget* parent, | 62 | MainWindow::MainWindow( QWidget* parent, |
60 | const char* name ) { | 63 | const char* name ) { |
61 | 64 | ||
62 | m_syncing = false; | 65 | m_syncing = false; |
63 | m_counter = 0; | 66 | m_counter = 0; |
64 | m_tempManager = new TemplateManager(); | 67 | m_tempManager = new TemplateManager(); |
65 | m_tempManager->load(); | 68 | m_tempManager->load(); |
66 | 69 | ||
67 | initUI(); | 70 | initUI(); |
68 | initConfig(); | 71 | initConfig(); |
69 | initViews(); | 72 | initViews(); |
70 | initActions(); | 73 | initActions(); |
@@ -177,75 +180,82 @@ void MainWindow::initActions() { | |||
177 | 0, this, 0, TRUE ); | 180 | 0, this, 0, TRUE ); |
178 | a->addTo( m_view ); | 181 | a->addTo( m_view ); |
179 | a->setOn( showOverDue() ); | 182 | a->setOn( showOverDue() ); |
180 | connect(a, SIGNAL(toggled(bool)), | 183 | connect(a, SIGNAL(toggled(bool)), |
181 | this, SLOT(slotShowDue(bool) ) ); | 184 | this, SLOT(slotShowDue(bool) ) ); |
182 | m_view->insertSeparator(); | 185 | m_view->insertSeparator(); |
183 | 186 | ||
184 | m_bar->insertItem( tr("View"), m_view ); | 187 | m_bar->insertItem( tr("View"), m_view ); |
185 | 188 | ||
186 | /* templates */ | 189 | /* templates */ |
187 | m_edit->insertItem(tr("New from template"), m_template, | 190 | m_edit->insertItem(tr("New from template"), m_template, |
188 | -1, 0 ); | 191 | -1, 0 ); |
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 | } |
240 | void MainWindow::initShow() { | 250 | void MainWindow::initShow() { |
241 | m_curShow = new TextViewShow(this); | 251 | m_curShow = new TextViewShow(this); |
242 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 252 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
243 | } | 253 | } |
244 | MainWindow::~MainWindow() { | 254 | MainWindow::~MainWindow() { |
245 | delete templateManager(); | 255 | delete templateManager(); |
246 | } | 256 | } |
247 | void MainWindow::connectBase( ViewBase* base) { | 257 | void MainWindow::connectBase( ViewBase* base) { |
248 | base->connectShow( this, SLOT(slotShow(int) ) ); | 258 | base->connectShow( this, SLOT(slotShow(int) ) ); |
249 | base->connectEdit( this, SLOT(slotEdit(int) ) ); | 259 | base->connectEdit( this, SLOT(slotEdit(int) ) ); |
250 | base->connectUpdateSmall( this, | 260 | base->connectUpdateSmall( this, |
251 | SLOT(slotUpate1(int, const Todo::SmallTodo&) )); | 261 | SLOT(slotUpate1(int, const Todo::SmallTodo&) )); |
@@ -660,24 +670,37 @@ void MainWindow::slotEdit( int uid ) { | |||
660 | 670 | ||
661 | raiseCurrentView(); | 671 | raiseCurrentView(); |
662 | } | 672 | } |
663 | /* | 673 | /* |
664 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 674 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
665 | m_todoMgr.update( uid, ev ); | 675 | m_todoMgr.update( uid, ev ); |
666 | } | 676 | } |
667 | */ | 677 | */ |
668 | void MainWindow::updateTodo( const OTodo& ev) { | 678 | void MainWindow::updateTodo( const OTodo& ev) { |
669 | m_todoMgr.update( ev.uid() , ev ); | 679 | m_todoMgr.update( ev.uid() , ev ); |
670 | } | 680 | } |
671 | /* The view changed it's configuration | 681 | /* The view changed it's configuration |
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 | } | ||