summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp3
1 files changed, 2 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
@@ -585,96 +585,97 @@ void MainWindow::populateCategories() {
id = 1;
rememberId = 1;
m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ );
m_catMenu->insertSeparator();
QStringList categories = m_todoMgr.categories();
categories.append( QWidget::tr( "Unfiled" ) );
for ( QStringList::Iterator it = categories.begin();
it != categories.end(); ++it ) {
m_catMenu->insertItem( *it, id );
if ( *it == currentCategory() )
rememberId = id;
++id;
}
setCategory( rememberId );
}
bool MainWindow::showCompleted()const {
return m_completed;
}
bool MainWindow::showDeadline()const {
return m_deadline;
}
bool MainWindow::showQuickTask()const {
return m_quicktask;
}
QString MainWindow::currentCategory()const {
return m_curCat;
}
int MainWindow::currentCatId() {
return m_todoMgr.catId( m_curCat );
}
ViewBase* MainWindow::currentView() {
return m_curView;
}
void MainWindow::raiseCurrentView() {
m_stack->raiseWidget( m_curView->widget() );
}
void MainWindow::slotShowDue(bool ov) {
m_overdue = ov;
currentView()->showOverDue( ov );
raiseCurrentView();
}
void MainWindow::slotShow( int uid ) {
qWarning("slotShow");
currentShow()->slotShow( event( uid ) );
m_stack->raiseWidget( currentShow()->widget() );
}
void MainWindow::slotEdit( int uid ) {
+ if (uid == 1 ) return;
if(m_syncing) {
QMessageBox::warning(this, QWidget::tr("Todo"),
QWidget::tr("Can not edit data, currently syncing"));
return;
}
OTodo todo = m_todoMgr.event( uid );
todo = currentEditor()->edit(this, todo );
/* if completed */
if ( currentEditor()->accepted() ) {
qWarning("Replacing now" );
m_todoMgr.update( todo.uid(), todo );
currentView()->replaceEvent( todo );
/* a Category might have changed */
populateCategories();
}
raiseCurrentView();
}
/*
void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
m_todoMgr.update( uid, ev );
}
*/
void MainWindow::updateTodo( const OTodo& ev) {
m_todoMgr.update( ev.uid() , ev );
}
/* The view changed it's configuration
* update the view menu
*/
void MainWindow::slotUpdate3( QWidget* ) {
}
void MainWindow::updateList() {
m_todoMgr.updateList();
}
void MainWindow::setReadAhead( uint count ) {
if (m_todoMgr.todoDB() )
m_todoMgr.todoDB()->setReadAhead( count );
}
void MainWindow::slotQuickEntered() {
qWarning("entered");
OTodo todo = quickEditor()->todo();
if (todo.isEmpty() )
return;
@@ -746,73 +747,73 @@ void MainWindow::flush() {
void MainWindow::reload() {
slotReload();
}
int MainWindow::create() {
int uid = 0;
if(m_syncing) {
QMessageBox::warning(this, QWidget::tr("Todo"),
QWidget::tr("Can not edit data, currently syncing"));
return uid;
}
OTodo todo = currentEditor()->newTodo( currentCatId(),
this );
if ( currentEditor()->accepted() ) {
//todo.assignUid();
uid = todo.uid();
m_todoMgr.add( todo );
currentView()->addEvent( todo );
// I'm afraid we must call this every time now, otherwise
// spend expensive time comparing all these strings...
// but only call if we changed something -zecke
populateCategories();
}
raiseCurrentView( );
return uid;
}
/* delete it silently... */
bool MainWindow::remove( int uid ) {
if (m_syncing) return false;
return m_todoMgr.remove( uid );
}
void MainWindow::beam( int uid) {
::unlink( beamfile );
OTodo todo = event( uid );
OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
OTodoAccess acc( cal );
acc.load();
acc.add( todo );
acc.save();
Ir* ir = new Ir(this );
connect(ir, SIGNAL(done(Ir*) ),
this, SLOT(beamDone(Ir*) ) );
- ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
+ ir->send(beamfile, todo.summary(), "text/x-vCalendar" );
}
void MainWindow::show( int uid ) {
slotShow( uid );
}
void MainWindow::edit( int uid ) {
slotEdit( uid );
}
void MainWindow::add( const OPimRecord& rec) {
if ( rec.rtti() != OTodo::rtti() ) return;
const OTodo& todo = static_cast<const OTodo&>(rec);
m_todoMgr.add(todo );
currentView()->addEvent( todo );
// I'm afraid we must call this every time now, otherwise
// spend expensive time comparing all these strings...
// but only call if we changed something -zecke
populateCategories();
}
void MainWindow::slotReturnFromView() {
raiseCurrentView();
}