summaryrefslogtreecommitdiffstats
path: root/src/kile/quicktoolconfigwidget.ui.h
blob: c0ac55d91e1ea34f4a04698ba28809a7014bf128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** TQt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

void QuickToolConfigWidget::updateSequence(const TQString &sequence)
{
	TQStringList toollist = KileTool::toolList(TDEGlobal::config(), true);
	toollist.sort();
	m_cbTools->clear();
	m_cbTools->insertStringList(toollist);

	updateConfigs(m_cbTools->currentText());
	connect(m_cbTools, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(updateConfigs(const TQString& )));

	m_sequence=sequence;
	TQStringList list = TQStringList::split(",",sequence);
	TQString tl,cfg;
	m_lstbSeq->clear();
	for ( uint i=0; i < list.count(); ++i)
	{
		KileTool::extract(list[i], tl, cfg);
		if ( !cfg.isNull() )
			m_lstbSeq->insertItem(tl+" ("+cfg+")");
		else
			m_lstbSeq->insertItem(tl);
	}
}

void QuickToolConfigWidget::updateConfigs(const TQString &tool)
{
	m_cbConfigs->clear();
	m_cbConfigs->insertItem(i18n("Not Specified"));
	m_cbConfigs->insertStringList(KileTool::configNames(tool, TDEGlobal::config()));
}

void QuickToolConfigWidget::down()
{
	int current = m_lstbSeq->currentItem();
	if ( (current != -1) && (current < ( ((int)m_lstbSeq->count())-1) ))
	{
		TQString text = m_lstbSeq->text(current+1);
		m_lstbSeq->changeItem(m_lstbSeq->text(current), current+1);
		m_lstbSeq->changeItem(text, current);
		m_lstbSeq->setCurrentItem(current+1);
		changed();
	}
}

void QuickToolConfigWidget::up()
{
	int current = m_lstbSeq->currentItem();
	if ( (current != -1) && (current > 0) )
	{
		TQString text = m_lstbSeq->text(current-1);
		m_lstbSeq->changeItem(m_lstbSeq->text(current), current-1);
		m_lstbSeq->changeItem(text, current);
		m_lstbSeq->setCurrentItem(current-1);
		changed();
	}
}

void QuickToolConfigWidget::remove()
{
	int current = m_lstbSeq->currentItem();
	if ( current != -1)
	{
		m_lstbSeq->removeItem(current);
		changed();
	}
}

void QuickToolConfigWidget::add()
{
	TQString entry = m_cbTools->currentText();
	if ( m_cbConfigs->currentText() != i18n("Not Specified") )
		entry += " (" + m_cbConfigs->currentText() + ")";
	m_lstbSeq->insertItem(entry);
	changed();
}


void QuickToolConfigWidget::changed()
{
	TQString sequence, tool, cfg;
	for (uint i = 0; i < m_lstbSeq->count(); ++i)
	{
	    KileTool::extract(m_lstbSeq->text(i), tool, cfg);
	    sequence += KileTool::format(tool,cfg)+",";
	}
	if (sequence.endsWith(",") ) sequence = sequence.left(sequence.length()-1);
	m_sequence = sequence;
	emit sequenceChanged(m_sequence);
}