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

List:       kde-commits
Subject:    [okteta] kasten/controllers/view/structures: structures: fix validation not working
From:       Alex Richardson <arichardson.kde () googlemail ! com>
Date:       2013-06-30 20:57:51
Message-ID: E1UtOgx-0004kc-Rj () scm ! kde ! org
[Download RAW message or body]

Git commit 76394c3aa77454bd9d53f60b7f4982c00848afbe by Alex Richardson.
Committed on 21/03/2013 at 13:42.
Pushed by arichardson into branch 'master'.

structures: fix validation not working

M  +2    -2    kasten/controllers/view/structures/script/scripthandler.cpp
M  +2    -3    kasten/controllers/view/structures/structview.cpp

http://commits.kde.org/okteta/76394c3aa77454bd9d53f60b7f4982c00848afbe

diff --git a/kasten/controllers/view/structures/script/scripthandler.cpp \
b/kasten/controllers/view/structures/script/scripthandler.cpp index 5a11100..8b5a5ff \
                100644
--- a/kasten/controllers/view/structures/script/scripthandler.cpp
+++ b/kasten/controllers/view/structures/script/scripthandler.cpp
@@ -60,7 +60,7 @@ void ScriptHandler::validateData(DataInformation* data)
 
     //check if has a validation function:
     QScriptValue validationFunc = data->validationFunc();
-    if (!validationFunc.isValid())
+    if (validationFunc.isValid())
     {
 #ifdef OKTETA_DEBUG_SCRIPT
         mDebugger->attachTo(mEngine.data());
@@ -94,8 +94,8 @@ void ScriptHandler::validateData(DataInformation* data)
             if (!str.isEmpty())
                 data->setValidationError(str);
         }
+        data->mHasBeenValidated = true;
     }
-    data->mHasBeenValidated = true;
 }
 
 void ScriptHandler::updateDataInformation(DataInformation* data)
diff --git a/kasten/controllers/view/structures/structview.cpp \
b/kasten/controllers/view/structures/structview.cpp index 5184bf7..7b1b9c5 100644
--- a/kasten/controllers/view/structures/structview.cpp
+++ b/kasten/controllers/view/structures/structview.cpp
@@ -72,8 +72,7 @@ StructView::StructView(StructTool* tool, QWidget* parent) :
     mStructTreeView->setItemsExpandable(true);
     mStructTreeView->setUniformRowHeights(true);
     mStructTreeView->setAllColumnsShowFocus(true);
-    mStructTreeView->setEditTriggers(QAbstractItemView::DoubleClicked
-            | QAbstractItemView::EditKeyPressed);
+    mStructTreeView->setEditTriggers(QAbstractItemView::DoubleClicked | \
QAbstractItemView::EditKeyPressed);  mStructTreeView->setItemDelegate(mDelegate);
     mStructTreeView->setDragEnabled(false);
     mStructTreeView->setSortingEnabled(false);
@@ -289,7 +288,7 @@ void \
StructView::onByteArrayModelChanged(Okteta::AbstractByteArrayModel* model)  \
                QModelIndex current = mStructTreeView->currentIndex();
     mLockStructureButton->setEnabled(mTool->canStructureBeLocked(current));
     setLockButtonState(mTool->isStructureLocked(current));
-    mValidateButton->setEnabled(validModel && current.isValid());
+    mValidateButton->setEnabled(validModel);
 }
 
 }


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

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