-rw-r--r-- | core/pim/todo/mainwindow.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 7810285..58981ca 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -609,48 +609,49 @@ bool MainWindow::showQuickTask()const { | |||
609 | } | 609 | } |
610 | QString MainWindow::currentCategory()const { | 610 | QString MainWindow::currentCategory()const { |
611 | return m_curCat; | 611 | return m_curCat; |
612 | } | 612 | } |
613 | int MainWindow::currentCatId() { | 613 | int MainWindow::currentCatId() { |
614 | return m_todoMgr.catId( m_curCat ); | 614 | return m_todoMgr.catId( m_curCat ); |
615 | } | 615 | } |
616 | ViewBase* MainWindow::currentView() { | 616 | ViewBase* MainWindow::currentView() { |
617 | return m_curView; | 617 | return m_curView; |
618 | } | 618 | } |
619 | void MainWindow::raiseCurrentView() { | 619 | void MainWindow::raiseCurrentView() { |
620 | m_stack->raiseWidget( m_curView->widget() ); | 620 | m_stack->raiseWidget( m_curView->widget() ); |
621 | } | 621 | } |
622 | void MainWindow::slotShowDue(bool ov) { | 622 | void MainWindow::slotShowDue(bool ov) { |
623 | m_overdue = ov; | 623 | m_overdue = ov; |
624 | currentView()->showOverDue( ov ); | 624 | currentView()->showOverDue( ov ); |
625 | raiseCurrentView(); | 625 | raiseCurrentView(); |
626 | } | 626 | } |
627 | void MainWindow::slotShow( int uid ) { | 627 | void MainWindow::slotShow( int uid ) { |
628 | qWarning("slotShow"); | 628 | qWarning("slotShow"); |
629 | currentShow()->slotShow( event( uid ) ); | 629 | currentShow()->slotShow( event( uid ) ); |
630 | m_stack->raiseWidget( currentShow()->widget() ); | 630 | m_stack->raiseWidget( currentShow()->widget() ); |
631 | } | 631 | } |
632 | void MainWindow::slotEdit( int uid ) { | 632 | void MainWindow::slotEdit( int uid ) { |
633 | if (uid == 1 ) return; | ||
633 | if(m_syncing) { | 634 | if(m_syncing) { |
634 | QMessageBox::warning(this, QWidget::tr("Todo"), | 635 | QMessageBox::warning(this, QWidget::tr("Todo"), |
635 | QWidget::tr("Can not edit data, currently syncing")); | 636 | QWidget::tr("Can not edit data, currently syncing")); |
636 | return; | 637 | return; |
637 | } | 638 | } |
638 | 639 | ||
639 | OTodo todo = m_todoMgr.event( uid ); | 640 | OTodo todo = m_todoMgr.event( uid ); |
640 | 641 | ||
641 | todo = currentEditor()->edit(this, todo ); | 642 | todo = currentEditor()->edit(this, todo ); |
642 | 643 | ||
643 | /* if completed */ | 644 | /* if completed */ |
644 | if ( currentEditor()->accepted() ) { | 645 | if ( currentEditor()->accepted() ) { |
645 | qWarning("Replacing now" ); | 646 | qWarning("Replacing now" ); |
646 | m_todoMgr.update( todo.uid(), todo ); | 647 | m_todoMgr.update( todo.uid(), todo ); |
647 | currentView()->replaceEvent( todo ); | 648 | currentView()->replaceEvent( todo ); |
648 | /* a Category might have changed */ | 649 | /* a Category might have changed */ |
649 | populateCategories(); | 650 | populateCategories(); |
650 | } | 651 | } |
651 | 652 | ||
652 | raiseCurrentView(); | 653 | raiseCurrentView(); |
653 | } | 654 | } |
654 | /* | 655 | /* |
655 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { | 656 | void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { |
656 | m_todoMgr.update( uid, ev ); | 657 | m_todoMgr.update( uid, ev ); |
@@ -770,49 +771,49 @@ int MainWindow::create() { | |||
770 | // but only call if we changed something -zecke | 771 | // but only call if we changed something -zecke |
771 | populateCategories(); | 772 | populateCategories(); |
772 | } | 773 | } |
773 | raiseCurrentView( ); | 774 | raiseCurrentView( ); |
774 | 775 | ||
775 | return uid; | 776 | return uid; |
776 | } | 777 | } |
777 | /* delete it silently... */ | 778 | /* delete it silently... */ |
778 | bool MainWindow::remove( int uid ) { | 779 | bool MainWindow::remove( int uid ) { |
779 | if (m_syncing) return false; | 780 | if (m_syncing) return false; |
780 | 781 | ||
781 | return m_todoMgr.remove( uid ); | 782 | return m_todoMgr.remove( uid ); |
782 | } | 783 | } |
783 | void MainWindow::beam( int uid) { | 784 | void MainWindow::beam( int uid) { |
784 | ::unlink( beamfile ); | 785 | ::unlink( beamfile ); |
785 | OTodo todo = event( uid ); | 786 | OTodo todo = event( uid ); |
786 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 787 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); |
787 | OTodoAccess acc( cal ); | 788 | OTodoAccess acc( cal ); |
788 | acc.load(); | 789 | acc.load(); |
789 | acc.add( todo ); | 790 | acc.add( todo ); |
790 | acc.save(); | 791 | acc.save(); |
791 | Ir* ir = new Ir(this ); | 792 | Ir* ir = new Ir(this ); |
792 | connect(ir, SIGNAL(done(Ir*) ), | 793 | connect(ir, SIGNAL(done(Ir*) ), |
793 | this, SLOT(beamDone(Ir*) ) ); | 794 | this, SLOT(beamDone(Ir*) ) ); |
794 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | 795 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
795 | } | 796 | } |
796 | void MainWindow::show( int uid ) { | 797 | void MainWindow::show( int uid ) { |
797 | slotShow( uid ); | 798 | slotShow( uid ); |
798 | } | 799 | } |
799 | void MainWindow::edit( int uid ) { | 800 | void MainWindow::edit( int uid ) { |
800 | slotEdit( uid ); | 801 | slotEdit( uid ); |
801 | } | 802 | } |
802 | void MainWindow::add( const OPimRecord& rec) { | 803 | void MainWindow::add( const OPimRecord& rec) { |
803 | if ( rec.rtti() != OTodo::rtti() ) return; | 804 | if ( rec.rtti() != OTodo::rtti() ) return; |
804 | 805 | ||
805 | const OTodo& todo = static_cast<const OTodo&>(rec); | 806 | const OTodo& todo = static_cast<const OTodo&>(rec); |
806 | 807 | ||
807 | m_todoMgr.add(todo ); | 808 | m_todoMgr.add(todo ); |
808 | currentView()->addEvent( todo ); | 809 | currentView()->addEvent( todo ); |
809 | 810 | ||
810 | 811 | ||
811 | // I'm afraid we must call this every time now, otherwise | 812 | // I'm afraid we must call this every time now, otherwise |
812 | // spend expensive time comparing all these strings... | 813 | // spend expensive time comparing all these strings... |
813 | // but only call if we changed something -zecke | 814 | // but only call if we changed something -zecke |
814 | populateCategories(); | 815 | populateCategories(); |
815 | } | 816 | } |
816 | void MainWindow::slotReturnFromView() { | 817 | void MainWindow::slotReturnFromView() { |
817 | raiseCurrentView(); | 818 | raiseCurrentView(); |
818 | } | 819 | } |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index ae27fab..d9cda09 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -122,48 +122,49 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
122 | 122 | ||
123 | } | 123 | } |
124 | /* a new day has started | 124 | /* a new day has started |
125 | * update the day | 125 | * update the day |
126 | */ | 126 | */ |
127 | void TableView::newDay() { | 127 | void TableView::newDay() { |
128 | clear(); | 128 | clear(); |
129 | updateView(); | 129 | updateView(); |
130 | } | 130 | } |
131 | TableView::~TableView() { | 131 | TableView::~TableView() { |
132 | Config config( "todo" ); | 132 | Config config( "todo" ); |
133 | config.setGroup( "Options" ); | 133 | config.setGroup( "Options" ); |
134 | for (int i = 0; i < numCols(); i++ ) | 134 | for (int i = 0; i < numCols(); i++ ) |
135 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); | 135 | config.writeEntry("Width"+QString::number(i), columnWidth(i) ); |
136 | } | 136 | } |
137 | void TableView::slotShowMenu() { | 137 | void TableView::slotShowMenu() { |
138 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | 138 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
139 | menu->exec(QCursor::pos() ); | 139 | menu->exec(QCursor::pos() ); |
140 | delete menu; | 140 | delete menu; |
141 | } | 141 | } |
142 | QString TableView::type() const { | 142 | QString TableView::type() const { |
143 | return QString::fromLatin1( tr("Table View") ); | 143 | return QString::fromLatin1( tr("Table View") ); |
144 | } | 144 | } |
145 | int TableView::current() { | 145 | int TableView::current() { |
146 | if (numRows() == 0 ) return 1; | ||
146 | int uid = sorted().uidAt(currentRow() ); | 147 | int uid = sorted().uidAt(currentRow() ); |
147 | 148 | ||
148 | return uid; | 149 | return uid; |
149 | } | 150 | } |
150 | QString TableView::currentRepresentation() { | 151 | QString TableView::currentRepresentation() { |
151 | OTodo to = sorted()[currentRow()]; | 152 | OTodo to = sorted()[currentRow()]; |
152 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 153 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
153 | } | 154 | } |
154 | /* show overdue */ | 155 | /* show overdue */ |
155 | void TableView::showOverDue( bool ) { | 156 | void TableView::showOverDue( bool ) { |
156 | clear(); | 157 | clear(); |
157 | updateView(); | 158 | updateView(); |
158 | } | 159 | } |
159 | 160 | ||
160 | void TableView::updateView( ) { | 161 | void TableView::updateView( ) { |
161 | qWarning("update view"); | 162 | qWarning("update view"); |
162 | m_row = false; | 163 | m_row = false; |
163 | static int id; | 164 | static int id; |
164 | id = startTimer(4000 ); | 165 | id = startTimer(4000 ); |
165 | /* FIXME we want one page to be read! | 166 | /* FIXME we want one page to be read! |
166 | * | 167 | * |
167 | * Calculate that screensize | 168 | * Calculate that screensize |
168 | */ | 169 | */ |
169 | todoWindow()->setReadAhead( 4 ); | 170 | todoWindow()->setReadAhead( 4 ); |