Great. Thanx, looks great. Especially the viewport->setFocus is great. I've been having trouble with this ever since the beginning. I've applied the patch for the 1.1.4 release due in two weeks. I'm trying to keep development releases coming about once every two weeks.

/Mauritz
GlobeCom AB

Selcuk Ozturk wrote:
Here are the diff and the icons. 

The 'viewport()->setFocus();' in the MousePressEvent is just to overcome
an annoyance I was having. The only way I could transfer the focus
from the 'table name' list to the 'data' table seemed to be double
clicking (which also starts editing of course) a table cell. Looking
at the Qt code, I think that's probably only a problem when you single
click the already current cell. In any case this simple addition made
it better for me.

Selcuk



On Wed, 24 Oct 2001, Henrik Johnson wrote:

I diff would be great.

/Mauritz
GlobeCom AB

Selcuk Ozturk wrote:

Hi,

I made a few additions to the
toResultContentEditor class to make data editing
and entry more convenient in the schema browser.

I added 4 buttons to the 'data' tab:

One to add a
record. As far as I could see the only way to add
a record needs going to the end of the data table
and edit the last empty row there. This is time
consuming and possibly memory exhausting in very
large tables. With this button a new empty row is
inserted at the current position for data entry.

One to go to the last record.

One to save the edit changes.

One to cancel the edit mode without saving.

Would you be interested in these and if so what's
your prefered method of delivery; diff, etc?

Take care,
Selcuk

PS: Thanks for Tora. It's a very useful tool.



---
Selcuk Ozturk

eMediaMillWorks, Inc.



Index: toresultcontent.cpp
===================================================================
RCS file: /cvsroot/tora/tora/toresultcontent.cpp,v
retrieving revision 1.45
diff -r1.45 toresultcontent.cpp
61a62,65
#include "icons/addrecord.xpm"
#include "icons/saverecord.xpm"
#include "icons/lastrecord.xpm"
#include "icons/canceledit.xpm"
99a104
  viewport()->setFocus();
181a187
  NewRecordRow = -1;
279a286,342
void toResultContentEditor::gotoLastRecord()
{
editReadAll();
setNumRows(Row+1);
setCurrentCell(Row-1,0);
}

void toResultContentEditor::addRecord()
{
saveUnsaved();

if(currentRow() > numRows()-3) {
setCurrentCell(numRows()-1,0);
} else {
setNumRows(numRows()+1);
int crow=currentRow();
if(crow < 0 || crow > numRows()-2)
crow = 0;
for (int row=numRows()-1;row>crow;row--)
swapRows(row,row-1);

for (int i=0;i<numCols();i++)
setText(crow,i,"");

NewRecordRow = crow;
setNumRows(numRows());
setCurrentCell(crow,0);
}
}

void toResultContentEditor::cancelEdit()
{

if(CurrentRow < 0 && NewRecordRow < 0)
return;

int crow=CurrentRow;
int col=0;
for(std::list<QString>::iterator j=OrigValues.begin();j!=OrigValues.end();j++,col++) setText(CurrentRow,col,*j);
CurrentRow=-1;
OrigValues.clear();

endEdit(currentRow(),currentColumn(),false,false);

if(NewRecordRow > -1) {
NewRecordRow = -1;
crow=currentRow();
for (int row=crow+1;row<numRows();row++)
swapRows(row-1,row);
}

setNumRows(Row+1);
setCurrentCell(crow,0);
toStatusMessage("Edit cancelled",true);
}

339c402,403
< if (CurrentRow>=Row) {
---
    if (CurrentRow>=Row || CurrentRow == NewRecordRow) {
NewRecordRow = -1;
641a706,721
  new QToolButton(QPixmap((const char **)addrecord_xpm),
"Add a new record",
"Add a new record",
Editor,SLOT(addRecord()),toolbar);
new QToolButton(QPixmap((const char **)lastrecord_xpm),
"Go to last row",
"Go to last row",
Editor,SLOT(gotoLastRecord()),toolbar);
new QToolButton(QPixmap((const char **)saverecord_xpm),
"Save changes",
"Save changes",
Editor,SLOT(saveUnsaved()),toolbar);
new QToolButton(QPixmap((const char **)canceledit_xpm),
"Discard changes",
"Discard changes",
Editor,SLOT(cancelEdit()),toolbar);
Index: toresultcontent.h
===================================================================
RCS file: /cvsroot/tora/tora/toresultcontent.h,v
retrieving revision 1.24
diff -r1.24 toresultcontent.h
76a77,79
  /** Current row of editing.
*/
int NewRecordRow;
125c128
< */
---
  */
220a224,232
  /** Add a new record to the table.
*/
virtual void addRecord(void);
/** Discard the changes made to the table.
*/
virtual void cancelEdit(void);
/** Goto the last record in the table.
*/
virtual void gotoLastRecord(void);