Exemplo n.º 1
0
void ToolConfig::switchTo(const QString & tool, bool save /* = true */)
{
    //KILE_DEBUG() << "==ToolConfig::switchTo(const QString & tool, bool save /* = true */)====================" << endl;
    //save config
    if (save)
    {
        writeConfig();

        //update the config number
        QString cf = m_configWidget->m_cbConfig->currentText();
        KileTool::setConfigName(m_current, cf, m_config);
    }

    m_current = tool;

    m_map.clear();
    if (!m_manager->retrieveEntryMap(m_current, m_map, false, false))
        kdWarning() << "no entrymap" << endl;

    updateConfiglist();
    updateGeneral();
    updateAdvanced();

    //show GUI info
    m_configWidget->m_cbMenu->setCurrentText(KileTool::menuFor(m_current, m_config));
    m_icon=KileTool::iconFor(m_current, m_config);
    if ( m_icon.isEmpty() )
        m_configWidget->m_pshbIcon->setPixmap(QString::null);
    else
        m_configWidget->m_pshbIcon->setPixmap(SmallIcon(m_icon));
}
Exemplo n.º 2
0
void ToolConfig::removeConfig()
{
    //KILE_DEBUG() << "==ToolConfig::removeConfig()=====================" << endl;
    writeConfig();
    if ( m_configWidget->m_cbConfig->count() > 1)
    {
        if ( KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove this configuration?") ) == KMessageBox::Continue )
        {
            m_config->deleteGroup(KileTool::groupFor(m_current, m_configWidget->m_cbConfig->currentText()));
            updateConfiglist();
            KileTool::setConfigName(m_current, m_configWidget->m_cbConfig->text(0), m_config);
            switchTo(m_current, false);
        }
    }
    else
        KMessageBox::error(this, i18n("You need at least one configuration for each tool."), i18n("Cannot Remove Configuration"));
}
Exemplo n.º 3
0
	void ToolConfig::switchTo(const QString & tool, bool save /* = true */)
	{
		//KILE_DEBUG_MAIN << "==ToolConfig::switchTo(const QString & tool, bool save /* = true */)====================";
		//save config
		if(save) {
			writeConfig();

			//update the config number
			QString cf = m_configWidget->m_cbConfig->currentText();
			KileTool::setConfigName(m_current, cf, m_config);
		}

		m_current = tool;

		m_map.clear();
		if (!m_manager->retrieveEntryMap(m_current, m_map, false, false)) {
			qWarning() << "no entrymap";
		}

		updateConfiglist();
		updateGeneral();
		updateAdvanced();

		//show GUI info
		QString menu = KileTool::menuFor(m_current, m_config);
		int i = m_configWidget->m_cbMenu->findData(menu);
		if(i >= 0) {
			m_configWidget->m_cbMenu->setCurrentIndex(i);
		}
		else {
			m_configWidget->m_cbMenu->addItem(menu, QVariant(menu));
			m_configWidget->m_cbMenu->setCurrentIndex(m_configWidget->m_cbMenu->count() - 1);
		}
		m_icon = KileTool::iconFor(m_current, m_config);
		if(m_icon.isEmpty()) {
			m_configWidget->m_pshbIcon->setIcon(QIcon::fromTheme(QString()));
		}
		else {
			m_configWidget->m_pshbIcon->setIcon(QIcon::fromTheme(m_icon));
		}
	}
Exemplo n.º 4
0
	void ToolConfig::removeConfig()
	{
		//KILE_DEBUG_MAIN << "==ToolConfig::removeConfig()=====================";
		writeConfig();
		if ( m_configWidget->m_cbConfig->count() > 1) {
			if(KMessageBox::warningContinueCancel(this, i18n("Are you sure that you want to remove this configuration?") )
			   == KMessageBox::Continue) {
				m_config->deleteGroup(KileTool::groupFor(m_current, m_configWidget->m_cbConfig->currentText()));
				int currentIndex = m_configWidget->m_cbConfig->currentIndex();
				int newIndex = 0;
				if(currentIndex == 0 )
					newIndex = 1;
				KileTool::setConfigName(m_current, m_configWidget->m_cbConfig->itemText(newIndex), m_config);
				m_config->reparseConfiguration(); // FIXME should be not needed
				updateConfiglist();
				switchTo(m_current, false);
			}
		}
		else {
			KMessageBox::error(this, i18n("You need at least one configuration for each tool."), i18n("Cannot Remove Configuration"));
		}
	}