Exemplo n.º 1
0
	void ToolConfig::removeTool()
	{
// 		KILE_DEBUG_MAIN << "==ToolConfig::removeTool()=====================";
		if(KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove the tool %1?", m_current)) == KMessageBox::Continue) {
			QStringList cfgs = KileTool::configNames(m_current, m_config);
// 			KILE_DEBUG_MAIN << "cfgs " <<  cfgs.join(", ");
			for(int i = 0; i < cfgs.count(); ++i) {
// 				KILE_DEBUG_MAIN << "group " << KileTool::groupFor(m_current, cfgs[i]);
				m_config->deleteGroup(KileTool::groupFor(m_current, cfgs[i]));
			}
			m_config->group("Tools").deleteEntry(m_current);
			m_config->group("ToolsGUI").deleteEntry(m_current);
			m_config->sync();

			int index = m_configWidget->m_lstbTools->currentRow() - 1;
			if(index < 0) {
				index = 0;
			}
			QString tool = m_configWidget->m_lstbTools->item(index)->text();
// 			KILE_DEBUG_MAIN << "tool is " << tool;
			m_configWidget->m_lstbTools->blockSignals(true);
			updateToollist();
			m_configWidget->m_lstbTools->setCurrentRow(index);
			switchTo(tool, false);
			m_configWidget->m_lstbTools->blockSignals(false);
		}
	}
Exemplo n.º 2
0
	void ToolConfig::writeDefaults()
	{
		if (KMessageBox::warningContinueCancel(this, i18n("All your tool settings will be overwritten with the default settings, are you sure you want to continue?")) == KMessageBox::Continue) {
			QStringList groups = m_config->groupList();
			QRegExp re = QRegExp("Tool/(.+)/.+");
			for(int i = 0; i < groups.count(); ++i) {
				if (re.exactMatch(groups[i])) {
					m_config->deleteGroup(groups[i]);
				}
			}
			// magic names, defined in kilestdtools.rc
			m_config->deleteGroup("ToolsGUI");
			m_config->deleteGroup("Tools");

			m_manager->factory()->readStandardToolConfig();
			m_config->sync();
			updateToollist();
  			QStringList tools = KileTool::toolList(m_config, true);
			for (int i = 0; i < tools.count(); ++i) {
				switchTo(tools[i], false);// needed to retrieve the new map
 				switchTo(tools[i],true); // this writes the newly retrieved entry map (and not an perhaps changed old one)
			}
			int index = indexQuickBuild();
			if(!tools.empty()) {
				switchTo(tools[index], false);
				m_configWidget->m_lstbTools->item(index)->setSelected(true);
			}
		}
	}
Exemplo n.º 3
0
	void ToolConfig::newTool()
	{
		//KILE_DEBUG_MAIN << "==ToolConfig::newTool()=====================";
		NewToolWizard *ntw = new NewToolWizard(this);
		if (ntw->exec()) {
			QString toolName = ntw->toolName();
			QString parentTool = ntw->parentTool();

			writeStdConfig(toolName, "Default");
			if(parentTool != ntw->customTool()) {
				//copy tool info
				KileTool::Config tempMap;
				m_manager->retrieveEntryMap(parentTool, tempMap, false, false);
				KConfigGroup toolGroup = m_config->group(KileTool::groupFor(toolName, "Default"));
				toolGroup.writeEntry("class", tempMap["class"]);
				toolGroup.writeEntry("type", tempMap["type"]);
				toolGroup.writeEntry("state", tempMap["state"]);
				toolGroup.writeEntry("close", tempMap["close"]);
				toolGroup.writeEntry("checkForRoot", tempMap["checkForRoot"]);
				toolGroup.writeEntry("autoRun", tempMap["autoRun"]);
				toolGroup.writeEntry("jumpToFirstError", tempMap["jumpToFirstError"]);
			}

			m_configWidget->m_lstbTools->blockSignals(true);
			updateToollist();
			switchTo(toolName);
			for(int i = 0; i < m_configWidget->m_lstbTools->count(); ++i) {
				if(m_configWidget->m_lstbTools->item(i)->text() == toolName) {
					m_configWidget->m_lstbTools->setCurrentRow(i);
					break;
				}
			}
			m_configWidget->m_lstbTools->blockSignals(false);
		}
	}
Exemplo n.º 4
0
void ToolConfig::removeTool()
{
    //KILE_DEBUG() << "==ToolConfig::removeTool()=====================" << endl;
    if ( KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove the tool %1?").arg(m_current)) == KMessageBox::Continue )
    {
        KConfig *config = m_config;
        QStringList cfgs = KileTool::configNames(m_current, config);
        for ( uint i = 0; i < cfgs.count(); ++i)
        {
            config->deleteGroup(KileTool::groupFor(m_current, cfgs[i]));
        }
        config->setGroup("Tools");
        config->deleteEntry(m_current);
        int index = m_configWidget->m_lstbTools->currentItem()-1;
        if ( index < 0 ) index=0;
        QString tool = m_configWidget->m_lstbTools->text(index);
        m_configWidget->m_lstbTools->blockSignals(true);
        updateToollist();
        m_configWidget->m_lstbTools->setCurrentItem(index);
        switchTo(tool, false);
        m_configWidget->m_lstbTools->blockSignals(false);
    }
}