ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
    SettingsPageBase(parent),
    m_tabs()
{
    QVBoxLayout* topLayout = new QVBoxLayout(this);
    topLayout->setMargin(0);
    topLayout->setSpacing(KDialog::spacingHint());

    KTabWidget* tabWidget = new KTabWidget(this);

    // Initialize 'Icons' tab
    ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
    tabWidget->addTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
    connect(iconsTab, SIGNAL(changed()), this, SIGNAL(changed()));

    // Initialize 'Compact' tab
    ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
    tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact"));
    connect(compactTab, SIGNAL(changed()), this, SIGNAL(changed()));

    // Initialize 'Details' tab
    ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
    tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details"));
    connect(detailsTab, SIGNAL(changed()), this, SIGNAL(changed()));

    m_tabs.append(iconsTab);
    m_tabs.append(compactTab);
    m_tabs.append(detailsTab);

    topLayout->addWidget(tabWidget, 0, 0);
}
/**
 * Sets up the documentation group.
 * @param margin  The margin of the group.
 */
void ClassifierListPage::setupDocumentationGroup(int margin)
{
    m_pDocGB = new QGroupBox(i18n("Documentation"), this);
    QVBoxLayout* docLayout = new QVBoxLayout(m_pDocGB);
    docLayout->setSpacing(10);
    docLayout->setMargin(margin);
    if (m_itemType == ot_Operation) {
        m_pDocTE = new KTextEdit();
        m_pCodeTE = new CodeTextEdit();
        KTabWidget* tabWidget = new KTabWidget();
        tabWidget->addTab(m_pDocTE, i18n("Comment"));
        tabWidget->addTab(m_pCodeTE, i18n("Source Code"));
        docLayout->addWidget(tabWidget);
    }
    else {
        m_pDocTE = new KTextEdit();
        docLayout->addWidget(m_pDocTE);
    }
}
Exemple #3
0
void KPluginSelectionWidget::embeddPluginKCMs(KPluginInfo *plugininfo, bool checked)
{
    // if we have Services for the plugin we should be able to
    // create KCM(s)
    QApplication::setOverrideCursor(Qt::WaitCursor);
    if(plugininfo->kcmServices().size() > 1)
    {
        // we need a tabwidget
        KTabWidget *tabwidget = new KTabWidget(d->widgetstack);
        tabwidget->setEnabled(checked);

        int id = d->widgetstack->addWidget(tabwidget);
        d->kps->configPage(id);
        d->widgetIDs[plugininfo->pluginName()] = id;

        for(QValueList< KService::Ptr >::ConstIterator it = plugininfo->kcmServices().begin(); it != plugininfo->kcmServices().end(); ++it)
        {
            if(!(*it)->noDisplay())
            {
                KCModuleInfo moduleinfo(*it);
                QWidget *module = insertKCM(tabwidget, moduleinfo);
                tabwidget->addTab(module, moduleinfo.moduleName());
            }
        }
    }
    else
    {
        if(!plugininfo->kcmServices().front()->noDisplay())
        {
            KCModuleInfo moduleinfo(plugininfo->kcmServices().front());
            QWidget *module = insertKCM(d->widgetstack, moduleinfo);
            module->setEnabled(checked);

            int id = d->widgetstack->addWidget(module);
            d->kps->configPage(id);
            d->widgetIDs[plugininfo->pluginName()] = id;
        }
    }
    QApplication::restoreOverrideCursor();
}