Commit 1c3884a7 authored by David Redondo's avatar David Redondo 🏎

Use defaults of KColorSchemeManager in ColorSchemeChooser

Use default icon and text and since 5.67 it also includes a default theme option
parent 120fb3e0
......@@ -42,40 +42,12 @@ ColorSchemeChooser::ColorSchemeChooser( QWidget* parent )
{
auto manager = new KColorSchemeManager( parent );
const auto scheme( currentSchemeName() );
auto selectionMenu = manager->createSchemeSelectionMenu( scheme, this );
manager->activateScheme(manager->indexForScheme(scheme));
auto selectionMenu = manager->createSchemeSelectionMenu(this);
setMenu( selectionMenu->menu() );
menu()->setIcon( QIcon::fromTheme( QStringLiteral( "preferences-desktop-color" ) ) );
menu()->setTitle( i18n( "&Color Theme" ) );
setIcon( menu()->icon() );
setText( menu()->title() );
}
QString ColorSchemeChooser::currentDesktopDefaultScheme() const
{
KSharedConfigPtr config = KSharedConfig::openConfig( QLatin1String( "kdeglobals" ) );
KConfigGroup group( config, "General" );
return group.readEntry( "ColorScheme", QStringLiteral( "Breeze" ) );
}
QString ColorSchemeChooser::currentSchemeName() const
{
if ( !menu() )
{
return currentDesktopDefaultScheme();
}
QAction* const action = menu()->activeAction();
if ( action )
{
return KLocalizedString::removeAcceleratorMarker( action->text() );
}
return currentDesktopDefaultScheme();
}
} // namespace Oxygen
......@@ -39,11 +39,6 @@ class ColorSchemeChooser : public QPushButton
Q_OBJECT
public:
explicit ColorSchemeChooser( QWidget* parent );
QString currentSchemeName() const;
private:
QString currentDesktopDefaultScheme() const;
};
} // namespace Oxygen
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment