[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bcalligra/kexi-mobile-adam=5Fpigg=5D_kexi/plugins/au?=
From: Adam Pigg <adam () piggz ! co ! uk>
Date: 2011-02-28 23:18:13
Message-ID: 20110228231813.BE1F4A60CE () git ! kde ! org
[Download RAW message or body]
Git commit bcf9ae0e3d17f999a1a6716bd71f28f77a4ef85c by Adam Pigg.
Committed on 01/03/2011 at 00:13.
Pushed by piggz into branch 'kexi-mobile-adam_pigg'.
Implemented record navigation in auto forms
M +4 -4 kexi/plugins/autoforms/KexiAutoFormView.cpp
M +32 -1 kexi/plugins/autoforms/widgets/AutoForm.cpp
M +7 -2 kexi/plugins/autoforms/widgets/AutoForm.h
http://commits.kde.org/calligra/bcf9ae0e3d17f999a1a6716bd71f28f77a4ef85c
diff --git a/kexi/plugins/autoforms/KexiAutoFormView.cpp \
b/kexi/plugins/autoforms/KexiAutoFormView.cpp index f770465..e634e85 100644
--- a/kexi/plugins/autoforms/KexiAutoFormView.cpp
+++ b/kexi/plugins/autoforms/KexiAutoFormView.cpp
@@ -94,22 +94,22 @@ void KexiAutoFormView::addNewRecordRequested()
void KexiAutoFormView::moveToFirstRecordRequested()
{
-
+ m_autoForm->selectFirstRow();
}
void KexiAutoFormView::moveToNextRecordRequested()
{
-
+ m_autoForm->selectNextRow();
}
void KexiAutoFormView::moveToPreviousRecordRequested()
{
-
+ m_autoForm->selectPrevRow();
}
void KexiAutoFormView::moveToLastRecordRequested()
{
-
+ m_autoForm->selectLastRow();
}
void KexiAutoFormView::moveToRecordRequested(uint r)
diff --git a/kexi/plugins/autoforms/widgets/AutoForm.cpp \
b/kexi/plugins/autoforms/widgets/AutoForm.cpp index 644dad9..187e8ae 100644
--- a/kexi/plugins/autoforms/widgets/AutoForm.cpp
+++ b/kexi/plugins/autoforms/widgets/AutoForm.cpp
@@ -22,8 +22,9 @@
#include <QGridLayout>
#include "AutoLineEdit.h"
#include <kexidb/cursor.h>
+#include <kexidb/RecordData.h>
-AutoForm::AutoForm(QWidget* parent, KexiRecordNavigator *nav): QWidget(parent)
+AutoForm::AutoForm(QWidget* parent, KexiRecordNavigator *nav): QWidget(parent), \
m_previousRecord(0) {
setBackgroundRole(QPalette::Window);
m_layout = new QGridLayout(this);
@@ -182,6 +183,36 @@ void AutoForm::setLocalSortingOrder(int col, int order)
}
+void AutoForm::selectCellInternal()
+{
+ //m_currentItem is already set by \
KexiDataAwareObjectInterface::setCursorPosition() + if (m_currentItem) {
+ if (m_currentItem != m_previousRecord) {
+ fillDataItems(*m_currentItem, cursorAtNewRow());
+ m_previousRecord = m_currentItem;
+
+//!@todo needed?
+#if 0
+ QWidget *w = 0;
+ if (m_curCol >= 0 && m_curCol < \
dbFormWidget()->orderedDataAwareWidgets()->count()) { + w = \
dbFormWidget()->orderedDataAwareWidgets()->at(m_curCol); + }
+ if (w) {
+ w->setFocus(); // re-focus, as we could have lost focus, e.g. when \
navigator button was clicked + // select all
+ KexiFormDataItemInterface *iface = \
dynamic_cast<KexiFormDataItemInterface*>(w); + //! @todo add option \
for not selecting the field + if (iface) {
+ iface->selectAllOnFocusIfNeeded();
+ }
+ }
+#endif
+ }
+ } else {
+ m_previousRecord = 0;
+ }
+}
+
void AutoForm::sortedColumnChanged(int col)
{
diff --git a/kexi/plugins/autoforms/widgets/AutoForm.h \
b/kexi/plugins/autoforms/widgets/AutoForm.h index 75f5203..238af30 100644
--- a/kexi/plugins/autoforms/widgets/AutoForm.h
+++ b/kexi/plugins/autoforms/widgets/AutoForm.h
@@ -28,6 +28,10 @@
class QGridLayout;
+namespace KexiDB {
+ class RecordDate;
+}
+
class AutoForm : public QWidget,
public KexiDataAwareObjectInterface,
public KexiFormDataProvider
@@ -39,8 +43,6 @@ public:
AutoForm(QWidget* parent, KexiRecordNavigator *nav);
virtual ~AutoForm();
- void initDataSource();
-
protected:
virtual void resizeEvent(QResizeEvent* );
@@ -71,6 +73,7 @@ protected:
virtual void rowEditTerminated(int row);
virtual int rowsPerPage() const;
virtual void setLocalSortingOrder(int col, int order);
+ virtual void selectCellInternal();
virtual void sortedColumnChanged(int col);
virtual void updateCell(int row, int col);
virtual void updateCurrentCell();
@@ -86,6 +89,8 @@ private:
QGridLayout *m_layout;
QList<AutoWidget*> m_widgets;
+ KexiDB::RecordData *m_previousRecord;
+
void buildForm();
void layoutForm();
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic