-rw-r--r-- | libopie2/opiepim/ui/opimmainwindow.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp index bdf20a9..f22a302 100644 --- a/libopie2/opiepim/ui/opimmainwindow.cpp +++ b/libopie2/opiepim/ui/opimmainwindow.cpp | |||
@@ -185,64 +185,65 @@ int OPimMainWindow::service() { | |||
185 | } | 185 | } |
186 | 186 | ||
187 | void OPimMainWindow::doAlarm( const QDateTime&, int ) { | 187 | void OPimMainWindow::doAlarm( const QDateTime&, int ) { |
188 | 188 | ||
189 | } | 189 | } |
190 | 190 | ||
191 | void OPimMainWindow::startAlarm(int count ) { | 191 | void OPimMainWindow::startAlarm(int count ) { |
192 | m_alarmCount = count; | 192 | m_alarmCount = count; |
193 | m_playedCount = 0; | 193 | m_playedCount = 0; |
194 | Sound::soundAlarm(); | 194 | Sound::soundAlarm(); |
195 | m_timerId = startTimer( 5000 ); | 195 | m_timerId = startTimer( 5000 ); |
196 | } | 196 | } |
197 | 197 | ||
198 | void OPimMainWindow::killAlarm() { | 198 | void OPimMainWindow::killAlarm() { |
199 | killTimer( m_timerId ); | 199 | killTimer( m_timerId ); |
200 | } | 200 | } |
201 | 201 | ||
202 | void OPimMainWindow::timerEvent( QTimerEvent* e) { | 202 | void OPimMainWindow::timerEvent( QTimerEvent* e) { |
203 | if ( m_playedCount <m_alarmCount ) { | 203 | if ( m_playedCount <m_alarmCount ) { |
204 | m_playedCount++; | 204 | m_playedCount++; |
205 | Sound::soundAlarm(); | 205 | Sound::soundAlarm(); |
206 | }else { | 206 | }else { |
207 | killTimer( e->timerId() ); | 207 | killTimer( e->timerId() ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | QPopupMenu *OPimMainWindow::itemContextMenu() { | 211 | QPopupMenu *OPimMainWindow::itemContextMenu() { |
212 | if ( !m_itemContextMenu ) { | 212 | if ( !m_itemContextMenu ) { |
213 | // Create context menu if hasn't been done before | 213 | // Create context menu if hasn't been done before |
214 | m_itemContextMenu = new QPopupMenu( this ); | 214 | m_itemContextMenu = new QPopupMenu( this ); |
215 | m_itemEditAction->addTo( m_itemContextMenu ); | 215 | m_itemEditAction->addTo( m_itemContextMenu ); |
216 | m_itemDuplicateAction->addTo( m_itemContextMenu ); | 216 | m_itemDuplicateAction->addTo( m_itemContextMenu ); |
217 | m_itemBeamAction->addTo( m_itemContextMenu ); | ||
217 | m_itemDeleteAction->addTo( m_itemContextMenu ); | 218 | m_itemDeleteAction->addTo( m_itemContextMenu ); |
218 | } | 219 | } |
219 | 220 | ||
220 | return m_itemContextMenu; | 221 | return m_itemContextMenu; |
221 | } | 222 | } |
222 | 223 | ||
223 | void OPimMainWindow::insertItemMenuItems( QActionGroup *items ) { | 224 | void OPimMainWindow::insertItemMenuItems( QActionGroup *items ) { |
224 | // Insert menu items into Item menu | 225 | // Insert menu items into Item menu |
225 | if ( items ) { | 226 | if ( items ) { |
226 | // Rebuild Item menu | 227 | // Rebuild Item menu |
227 | m_itemMenu->clear(); | 228 | m_itemMenu->clear(); |
228 | m_itemMenuGroup1->addTo( m_itemMenu ); | 229 | m_itemMenuGroup1->addTo( m_itemMenu ); |
229 | m_itemMenu->insertSeparator(); | 230 | m_itemMenu->insertSeparator(); |
230 | items->addTo( m_itemMenu ); | 231 | items->addTo( m_itemMenu ); |
231 | m_itemMenu->insertSeparator(); | 232 | m_itemMenu->insertSeparator(); |
232 | m_itemMenuGroup2->addTo( m_itemMenu ); | 233 | m_itemMenuGroup2->addTo( m_itemMenu ); |
233 | } | 234 | } |
234 | } | 235 | } |
235 | 236 | ||
236 | void OPimMainWindow::insertViewMenuItems( QActionGroup *items ) { | 237 | void OPimMainWindow::insertViewMenuItems( QActionGroup *items ) { |
237 | // Insert menu items into View menu | 238 | // Insert menu items into View menu |
238 | if ( items ) { | 239 | if ( items ) { |
239 | // Rebuild Item menu | 240 | // Rebuild Item menu |
240 | m_viewMenu->clear(); | 241 | m_viewMenu->clear(); |
241 | m_viewMenuGroup->addTo( m_viewMenu ); | 242 | m_viewMenuGroup->addTo( m_viewMenu ); |
242 | m_viewMenu->insertSeparator(); | 243 | m_viewMenu->insertSeparator(); |
243 | m_viewMenuAppGroup = items; | 244 | m_viewMenuAppGroup = items; |
244 | m_viewMenuAppGroup->addTo( m_viewMenu ); | 245 | m_viewMenuAppGroup->addTo( m_viewMenu ); |
245 | } | 246 | } |
246 | } | 247 | } |
247 | 248 | ||
248 | void OPimMainWindow::setViewCategory( const QString &category ) { | 249 | void OPimMainWindow::setViewCategory( const QString &category ) { |
@@ -314,78 +315,78 @@ void OPimMainWindow::initBars( const QString &itemName ) { | |||
314 | QToolBar *toolbar = new QToolBar( this ); | 315 | QToolBar *toolbar = new QToolBar( this ); |
315 | 316 | ||
316 | // Create sub-menus | 317 | // Create sub-menus |
317 | m_itemMenu = new QPopupMenu( this ); | 318 | m_itemMenu = new QPopupMenu( this ); |
318 | m_itemMenu->setCheckable( true ); | 319 | m_itemMenu->setCheckable( true ); |
319 | menubar->insertItem( itemName, m_itemMenu ); | 320 | menubar->insertItem( itemName, m_itemMenu ); |
320 | m_viewMenu = new QPopupMenu( this ); | 321 | m_viewMenu = new QPopupMenu( this ); |
321 | m_viewMenu->setCheckable( true ); | 322 | m_viewMenu->setCheckable( true ); |
322 | menubar->insertItem( tr( "View" ), m_viewMenu ); | 323 | menubar->insertItem( tr( "View" ), m_viewMenu ); |
323 | 324 | ||
324 | m_viewMenuAppGroup = 0l; | 325 | m_viewMenuAppGroup = 0l; |
325 | 326 | ||
326 | // Item menu | 327 | // Item menu |
327 | m_itemMenuGroup1 = new QActionGroup( this, QString::null, false ); | 328 | m_itemMenuGroup1 = new QActionGroup( this, QString::null, false ); |
328 | 329 | ||
329 | m_itemNewAction = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 330 | m_itemNewAction = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), |
330 | QString::null, 0, m_itemMenuGroup1, 0 ); | 331 | QString::null, 0, m_itemMenuGroup1, 0 ); |
331 | connect( m_itemNewAction, SIGNAL(activated()), this, SLOT(slotItemNew()) ); | 332 | connect( m_itemNewAction, SIGNAL(activated()), this, SLOT(slotItemNew()) ); |
332 | m_itemNewAction->setWhatsThis( tr( "Click here to create a new item." ) ); | 333 | m_itemNewAction->setWhatsThis( tr( "Click here to create a new item." ) ); |
333 | m_itemNewAction->addTo( toolbar ); | 334 | m_itemNewAction->addTo( toolbar ); |
334 | 335 | ||
335 | m_itemEditAction = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), | 336 | m_itemEditAction = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), |
336 | QString::null, 0, m_itemMenuGroup1, 0 ); | 337 | QString::null, 0, m_itemMenuGroup1, 0 ); |
337 | connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) ); | 338 | connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) ); |
338 | m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) ); | 339 | m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) ); |
339 | m_itemEditAction->addTo( toolbar ); | 340 | m_itemEditAction->addTo( toolbar ); |
340 | 341 | ||
341 | m_itemDuplicateAction = new QAction( tr( "Duplicate" ), Resource::loadPixmap( "copy" ), | 342 | m_itemDuplicateAction = new QAction( tr( "Duplicate" ), Resource::loadPixmap( "copy" ), |
342 | QString::null, 0, m_itemMenuGroup1, 0 ); | 343 | QString::null, 0, m_itemMenuGroup1, 0 ); |
343 | connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) ); | 344 | connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) ); |
344 | m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) ); | 345 | m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) ); |
345 | 346 | ||
346 | m_itemDeleteAction = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), | ||
347 | QString::null, 0, m_itemMenuGroup1, 0 ); | ||
348 | connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) ); | ||
349 | m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) ); | ||
350 | m_itemDeleteAction->addTo( toolbar ); | ||
351 | |||
352 | if ( Ir::supported() ) { | 347 | if ( Ir::supported() ) { |
353 | m_itemBeamAction = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 348 | m_itemBeamAction = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), |
354 | QString::null, 0, m_itemMenuGroup1, 0 ); | 349 | QString::null, 0, m_itemMenuGroup1, 0 ); |
355 | connect( m_itemBeamAction, SIGNAL(activated()), this, SLOT(slotItemBeam()) ); | 350 | connect( m_itemBeamAction, SIGNAL(activated()), this, SLOT(slotItemBeam()) ); |
356 | m_itemBeamAction->setWhatsThis( tr( "Click here to transmit the selected item." ) ); | 351 | m_itemBeamAction->setWhatsThis( tr( "Click here to transmit the selected item." ) ); |
357 | m_itemBeamAction->addTo( toolbar ); | 352 | m_itemBeamAction->addTo( toolbar ); |
358 | } | 353 | } |
359 | 354 | ||
355 | m_itemDeleteAction = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), | ||
356 | QString::null, 0, m_itemMenuGroup1, 0 ); | ||
357 | connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) ); | ||
358 | m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) ); | ||
359 | m_itemDeleteAction->addTo( toolbar ); | ||
360 | |||
360 | m_itemMenuGroup1->addTo( m_itemMenu ); | 361 | m_itemMenuGroup1->addTo( m_itemMenu ); |
361 | 362 | ||
362 | m_itemMenu->insertSeparator(); | 363 | m_itemMenu->insertSeparator(); |
363 | 364 | ||
364 | m_itemMenuGroup2 = new QActionGroup( this, QString::null, false ); | 365 | m_itemMenuGroup2 = new QActionGroup( this, QString::null, false ); |
365 | 366 | ||
366 | // a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), | 367 | // a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), |
367 | // QString::null, 0, m_itemMenuGroup2, 0 ); | 368 | // QString::null, 0, m_itemMenuGroup2, 0 ); |
368 | // connect( a, SIGNAL(activated()), this, SLOT(slotItemFind()) ); | 369 | // connect( a, SIGNAL(activated()), this, SLOT(slotItemFind()) ); |
369 | // a->setWhatsThis( tr( "Click here to search for an item." ) ); | 370 | // a->setWhatsThis( tr( "Click here to search for an item." ) ); |
370 | // a->addTo( toolbar ); | 371 | // a->addTo( toolbar ); |
371 | 372 | ||
372 | m_configureAction = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), | 373 | m_configureAction = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), |
373 | QString::null, 0, m_itemMenuGroup2, 0 ); | 374 | QString::null, 0, m_itemMenuGroup2, 0 ); |
374 | connect( m_configureAction, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 375 | connect( m_configureAction, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
375 | m_configureAction->setWhatsThis( tr( "Click here to set your preferences for this application." ) ); | 376 | m_configureAction->setWhatsThis( tr( "Click here to set your preferences for this application." ) ); |
376 | 377 | ||
377 | m_itemMenuGroup2->addTo( m_itemMenu ); | 378 | m_itemMenuGroup2->addTo( m_itemMenu ); |
378 | 379 | ||
379 | // View menu | 380 | // View menu |
380 | m_viewMenuGroup = new QActionGroup( this, QString::null, false ); | 381 | m_viewMenuGroup = new QActionGroup( this, QString::null, false ); |
381 | 382 | ||
382 | QAction *a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 ); | 383 | QAction *a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 ); |
383 | connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) ); | 384 | connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) ); |
384 | a->setWhatsThis( tr( "Click here to filter the items displayed." ) ); | 385 | a->setWhatsThis( tr( "Click here to filter the items displayed." ) ); |
385 | 386 | ||
386 | a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 ); | 387 | a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 ); |
387 | connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) ); | 388 | connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) ); |
388 | a->setWhatsThis( tr( "Click here to modify the current filter settings." ) ); | 389 | a->setWhatsThis( tr( "Click here to modify the current filter settings." ) ); |
389 | 390 | ||
390 | // Create view toolbar | 391 | // Create view toolbar |
391 | toolbar = new QToolBar( this ); | 392 | toolbar = new QToolBar( this ); |