historywindow.cpp
changeset 377 5391ab620c95
child 381 c79df732d095
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/historywindow.cpp	Wed Sep 06 12:47:06 2006 +0000
     1.3 @@ -0,0 +1,46 @@
     1.4 +#include "historywindow.h"
     1.5 +
     1.6 +HistoryWindow::HistoryWindow (QWidget *parent):QDialog (parent)
     1.7 +{
     1.8 +	ui.setupUi (this);
     1.9 +	ui.historyTable->setRowCount (20);
    1.10 +	ui.historyTable->setColumnCount (3);
    1.11 +
    1.12 +	
    1.13 +	QTableWidgetItem *item;
    1.14 +
    1.15 +	item= new QTableWidgetItem(tr("Action"));
    1.16 +	ui.historyTable->setHorizontalHeaderItem(0, item);
    1.17 +	
    1.18 +	item= new QTableWidgetItem(tr("Comment"));
    1.19 +	ui.historyTable->setHorizontalHeaderItem(1, item);
    1.20 +	
    1.21 +	item= new QTableWidgetItem(tr("Undo action"));
    1.22 +	ui.historyTable->setHorizontalHeaderItem(2, item);
    1.23 +
    1.24 +	ui.historyTable->setSelectionBehavior (QAbstractItemView::SelectRows);
    1.25 +}
    1.26 +
    1.27 +
    1.28 +void HistoryWindow::update(SimpleSettings &set)
    1.29 +{
    1.30 +	//int rows=set.readNumEntry("/history/undosTotal");
    1.31 +	//ui.historyTable->setRowCount (rows);
    1.32 +
    1.33 +	int i;
    1.34 +	for (i=0;i<= set.readNumEntry("/history/undosAvail",0); i++)
    1.35 +	{
    1.36 +		QTableWidgetItem *item;
    1.37 +
    1.38 +		item= new QTableWidgetItem(set.readEntry(QString("/history/step-%1/redoCommand").arg(i)));
    1.39 +		ui.historyTable->setItem(i, 0, item);
    1.40 +
    1.41 +		item= new QTableWidgetItem(set.readEntry(QString("/history/step-%1/comment").arg(i)));
    1.42 +		ui.historyTable->setItem(i, 1, item);
    1.43 +
    1.44 +		item=new QTableWidgetItem(set.readEntry(QString("/history/step-%1/undoCommand").arg(i)));
    1.45 +		ui.historyTable->setItem(i, 2, item);
    1.46 +	}
    1.47 +
    1.48 +	ui.historyTable->resizeColumnsToContents();
    1.49 +}