Changeset View
Changeset View
Standalone View
Standalone View
src/TrayIcon.cpp
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Line(s) | 266 | { | |||
---|---|---|---|---|---|
284 | 284 | | |||
285 | contextMenu()->removeAction( m_separator.data() ); | 285 | contextMenu()->removeAction( m_separator.data() ); | ||
286 | 286 | | |||
287 | delete m_separator.data(); | 287 | delete m_separator.data(); | ||
288 | 288 | | |||
289 | if( m_track ) | 289 | if( m_track ) | ||
290 | { | 290 | { | ||
291 | foreach( QAction *action, The::globalCurrentTrackActions()->actions() ) | 291 | foreach( QAction *action, The::globalCurrentTrackActions()->actions() ) | ||
292 | { | ||||
292 | m_extraActions.append( action ); | 293 | m_extraActions.append( action ); | ||
294 | connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); | ||||
295 | } | ||||
293 | 296 | | |||
294 | QScopedPointer<Capabilities::ActionsCapability> ac( m_track->create<Capabilities::ActionsCapability>() ); | 297 | QScopedPointer<Capabilities::ActionsCapability> ac( m_track->create<Capabilities::ActionsCapability>() ); | ||
295 | if( ac ) | 298 | if( ac ) | ||
296 | { | 299 | { | ||
297 | QList<QAction*> actions = ac->actions(); | 300 | QList<QAction*> actions = ac->actions(); | ||
298 | foreach( QAction *action, actions ) | 301 | foreach( QAction *action, actions ) | ||
302 | { | ||||
299 | m_extraActions.append( action ); | 303 | m_extraActions.append( action ); | ||
304 | connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); | ||||
305 | } | ||||
300 | } | 306 | } | ||
301 | 307 | | |||
302 | QScopedPointer<Capabilities::BookmarkThisCapability> btc( m_track->create<Capabilities::BookmarkThisCapability>() ); | 308 | QScopedPointer<Capabilities::BookmarkThisCapability> btc( m_track->create<Capabilities::BookmarkThisCapability>() ); | ||
303 | if( btc ) | 309 | if( btc ) | ||
304 | { | 310 | { | ||
305 | m_extraActions.append( btc->bookmarkAction() ); | 311 | QAction *action = btc->bookmarkAction(); | ||
312 | m_extraActions.append( action ); | ||||
313 | connect( action, &QObject::destroyed, this, [this, action]() { m_extraActions.removeAll( action ); } ); | ||||
306 | } | 314 | } | ||
307 | } | 315 | } | ||
308 | 316 | | |||
309 | // second statement checks if the menu has already been populated (first startup), if not: do it | 317 | // second statement checks if the menu has already been populated (first startup), if not: do it | ||
310 | if( m_extraActions.count() > 0 || | 318 | if( m_extraActions.count() > 0 || | ||
311 | contextMenu()->actions().last() != actionByName.value( "file_quit" ) ) | 319 | contextMenu()->actions().last() != actionByName.value( "file_quit" ) ) | ||
312 | { | 320 | { | ||
313 | // remove the 2 bottom items, so we can push them to the bottom again | 321 | // remove the 2 bottom items, so we can push them to the bottom again | ||
Show All 24 Lines |