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

List:       kde-commits
Subject:    KDE/kdeedu/kvoctrain/kvoctrain
From:       Frederik Gladhorn <frederik.gladhorn () gmx ! de>
Date:       2007-03-11 21:13:00
Message-ID: 1173647580.014649.31957.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 641578 by gladhorn:

Setting lessons in query using the checkboxes was off by one.

 M  +13 -9     kvtlessonmodel.cpp  
 M  +2 -2      kvtlessonmodel.h  


--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvtlessonmodel.cpp #641577:641578
@@ -93,7 +93,7 @@
 
   /** checkboxes */
   if (role == Qt::CheckStateRole) {
-    if (m_doc->lessonsInQuery().contains(index.row()))
+    if (m_doc->lessonsInQuery().contains(index.row()+1))
       return Qt::Checked;
     else
       return Qt::Unchecked;
@@ -130,14 +130,16 @@
   /** checkboxes */
   if (role == Qt::CheckStateRole) {
     QList<int> intLessons;
-
     foreach(int lesson, m_doc->lessonsInQuery())
       intLessons.append(lesson);
-    if (intLessons.contains(index.row())){
-      intLessons.removeAt(intLessons.indexOf(index.row()));
+      
+    kDebug() << "hi - checkboxes: " << intLessons << " -- curind: " << index.row()+1 << endl;
+
+    if (intLessons.contains(index.row()+1)){
+      intLessons.removeAt(intLessons.indexOf(index.row()+1));
     } else {
         if (value.toInt() == Qt::Checked)
-          intLessons.append(index.row());
+          intLessons.append(index.row()+1);
     }
 
     m_doc->setLessonsInQuery(intLessons);
@@ -149,12 +151,13 @@
 
 
 /**
- * NOT IMPLEMENTED - add a new lesson.
+ * Eventually adding new lessons could go here. For now it's in kvtlessonview.
  * @param position
  * @param rows
  * @param parent
  * @return
  */
+ /*
 bool KVTLessonModel::insertRows(int position, int rows, const QModelIndex &parent)
 {
   Q_UNUSED(parent);
@@ -168,15 +171,16 @@
   endInsertRows();
   return true;
 }
+*/
 
-
 /**
- * NOT IMPLEMENTED - Delete a lesson
+ * 
  * @param position
  * @param rows
  * @param parent
  * @return
  */
+ /*
 bool KVTLessonModel::removeRows(int position, int rows, const QModelIndex &parent)
 {
   Q_UNUSED(parent);
@@ -190,8 +194,8 @@
   endRemoveRows();
   return true;
 }
+*/
 
-
 /**
  * propagete the change of current lesson
  * @param start
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvtlessonmodel.h #641577:641578
@@ -48,8 +48,8 @@
   // completely replace the old stuff
   bool newData(const QStringList &strings);
 
-  bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
-  bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
+//  bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
+//  bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
 
 private:
   /** The data file */
[prev in list] [next in list] [prev in thread] [next in thread] 

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