[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi/tableview
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2004-06-18 13:14:29
Message-ID: 20040618131429.F25CA98EA () office ! kde ! org
[Download RAW message or body]

CVS commit by staniek: 

KexiTableView

- Editor's focus position is updated (moved down) 
  when new row is inserted above current row


  M +11 -2     kexitableview.cpp   1.148
  M +9 -8      kexitableview.h   1.71


--- koffice/kexi/tableview/kexitableview.cpp  #1.147:1.148
@@ -608,12 +608,13 @@ void KexiTableView::deleteCurrentRow()
 }
 
-void KexiTableView::insertEmptyRow(int row)
+KexiTableItem *KexiTableView::insertEmptyRow(int row)
 {
         if ( !acceptRowEdit() || !isEmptyRowInsertingEnabled() 
                 || (row!=-1 && row >= (rows()+isInsertingEnabled()?1:0) ) )
-                return;
+                return 0;
 
         KexiTableItem *newItem = new KexiTableItem(columns());
         insertItem(newItem, row);
+        return newItem;
 }
 
@@ -626,4 +627,7 @@ void KexiTableView::insertItem(KexiTable
                 d->curRow = row;
         }
+        else if (d->curRow >= row) {
+                d->curRow++;
+        }
         m_data->insertRow(*newItem, row);
 
@@ -642,4 +646,9 @@ void KexiTableView::insertItem(KexiTable
         //update navigator's data
         setNavRowCount(rows());
+
+        if (d->curRow >= row) {
+                //update
+                editorShowFocus( d->curRow, d->curCol );
+        }
 }
 

--- koffice/kexi/tableview/kexitableview.h  #1.70:1.71
@@ -342,4 +342,11 @@ public:
         static void initCellEditorFactories();
 
+        /*! Deletes \a item. Used by deleteCurrentRow(). Calls beforeDeleteItem() before deleting, 
+         to double-check if deleting is allowed. \return true on success. */
+        bool deleteItem(KexiTableItem *item);//, bool moveCursor=true);
+
+        /*! Inserts newItem at \a row. -1 means current row. Used by insertEmptyRow(). */
+        void insertItem(KexiTableItem *newItem, int row = -1);
+
 public slots:
         //! Sets sorting on column \a col, or (when \a col == -1) sets rows unsorted
@@ -417,6 +424,7 @@ public slots:
          -inserting flag is disabled (see isInsertingEnabled())
          -read-only flag is set (see isReadOnly())
+         \ return inserted row's data
         */
-        void insertEmptyRow(int row = -1);
+        KexiTableItem *insertEmptyRow(int row = -1);
 
         //! used when Return key is pressed on cell or "+" nav. button is clicked
@@ -634,11 +642,4 @@ protected:
                 int colfirst, int collast, int maxwc);
 
-        /*! Deletes \a item. Used by deleteCurrentRow(). Calls beforeDeleteItem() before deleting, 
-         to double-check if deleting is allowed. \return true on success. */
-        bool deleteItem(KexiTableItem *item);//, bool moveCursor=true);
-
-        /*! Inserts newItem at \a row. -1 means current row. Used by insertEmptyRow(). */
-        void insertItem(KexiTableItem *newItem, int row = -1);
-
         /*! For reimplementation: called by deleteItem(). If returns false, deleting is aborted.
          Default implementation just returns true. */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic