summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp106
1 files changed, 87 insertions, 19 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index b5cace9..883d78c 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -124,6 +124,8 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
124 124
125 catMenu = new QPopupMenu( this ); 125 catMenu = new QPopupMenu( this );
126 QPopupMenu *edit = new QPopupMenu( this ); 126 QPopupMenu *edit = new QPopupMenu( this );
127 QPopupMenu *options = new QPopupMenu(this );
128
127 contextMenu = new QPopupMenu( this ); 129 contextMenu = new QPopupMenu( this );
128 130
129 bar = new QPEToolBar( this ); 131 bar = new QPEToolBar( this );
@@ -135,7 +137,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
135 a->addTo( bar ); 137 a->addTo( bar );
136 a->addTo( edit ); 138 a->addTo( edit );
137 139
138 a = new QAction( tr( "Edit" ), Resource::loadIconSet( "edit" ), 140 a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ),
139 QString::null, 0, this, 0 ); 141 QString::null, 0, this, 0 );
140 connect( a, SIGNAL( activated() ), 142 connect( a, SIGNAL( activated() ),
141 this, SLOT( slotEdit() ) ); 143 this, SLOT( slotEdit() ) );
@@ -144,8 +146,9 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
144 a->addTo( contextMenu ); 146 a->addTo( contextMenu );
145 a->setEnabled( FALSE ); 147 a->setEnabled( FALSE );
146 editAction = a; 148 editAction = a;
149 edit->insertSeparator();
147 150
148 a = new QAction( tr( "Delete" ), Resource::loadIconSet( "trash" ), 151 a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ),
149 QString::null, 0, this, 0 ); 152 QString::null, 0, this, 0 );
150 connect( a, SIGNAL( activated() ), 153 connect( a, SIGNAL( activated() ),
151 this, SLOT( slotDelete() ) ); 154 this, SLOT( slotDelete() ) );
@@ -155,6 +158,26 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
155 a->setEnabled( FALSE ); 158 a->setEnabled( FALSE );
156 deleteAction = a; 159 deleteAction = a;
157 160
161 // delete All in category is missing....
162 // set All Done
163 // set All Done in category
164
165 a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 );
166 connect(a, SIGNAL( activated() ),
167 this, SLOT( slotDeleteAll() ) );
168 a->addTo(edit );
169 a->setEnabled( FALSE );
170 deleteAllAction = a;
171
172 edit->insertSeparator();
173 a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 );
174 connect(a, SIGNAL( activated() ),
175 this, SLOT( slotDuplicate() ) );
176 a->addTo(edit );
177 a->setEnabled( FALSE );
178 duplicateAction = a;
179
180 edit->insertSeparator();
158 if ( Ir::supported() ) { 181 if ( Ir::supported() ) {
159 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 182 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
160 QString::null, 0, this, 0 ); 183 QString::null, 0, this, 0 );
@@ -169,7 +192,9 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
169 connect( a, SIGNAL( activated() ), 192 connect( a, SIGNAL( activated() ),
170 this, SLOT( slotFind() ) ); 193 this, SLOT( slotFind() ) );
171 a->addTo( bar ); 194 a->addTo( bar );
172 a->addTo( edit ); 195 a->addTo( options );
196 options->insertSeparator();
197
173 if ( table->numRows() ) 198 if ( table->numRows() )
174 a->setEnabled( TRUE ); 199 a->setEnabled( TRUE );
175 else 200 else
@@ -186,9 +211,24 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
186 catMenu->setCheckable( true ); 211 catMenu->setCheckable( true );
187 populateCategories(); 212 populateCategories();
188 213
189 mb->insertItem( tr( "Data" ), edit );
190 mb->insertItem( tr( "View" ), catMenu );
191 214
215 completedAction->addTo( options );
216 completedAction->setOn( table->showCompleted() );
217 showdeadlineAction->addTo( options );
218 showdeadlineAction->setOn( table->showDeadline() );
219 options->insertSeparator( );
220 QList<QWidget> list;
221 list.append(table );
222 OFontMenu *menu = new OFontMenu(this, "menu",list );
223 menu->forceSize( table->horizontalHeader(), 10 );
224 //catMenu->insertItem(tr("Fonts"), menu );
225 list.clear();
226 options->insertItem( tr("Fonts"), menu );
227
228
229 mb->insertItem( tr( "Data" ), edit );
230 mb->insertItem( tr( "Category" ), catMenu );
231 mb->insertItem( tr( "Options"), options );
192 resize( 200, 300 ); 232 resize( 200, 300 );
193 if ( table->numRows() > 0 ) 233 if ( table->numRows() > 0 )
194 currentEntryChanged( 0, 0 ); 234 currentEntryChanged( 0, 0 );
@@ -279,6 +319,30 @@ void TodoWindow::slotDelete()
279 findAction->setEnabled( FALSE ); 319 findAction->setEnabled( FALSE );
280 } 320 }
281} 321}
322void TodoWindow::slotDeleteAll()
323{
324 if(syncing) {
325 QMessageBox::warning(this, tr("Todo"),
326 tr("Can not edit data, currently syncing"));
327 return;
328 }
329
330 //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
331
332 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Should I delete all tasks?") ) )
333 return;
334
335
336
337 table->setPaintingEnabled( false );
338 table->removeAllEntries();
339 table->setPaintingEnabled( true );
340
341 if ( table->numRows() == 0 ) {
342 currentEntryChanged( -1, 0 );
343 findAction->setEnabled( FALSE );
344 }
345}
282 346
283void TodoWindow::slotEdit() 347void TodoWindow::slotEdit()
284{ 348{
@@ -307,7 +371,19 @@ void TodoWindow::slotEdit()
307 populateCategories(); 371 populateCategories();
308 372
309} 373}
310 374void TodoWindow::slotDuplicate()
375{
376 if(syncing) {
377 QMessageBox::warning(this, tr("Todo"),
378 tr("Can not edit data, currently syncing"));
379 return;
380 }
381 ToDoEvent ev = table->currentEntry();
382 ToDoEvent ev2 = ToDoEvent( ev );
383 table->setPaintingEnabled( false );
384 table->addEntry( ev2 );
385 table->setPaintingEnabled( true );
386}
311void TodoWindow::slotShowPopup( const QPoint &p ) 387void TodoWindow::slotShowPopup( const QPoint &p )
312{ 388{
313 contextMenu->popup( p ); 389 contextMenu->popup( p );
@@ -327,9 +403,13 @@ void TodoWindow::currentEntryChanged( int r, int )
327 if ( r != -1 && table->rowHeight( r ) > 0 ) { 403 if ( r != -1 && table->rowHeight( r ) > 0 ) {
328 editAction->setEnabled( TRUE ); 404 editAction->setEnabled( TRUE );
329 deleteAction->setEnabled( TRUE ); 405 deleteAction->setEnabled( TRUE );
406 duplicateAction->setEnabled( TRUE );
407 deleteAllAction->setEnabled( TRUE );
330 } else { 408 } else {
331 editAction->setEnabled( FALSE ); 409 editAction->setEnabled( FALSE );
332 deleteAction->setEnabled( FALSE ); 410 deleteAction->setEnabled( FALSE );
411 duplicateAction->setEnabled( FALSE );
412 deleteAllAction->setEnabled( FALSE );
333 } 413 }
334} 414}
335 415
@@ -358,22 +438,10 @@ void TodoWindow::setCategory( int c )
358void TodoWindow::populateCategories() 438void TodoWindow::populateCategories()
359{ 439{
360 catMenu->clear(); 440 catMenu->clear();
361
362 QList<QWidget> list;
363 list.append(table );
364 OFontMenu *menu = new OFontMenu(this, "menu",list );
365 menu->forceSize( table->horizontalHeader(), 10 );
366 catMenu->insertItem(tr("Fonts"), menu );
367
368 completedAction->addTo( catMenu );
369 completedAction->setOn( table->showCompleted() );
370 showdeadlineAction->addTo( catMenu );
371 showdeadlineAction->setOn( table->showDeadline() );
372 catMenu->insertSeparator();
373 int id, rememberId; 441 int id, rememberId;
374 id = 1; 442 id = 1;
375 catMenu->insertItem( tr( "All Categories" ), id++ ); 443 catMenu->insertItem( tr( "All Categories" ), id++ );
376// catMenu->insertSeparator(); 444 catMenu->insertSeparator();
377 QStringList categories = table->categories(); 445 QStringList categories = table->categories();
378 categories.append( tr( "Unfiled" ) ); 446 categories.append( tr( "Unfiled" ) );
379 for ( QStringList::Iterator it = categories.begin(); 447 for ( QStringList::Iterator it = categories.begin();