--- as_slot.cpp 2002/12/18 12:36:16 1.68
+++ as_slot.cpp 2002/12/18 14:50:58 1.69
@@ -127,7 +127,7 @@
// Add a row after selection and focus to the new row
if (Select.bottomRow() + 1 != m_pMaintable->numRows()) { // Add upwards
m_pMaintable->insertRows(Select.topRow(), nTotal);
- this->setDirty(); // Set data to dirty state
+ m_pMaintable->setDirty(); // Set data to dirty state
m_pMaintable->setCurrentCell(Select.topRow(), m_pMaintable->currentColumn());
// Update relevant data fields for all new rows
@@ -147,7 +147,7 @@
}
else { // Special case on last row add downwards
m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal);
- this->setDirty(); // Set data to dirty state
+ m_pMaintable->setDirty(); // Set data to dirty state
m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn());
m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please
@@ -199,11 +199,11 @@
if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) {
m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn());
m_pMaintable->removeRows(Rowselect);
- this->setDirty(); // Set data to dirty state
+ m_pMaintable->setDirty(); // Set data to dirty state
}
else { // Special case to handle removing of only row or last row
m_pMaintable->removeRows(Rowselect);
- this->setDirty(); // Set data to dirty state
+ m_pMaintable->setDirty(); // Set data to dirty state
}
// Update line numbers for this new row and all subsequent rows
@@ -227,7 +227,8 @@
nIter++;
}
- this->repaint(); // Do a general repaint of viewable area
+ m_pMaintable->repaintContents(true); // Do a general repaint of table
+ m_pStatbar->message(trUtf8("Refreshed display"), 4000); // Announce result
}
//
@@ -238,7 +239,7 @@
int nResult = 0;
// Check modification state of current data
- if (this->isDirty()) {
+ if (m_pMaintable->isDirty()) {
nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
@@ -269,7 +270,7 @@
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
this->updEdit(0, 0); // Reset edit controls
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
break;
case 1: // Second button selected, so don't save first but do new
m_pMaintable->setEnabled(true); // Enable the table first
@@ -286,7 +287,7 @@
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
this->updEdit(0, 0); // Reset edit controls
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
break;
case 2: // Third button selected, so don't do a new timesheet
default:
@@ -315,7 +316,7 @@
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
this->updEdit(0, 0); // Reset edit controls
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
}
}
@@ -330,7 +331,7 @@
if (!Filestring.isEmpty()) {
QFile Filetemp(Filestring); // File to load
// Check modification state of current data
- if (this->isDirty()) {
+ if (m_pMaintable->isDirty()) {
nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
@@ -361,7 +362,7 @@
m_pAmount->setEnabled(true);
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
- this->setDirty(false); // Set the clean state
+ m_pMaintable->setDirty(false); // Set the clean state
break;
case 1: // Don't save first but do load
m_szFilename->operator=(Filestring);
@@ -387,7 +388,7 @@
m_pAmount->setEnabled(true);
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
- this->setDirty(false); // Set the clean state
+ m_pMaintable->setDirty(false); // Set the clean state
break;
case 2: // Don't do a load timesheet
default:
@@ -418,7 +419,7 @@
m_pAmount->setEnabled(true);
m_pTasks->setEnabled(true);
m_pRemark->setEnabled(true);
- this->setDirty(false); // Set the clean state
+ m_pMaintable->setDirty(false); // Set the clean state
}
}
else
@@ -447,7 +448,7 @@
// Reset and give output to main window
this->setCaption(*m_szFilename);
m_pStatbar->message(trUtf8("File %1 saved").arg(*m_szFilename), 4000);
- this->setDirty(false); // Set the clean state to allow close
+ m_pMaintable->setDirty(false); // Set the clean state to allow close
}
//
@@ -491,7 +492,7 @@
int nResult = 0;
// Check modification state of current data
- if (this->isDirty()) {
+ if (m_pMaintable->isDirty()) {
nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE),
trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"),
trUtf8("&Discard"), trUtf8("Cancel"), 0, 2);
@@ -499,11 +500,11 @@
switch (nResult) {
case 0: // Save first
this->saveFile(); // Save changes first
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
pClosit->accept(); // then close timesheet
break;
case 1: // Don't save first but close
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
pClosit->accept(); // Close timesheet
break;
case 2: // Don't close
@@ -513,7 +514,7 @@
}
}
else { // Data is already up to date
- this->setDirty(false); // Reset data to clean state
+ m_pMaintable->setDirty(false); // Reset data to clean state
pClosit->accept();
}
}
@@ -654,9 +655,10 @@
//
// What to do if a data cell is modified
//
-void Titraqform::dataChanged(void)
+void Titraqform::dataChanged(int nRow, int nCol)
{
- setDirty(); // Mark this timesheet dirty, changes pending save
+ if (nCol != TITRAQ_IDXSTATUS && nCol != TITRAQ_IDXLINE)
+ m_pMaintable->setDirty(); // Mark this timesheet dirty, changes pending save
}
//
@@ -735,17 +737,16 @@
m_pMaintable->text(nRow, TITRAQ_IDXTASK).isEmpty())
{ // No K&R style to show where actual code begins
if (!Statis.startsWith(QString("E"))) { // Conditionally set pixmap to avoid overhead
- m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'E'));
+ m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'E'));
m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm));
}
}
else {
if (!Statis.startsWith(QString("O"))) { // Conditionally set pixmap to avoid overhead
- m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'O'));
+ m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'O'));
m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm));
}
}
- m_pStatbar->message(trUtf8("Refreshed display"), 4000); // Announce result
}
//
|