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.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 33f13aa..a34bcf2 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -89,49 +89,48 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
"before you enter any data") );
else
table->load( str );
}
// repeat for categories...
str = categoriesXMLFilename();
if ( str.isNull() )
QMessageBox::critical( this,
tr( "Out of Space" ),
tr( "Unable to create startup files\n"
"Free up some space\n"
"before you enter any data") );
setCentralWidget( table );
setToolBarsMovable( FALSE );
// qDebug("after load: t=%d", t.elapsed() );
Config config( "todo" );
config.setGroup( "View" );
bool complete = config.readBoolEntry( "ShowComplete", true );
table->setShowCompleted( complete );
- /* added 20.01.2k2 by se */
bool showdeadline = config.readBoolEntry("ShowDeadLine", true);
table->setShowDeadline (showdeadline);
QString category = config.readEntry( "Category", QString::null );
table->setShowCategory( category );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mb = new QPEMenuBar( bar );
catMenu = new QPopupMenu( this );
QPopupMenu *edit = new QPopupMenu( this );
contextMenu = new QPopupMenu( this );
bar = new QPEToolBar( this );
QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ),
this, SLOT( slotNew() ) );
a->addTo( bar );
a->addTo( edit );
@@ -160,49 +159,48 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ),
this, SLOT( slotBeam() ) );
a->addTo( edit );
a->addTo( bar );
}
a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ),
this, SLOT( slotFind() ) );
a->addTo( bar );
a->addTo( edit );
if ( table->numRows() )
a->setEnabled( TRUE );
else
a->setEnabled( FALSE );
//a->setEnabled( FALSE );
findAction = a;
// qDebug("mainwindow #2: t=%d", t.elapsed() );
completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE );
- /* added 20.01.2k2 by se */
showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE );
catMenu->setCheckable( true );
populateCategories();
mb->insertItem( tr( "Task" ), edit );
mb->insertItem( tr( "View" ), catMenu );
resize( 200, 300 );
if ( table->numRows() > 0 )
currentEntryChanged( 0, 0 );
connect( table, SIGNAL( signalEdit() ),
this, SLOT( slotEdit() ) );
connect( table, SIGNAL(signalShowMenu(const QPoint &)),
this, SLOT( slotShowPopup(const QPoint &)) );
// qDebug("mainwindow #3: t=%d", t.elapsed() );
table->updateVisible();
table->setUpdatesEnabled( TRUE );
table->setPaintingEnabled( TRUE );
table->viewport()->setUpdatesEnabled( TRUE );
connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) );
connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) );
@@ -343,49 +341,49 @@ void TodoWindow::setCategory( int c )
for ( unsigned int i = 1; i < catMenu->count(); i++ )
catMenu->setItemChecked( i, c == (int)i );
if ( c == 1 ) {
table->setShowCategory( QString::null );
setCaption( tr("Todo") + " - " + tr( "All Categories" ) );
} else if ( c == (int)catMenu->count() - 1 ) {
table->setShowCategory( tr( "Unfiled" ) );
setCaption( tr("Todo") + " - " + tr( "Unfiled" ) );
} else {
QString cat = table->categories()[c - 2];
table->setShowCategory( cat );
setCaption( tr("Todo") + " - " + cat );
}
table->setPaintingEnabled( true );
}
void TodoWindow::populateCategories()
{
catMenu->clear();
completedAction->addTo( catMenu );
completedAction->setOn( table->showCompleted() );
showdeadlineAction->addTo( catMenu );
showdeadlineAction->setOn( table->showDeadline() );
-
+ catMenu->insertSeparator();
int id, rememberId;
id = 1;
catMenu->insertItem( tr( "All Categories" ), id++ );
// catMenu->insertSeparator();
QStringList categories = table->categories();
categories.append( tr( "Unfiled" ) );
for ( QStringList::Iterator it = categories.begin();
it != categories.end(); ++it ) {
catMenu->insertItem( *it, id );
if ( *it == table->showCategory() )
rememberId = id;
++id;
}
if ( table->showCategory().isEmpty() )
setCategory( 1 );
else
setCategory( rememberId );
}
void TodoWindow::reload()
{
table->clear();
table->load( todolistXMLFilename() );
syncing = FALSE;