File indexing completed on 2024-05-05 04:51:38
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 "k3bpluginoptiontab.h" 0008 0009 #include "k3bpluginmanager.h" 0010 #include "k3bplugin.h" 0011 #include "k3bcore.h" 0012 0013 #include <KLocalizedString> 0014 #include <KPluginWidget> 0015 0016 #include <QDebug> 0017 #include <QHash> 0018 #include <QList> 0019 #include <QLabel> 0020 #include <QVBoxLayout> 0021 0022 0023 0024 0025 K3b::PluginOptionTab::PluginOptionTab( QWidget* parent ) 0026 : QWidget( parent ) 0027 { 0028 QVBoxLayout* layout = new QVBoxLayout( this ); 0029 layout->setContentsMargins( 0, 0, 0, 0 ); 0030 0031 QLabel* label = new QLabel( i18n( "<p>Here all <em>K3b Plugins</em> may be configured. Be aware that this does not include the " 0032 "<em>KPart Plugins</em> which embed themselves in the K3b menu structure.</p>" ), this ); 0033 label->setWordWrap( true ); 0034 0035 KPluginWidget * pluginSelector = new KPluginWidget( this ); 0036 0037 layout->addWidget( label ); 0038 layout->addWidget( pluginSelector ); 0039 0040 // find all categories 0041 QHash<QString, QString> categoryNames; 0042 0043 foreach( Plugin* plugin, k3bcore->pluginManager()->plugins() ) { 0044 categoryNames[ plugin->category() ] = plugin->categoryName(); 0045 } 0046 0047 // add all plugins in each category 0048 foreach( const QString &category, categoryNames.keys() ) { 0049 QVector<KPluginMetaData> plugins; 0050 0051 foreach( Plugin* plugin, k3bcore->pluginManager()->plugins( category ) ) { 0052 plugins << plugin->pluginMetaData(); 0053 qDebug() << "Adding plugin" << plugin->pluginMetaData().pluginId(); 0054 } 0055 pluginSelector->addPlugins( plugins, categoryNames[ category ] ); 0056 } 0057 } 0058 0059 0060 K3b::PluginOptionTab::~PluginOptionTab() 0061 { 0062 } 0063 0064 #include "moc_k3bpluginoptiontab.cpp"