File indexing completed on 2024-05-05 04:51:37

0001 /*
0002     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "k3bcddboptiontab.h"
0008 
0009 #include <KCModule>
0010 #include <KLocalizedString>
0011 #include <KPluginFactory>
0012 
0013 #include <QLabel>
0014 #include <QHBoxLayout>
0015 
0016 
0017 K3b::CddbOptionTab::CddbOptionTab( QWidget* parent )
0018     : QWidget( parent )
0019 {
0020     QHBoxLayout* layout = new QHBoxLayout( this );
0021     layout->setContentsMargins( 0, 0, 0, 0 );
0022 
0023     m_cddbKcm = 0;
0024 
0025     const auto result = KPluginFactory::instantiatePlugin<KCModule>(KPluginMetaData(QStringLiteral("plasma/kcms/systemsettings_qwidgets/kcm_cddb")), this);
0026 
0027     if (result) {
0028         m_cddbKcm = result.plugin;
0029 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0030         m_cddbKcm->layout()->setContentsMargins( 0, 0, 0, 0 );
0031         layout->addWidget( m_cddbKcm );
0032 #else
0033         m_cddbKcm->widget()->layout()->setContentsMargins( 0, 0, 0, 0 );
0034         layout->addWidget( m_cddbKcm->widget() );
0035 #endif
0036     } else {
0037         QLabel* label = new QLabel( i18n( "Unable to load KCDDB configuration module." ), this );
0038         label->setAlignment( Qt::AlignCenter );
0039         layout->addWidget( label );
0040     }
0041 }
0042 
0043 
0044 K3b::CddbOptionTab::~CddbOptionTab()
0045 {
0046 }
0047 
0048 
0049 void K3b::CddbOptionTab::readSettings()
0050 {
0051     if ( m_cddbKcm ) {
0052         m_cddbKcm->load();
0053     }
0054 }
0055 
0056 
0057 void K3b::CddbOptionTab::apply()
0058 {
0059     if ( m_cddbKcm ) {
0060         m_cddbKcm->save();
0061     }
0062 }
0063 
0064 #include "moc_k3bcddboptiontab.cpp"