Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 4 |
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 ) : | |||
89 | "before you enter any data") ); | 89 | "before you enter any data") ); |
90 | else | 90 | else |
91 | table->load( str ); | 91 | table->load( str ); |
92 | } | 92 | } |
93 | 93 | ||
94 | // repeat for categories... | 94 | // repeat for categories... |
95 | str = categoriesXMLFilename(); | 95 | str = categoriesXMLFilename(); |
96 | if ( str.isNull() ) | 96 | if ( str.isNull() ) |
97 | QMessageBox::critical( this, | 97 | QMessageBox::critical( this, |
98 | tr( "Out of Space" ), | 98 | tr( "Out of Space" ), |
99 | tr( "Unable to create startup files\n" | 99 | tr( "Unable to create startup files\n" |
100 | "Free up some space\n" | 100 | "Free up some space\n" |
101 | "before you enter any data") ); | 101 | "before you enter any data") ); |
102 | 102 | ||
103 | setCentralWidget( table ); | 103 | setCentralWidget( table ); |
104 | setToolBarsMovable( FALSE ); | 104 | setToolBarsMovable( FALSE ); |
105 | 105 | ||
106 | // qDebug("after load: t=%d", t.elapsed() ); | 106 | // qDebug("after load: t=%d", t.elapsed() ); |
107 | 107 | ||
108 | Config config( "todo" ); | 108 | Config config( "todo" ); |
109 | config.setGroup( "View" ); | 109 | config.setGroup( "View" ); |
110 | bool complete = config.readBoolEntry( "ShowComplete", true ); | 110 | bool complete = config.readBoolEntry( "ShowComplete", true ); |
111 | table->setShowCompleted( complete ); | 111 | table->setShowCompleted( complete ); |
112 | 112 | ||
113 | /* added 20.01.2k2 by se */ | ||
114 | bool showdeadline = config.readBoolEntry("ShowDeadLine", true); | 113 | bool showdeadline = config.readBoolEntry("ShowDeadLine", true); |
115 | table->setShowDeadline (showdeadline); | 114 | table->setShowDeadline (showdeadline); |
116 | 115 | ||
117 | QString category = config.readEntry( "Category", QString::null ); | 116 | QString category = config.readEntry( "Category", QString::null ); |
118 | table->setShowCategory( category ); | 117 | table->setShowCategory( category ); |
119 | 118 | ||
120 | QPEToolBar *bar = new QPEToolBar( this ); | 119 | QPEToolBar *bar = new QPEToolBar( this ); |
121 | bar->setHorizontalStretchable( TRUE ); | 120 | bar->setHorizontalStretchable( TRUE ); |
122 | 121 | ||
123 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 122 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
124 | 123 | ||
125 | catMenu = new QPopupMenu( this ); | 124 | catMenu = new QPopupMenu( this ); |
126 | QPopupMenu *edit = new QPopupMenu( this ); | 125 | QPopupMenu *edit = new QPopupMenu( this ); |
127 | contextMenu = new QPopupMenu( this ); | 126 | contextMenu = new QPopupMenu( this ); |
128 | 127 | ||
129 | bar = new QPEToolBar( this ); | 128 | bar = new QPEToolBar( this ); |
130 | 129 | ||
131 | QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), | 130 | QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), |
132 | QString::null, 0, this, 0 ); | 131 | QString::null, 0, this, 0 ); |
133 | connect( a, SIGNAL( activated() ), | 132 | connect( a, SIGNAL( activated() ), |
134 | this, SLOT( slotNew() ) ); | 133 | this, SLOT( slotNew() ) ); |
135 | a->addTo( bar ); | 134 | a->addTo( bar ); |
136 | a->addTo( edit ); | 135 | a->addTo( edit ); |
137 | 136 | ||
@@ -160,49 +159,48 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
160 | QString::null, 0, this, 0 ); | 159 | QString::null, 0, this, 0 ); |
161 | connect( a, SIGNAL( activated() ), | 160 | connect( a, SIGNAL( activated() ), |
162 | this, SLOT( slotBeam() ) ); | 161 | this, SLOT( slotBeam() ) ); |
163 | a->addTo( edit ); | 162 | a->addTo( edit ); |
164 | a->addTo( bar ); | 163 | a->addTo( bar ); |
165 | } | 164 | } |
166 | 165 | ||
167 | a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ), | 166 | a = new QAction( tr( "Find" ), Resource::loadIconSet( "mag" ), |
168 | QString::null, 0, this, 0 ); | 167 | QString::null, 0, this, 0 ); |
169 | connect( a, SIGNAL( activated() ), | 168 | connect( a, SIGNAL( activated() ), |
170 | this, SLOT( slotFind() ) ); | 169 | this, SLOT( slotFind() ) ); |
171 | a->addTo( bar ); | 170 | a->addTo( bar ); |
172 | a->addTo( edit ); | 171 | a->addTo( edit ); |
173 | if ( table->numRows() ) | 172 | if ( table->numRows() ) |
174 | a->setEnabled( TRUE ); | 173 | a->setEnabled( TRUE ); |
175 | else | 174 | else |
176 | a->setEnabled( FALSE ); | 175 | a->setEnabled( FALSE ); |
177 | 176 | ||
178 | //a->setEnabled( FALSE ); | 177 | //a->setEnabled( FALSE ); |
179 | findAction = a; | 178 | findAction = a; |
180 | // qDebug("mainwindow #2: t=%d", t.elapsed() ); | 179 | // qDebug("mainwindow #2: t=%d", t.elapsed() ); |
181 | 180 | ||
182 | completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE ); | 181 | completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE ); |
183 | 182 | ||
184 | /* added 20.01.2k2 by se */ | ||
185 | showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE ); | 183 | showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE ); |
186 | 184 | ||
187 | catMenu->setCheckable( true ); | 185 | catMenu->setCheckable( true ); |
188 | populateCategories(); | 186 | populateCategories(); |
189 | 187 | ||
190 | mb->insertItem( tr( "Task" ), edit ); | 188 | mb->insertItem( tr( "Task" ), edit ); |
191 | mb->insertItem( tr( "View" ), catMenu ); | 189 | mb->insertItem( tr( "View" ), catMenu ); |
192 | 190 | ||
193 | resize( 200, 300 ); | 191 | resize( 200, 300 ); |
194 | if ( table->numRows() > 0 ) | 192 | if ( table->numRows() > 0 ) |
195 | currentEntryChanged( 0, 0 ); | 193 | currentEntryChanged( 0, 0 ); |
196 | connect( table, SIGNAL( signalEdit() ), | 194 | connect( table, SIGNAL( signalEdit() ), |
197 | this, SLOT( slotEdit() ) ); | 195 | this, SLOT( slotEdit() ) ); |
198 | connect( table, SIGNAL(signalShowMenu(const QPoint &)), | 196 | connect( table, SIGNAL(signalShowMenu(const QPoint &)), |
199 | this, SLOT( slotShowPopup(const QPoint &)) ); | 197 | this, SLOT( slotShowPopup(const QPoint &)) ); |
200 | 198 | ||
201 | // qDebug("mainwindow #3: t=%d", t.elapsed() ); | 199 | // qDebug("mainwindow #3: t=%d", t.elapsed() ); |
202 | table->updateVisible(); | 200 | table->updateVisible(); |
203 | table->setUpdatesEnabled( TRUE ); | 201 | table->setUpdatesEnabled( TRUE ); |
204 | table->setPaintingEnabled( TRUE ); | 202 | table->setPaintingEnabled( TRUE ); |
205 | table->viewport()->setUpdatesEnabled( TRUE ); | 203 | table->viewport()->setUpdatesEnabled( TRUE ); |
206 | 204 | ||
207 | connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); | 205 | connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); |
208 | connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) ); | 206 | connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) ); |
@@ -343,49 +341,49 @@ void TodoWindow::setCategory( int c ) | |||
343 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) | 341 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) |
344 | catMenu->setItemChecked( i, c == (int)i ); | 342 | catMenu->setItemChecked( i, c == (int)i ); |
345 | if ( c == 1 ) { | 343 | if ( c == 1 ) { |
346 | table->setShowCategory( QString::null ); | 344 | table->setShowCategory( QString::null ); |
347 | setCaption( tr("Todo") + " - " + tr( "All Categories" ) ); | 345 | setCaption( tr("Todo") + " - " + tr( "All Categories" ) ); |
348 | } else if ( c == (int)catMenu->count() - 1 ) { | 346 | } else if ( c == (int)catMenu->count() - 1 ) { |
349 | table->setShowCategory( tr( "Unfiled" ) ); | 347 | table->setShowCategory( tr( "Unfiled" ) ); |
350 | setCaption( tr("Todo") + " - " + tr( "Unfiled" ) ); | 348 | setCaption( tr("Todo") + " - " + tr( "Unfiled" ) ); |
351 | } else { | 349 | } else { |
352 | QString cat = table->categories()[c - 2]; | 350 | QString cat = table->categories()[c - 2]; |
353 | table->setShowCategory( cat ); | 351 | table->setShowCategory( cat ); |
354 | setCaption( tr("Todo") + " - " + cat ); | 352 | setCaption( tr("Todo") + " - " + cat ); |
355 | } | 353 | } |
356 | table->setPaintingEnabled( true ); | 354 | table->setPaintingEnabled( true ); |
357 | } | 355 | } |
358 | 356 | ||
359 | void TodoWindow::populateCategories() | 357 | void TodoWindow::populateCategories() |
360 | { | 358 | { |
361 | catMenu->clear(); | 359 | catMenu->clear(); |
362 | 360 | ||
363 | completedAction->addTo( catMenu ); | 361 | completedAction->addTo( catMenu ); |
364 | completedAction->setOn( table->showCompleted() ); | 362 | completedAction->setOn( table->showCompleted() ); |
365 | showdeadlineAction->addTo( catMenu ); | 363 | showdeadlineAction->addTo( catMenu ); |
366 | showdeadlineAction->setOn( table->showDeadline() ); | 364 | showdeadlineAction->setOn( table->showDeadline() ); |
367 | 365 | catMenu->insertSeparator(); | |
368 | int id, rememberId; | 366 | int id, rememberId; |
369 | id = 1; | 367 | id = 1; |
370 | catMenu->insertItem( tr( "All Categories" ), id++ ); | 368 | catMenu->insertItem( tr( "All Categories" ), id++ ); |
371 | // catMenu->insertSeparator(); | 369 | // catMenu->insertSeparator(); |
372 | QStringList categories = table->categories(); | 370 | QStringList categories = table->categories(); |
373 | categories.append( tr( "Unfiled" ) ); | 371 | categories.append( tr( "Unfiled" ) ); |
374 | for ( QStringList::Iterator it = categories.begin(); | 372 | for ( QStringList::Iterator it = categories.begin(); |
375 | it != categories.end(); ++it ) { | 373 | it != categories.end(); ++it ) { |
376 | catMenu->insertItem( *it, id ); | 374 | catMenu->insertItem( *it, id ); |
377 | if ( *it == table->showCategory() ) | 375 | if ( *it == table->showCategory() ) |
378 | rememberId = id; | 376 | rememberId = id; |
379 | ++id; | 377 | ++id; |
380 | } | 378 | } |
381 | if ( table->showCategory().isEmpty() ) | 379 | if ( table->showCategory().isEmpty() ) |
382 | setCategory( 1 ); | 380 | setCategory( 1 ); |
383 | else | 381 | else |
384 | setCategory( rememberId ); | 382 | setCategory( rememberId ); |
385 | } | 383 | } |
386 | 384 | ||
387 | void TodoWindow::reload() | 385 | void TodoWindow::reload() |
388 | { | 386 | { |
389 | table->clear(); | 387 | table->clear(); |
390 | table->load( todolistXMLFilename() ); | 388 | table->load( todolistXMLFilename() ); |
391 | syncing = FALSE; | 389 | syncing = FALSE; |