summaryrefslogtreecommitdiff
path: root/core/pim/todo
authorzecke <zecke>2003-03-14 08:20:59 (UTC)
committer zecke <zecke>2003-03-14 08:20:59 (UTC)
commit7e04934c4b7b9f8ad0d74d2da1c7c1273d9fe1d4 (patch) (unidiff)
tree9d8cb73a1b6013ab409b496cf2b99503f239c0c9 /core/pim/todo
parent08094624777d78bcd09f6ba6e2157599960ef7f3 (diff)
downloadopie-7e04934c4b7b9f8ad0d74d2da1c7c1273d9fe1d4.zip
opie-7e04934c4b7b9f8ad0d74d2da1c7c1273d9fe1d4.tar.gz
opie-7e04934c4b7b9f8ad0d74d2da1c7c1273d9fe1d4.tar.bz2
Do not crash when trying to edit and there is no data
Diffstat (limited to 'core/pim/todo') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp3
-rw-r--r--core/pim/todo/tableview.cpp1
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
@@ -627,12 +627,13 @@ void MainWindow::slotShowDue(bool ov) {
627void MainWindow::slotShow( int uid ) { 627void 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}
632void MainWindow::slotEdit( int uid ) { 632void 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
@@ -788,13 +789,13 @@ void MainWindow::beam( int uid) {
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}
796void MainWindow::show( int uid ) { 797void MainWindow::show( int uid ) {
797 slotShow( uid ); 798 slotShow( uid );
798} 799}
799void MainWindow::edit( int uid ) { 800void MainWindow::edit( int uid ) {
800 slotEdit( uid ); 801 slotEdit( uid );
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
@@ -140,12 +140,13 @@ void TableView::slotShowMenu() {
140 delete menu; 140 delete menu;
141} 141}
142QString TableView::type() const { 142QString TableView::type() const {
143 return QString::fromLatin1( tr("Table View") ); 143 return QString::fromLatin1( tr("Table View") );
144} 144}
145int TableView::current() { 145int 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}
150QString TableView::currentRepresentation() { 151QString TableView::currentRepresentation() {
151 OTodo to = sorted()[currentRow()]; 152 OTodo to = sorted()[currentRow()];