Changeset View
Changeset View
Standalone View
Standalone View
src/ActionClasses.cpp
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Line(s) | |||||
234 | } | 234 | } | ||
235 | 235 | | |||
236 | void ToggleAction::setChecked( bool b ) | 236 | void ToggleAction::setChecked( bool b ) | ||
237 | { | 237 | { | ||
238 | const bool announce = b != isChecked(); | 238 | const bool announce = b != isChecked(); | ||
239 | 239 | | |||
240 | m_function( b ); | 240 | m_function( b ); | ||
241 | KToggleAction::setChecked( b ); | 241 | KToggleAction::setChecked( b ); | ||
242 | AmarokConfig::self()->writeConfig(); //So we don't lose the setting when crashing | 242 | AmarokConfig::self()->save(); //So we don't lose the setting when crashing | ||
243 | if( announce ) emit toggled( b ); //KToggleAction doesn't do this for us. How gay! | 243 | if( announce ) emit toggled( b ); //KToggleAction doesn't do this for us. How gay! | ||
244 | } | 244 | } | ||
245 | 245 | | |||
246 | void ToggleAction::setEnabled( bool b ) | 246 | void ToggleAction::setEnabled( bool b ) | ||
247 | { | 247 | { | ||
248 | const bool announce = b != isEnabled(); | 248 | const bool announce = b != isEnabled(); | ||
249 | 249 | | |||
250 | KToggleAction::setEnabled( b ); | 250 | KToggleAction::setEnabled( b ); | ||
251 | AmarokConfig::self()->writeConfig(); //So we don't lose the setting when crashing | 251 | AmarokConfig::self()->save(); //So we don't lose the setting when crashing | ||
252 | if( announce ) emit QAction::triggered( b ); | 252 | if( announce ) emit QAction::triggered( b ); | ||
253 | } | 253 | } | ||
254 | 254 | | |||
255 | ////////////////////////////////////////////////////////////////////////////////////////// | 255 | ////////////////////////////////////////////////////////////////////////////////////////// | ||
256 | // SelectAction | 256 | // SelectAction | ||
257 | ////////////////////////////////////////////////////////////////////////////////////////// | 257 | ////////////////////////////////////////////////////////////////////////////////////////// | ||
258 | 258 | | |||
259 | SelectAction::SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent ) | 259 | SelectAction::SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent ) | ||
260 | : KSelectAction( parent ) | 260 | : KSelectAction( parent ) | ||
261 | , m_function( f ) | 261 | , m_function( f ) | ||
262 | { | 262 | { | ||
263 | PERF_LOG( "In SelectAction" ); | 263 | PERF_LOG( "In SelectAction" ); | ||
264 | setText(text); | 264 | setText(text); | ||
265 | ac->addAction(name, this); | 265 | ac->addAction(name, this); | ||
266 | } | 266 | } | ||
267 | 267 | | |||
268 | void SelectAction::setCurrentItem( int n ) | 268 | void SelectAction::setCurrentItem( int n ) | ||
269 | { | 269 | { | ||
270 | const bool announce = n != currentItem(); | 270 | const bool announce = n != currentItem(); | ||
271 | 271 | | |||
272 | debug() << "setCurrentItem: " << n; | 272 | debug() << "setCurrentItem: " << n; | ||
273 | 273 | | |||
274 | m_function( n ); | 274 | m_function( n ); | ||
275 | KSelectAction::setCurrentItem( n ); | 275 | KSelectAction::setCurrentItem( n ); | ||
276 | AmarokConfig::self()->writeConfig(); //So we don't lose the setting when crashing | 276 | AmarokConfig::self()->save(); //So we don't lose the setting when crashing | ||
277 | if( announce ) emit triggered( n ); | 277 | if( announce ) emit triggered( n ); | ||
278 | } | 278 | } | ||
279 | 279 | | |||
280 | void SelectAction::actionTriggered( QAction *a ) | 280 | void SelectAction::actionTriggered( QAction *a ) | ||
281 | { | 281 | { | ||
282 | m_function( currentItem() ); | 282 | m_function( currentItem() ); | ||
283 | AmarokConfig::self()->writeConfig(); | 283 | AmarokConfig::self()->save(); | ||
284 | KSelectAction::actionTriggered( a ); | 284 | KSelectAction::actionTriggered( a ); | ||
285 | } | 285 | } | ||
286 | 286 | | |||
287 | void SelectAction::setEnabled( bool b ) | 287 | void SelectAction::setEnabled( bool b ) | ||
288 | { | 288 | { | ||
289 | const bool announce = b != isEnabled(); | 289 | const bool announce = b != isEnabled(); | ||
290 | 290 | | |||
291 | KSelectAction::setEnabled( b ); | 291 | KSelectAction::setEnabled( b ); | ||
292 | AmarokConfig::self()->writeConfig(); //So we don't lose the setting when crashing | 292 | AmarokConfig::self()->save(); //So we don't lose the setting when crashing | ||
293 | if( announce ) emit QAction::triggered( b ); | 293 | if( announce ) emit QAction::triggered( b ); | ||
294 | } | 294 | } | ||
295 | 295 | | |||
296 | void SelectAction::setIcons( QStringList icons ) | 296 | void SelectAction::setIcons( QStringList icons ) | ||
297 | { | 297 | { | ||
298 | m_icons = icons; | 298 | m_icons = icons; | ||
299 | foreach( QAction *a, selectableActionGroup()->actions() ) | 299 | foreach( QAction *a, selectableActionGroup()->actions() ) | ||
300 | { | 300 | { | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 355 | { | |||
357 | ac->addAction("burn_menu", this); | 357 | ac->addAction("burn_menu", this); | ||
358 | } | 358 | } | ||
359 | 359 | | |||
360 | QWidget* | 360 | QWidget* | ||
361 | BurnMenuAction::createWidget( QWidget *w ) | 361 | BurnMenuAction::createWidget( QWidget *w ) | ||
362 | { | 362 | { | ||
363 | KToolBar *bar = dynamic_cast<KToolBar*>(w); | 363 | KToolBar *bar = dynamic_cast<KToolBar*>(w); | ||
364 | 364 | | |||
365 | if( bar && KAuthorized::authorizeKAction( objectName() ) ) | 365 | if( bar && KAuthorized::authorizeAction( objectName() ) ) | ||
366 | { | 366 | { | ||
367 | //const int id = QAction::getToolButtonID(); | 367 | //const int id = QAction::getToolButtonID(); | ||
368 | 368 | | |||
369 | //addContainer( bar, id ); | 369 | //addContainer( bar, id ); | ||
370 | w->addAction( this ); | 370 | w->addAction( this ); | ||
371 | //connect( bar, &KToolBar::destroyed, this, &BurnMenuAction::slotDestroyed ); | 371 | //connect( bar, &KToolBar::destroyed, this, &BurnMenuAction::slotDestroyed ); | ||
372 | 372 | | |||
373 | //bar->insertButton( QString::null, id, true, i18n( "Burn" ), index ); | 373 | //bar->insertButton( QString::null, id, true, i18n( "Burn" ), index ); | ||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |