Git commit ae2a42aac2118438e66844c0cfb027af18176728 by Jaroslaw Staniek. Committed on 31/08/2011 at 23:38. Pushed by staniek into branch 'master'. AutoForm plugin migrated to the newest KexiDataAwareObjectInterface API M +44 -14 kexi/plugins/autoforms/widgets/AutoForm.h M +6 -65 kexi/plugins/autoforms/widgets/AutoForm.cpp http://commits.kde.org/calligra/ae2a42aac2118438e66844c0cfb027af18176728 diff --git a/kexi/plugins/autoforms/widgets/AutoForm.cpp b/kexi/plugins/autoforms/widgets/AutoForm.cpp index 700e1fe..6604fd0 100644 --- a/kexi/plugins/autoforms/widgets/AutoForm.cpp +++ b/kexi/plugins/autoforms/widgets/AutoForm.cpp @@ -1,6 +1,6 @@ -/* - +/* This file is part of the KDE project Copyright (C) 2011 Adam Pigg + Copyright (C) 2011 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -50,11 +50,6 @@ void AutoForm::addHeaderColumn(const QString& caption, const QString& descriptio } -void AutoForm::cellSelected(int col, int row) -{ - -} - void AutoForm::clearColumnsInternal(bool repaint) { @@ -70,19 +65,14 @@ void AutoForm::createEditor(int row, int col, const QString& addText, bool remov } -void AutoForm::currentItemDeleteRequest() -{ - -} - int AutoForm::currentLocalSortColumn() const { -return 0; + return 0; } int AutoForm::currentLocalSortingOrder() const { -return 0; + return 0; } void AutoForm::cutSelection() @@ -90,18 +80,9 @@ void AutoForm::cutSelection() } -void AutoForm::dataRefreshed() -{ - -} - -void AutoForm::dataSet(KexiTableViewData* data) -{ -} - KexiDataItemInterface* AutoForm::editor(int col, bool ignoreMissingEditor) { -return 0; + return 0; } void AutoForm::editorShowFocus(int row, int col) @@ -114,26 +95,6 @@ void AutoForm::ensureCellVisible(int row, int col) } -void AutoForm::itemChanged(KexiDB::RecordData* , int row, int col) -{ - -} - -void AutoForm::itemChanged(KexiDB::RecordData* , int row, int col, QVariant oldValue) -{ - -} - -void AutoForm::itemDeleteRequest(KexiDB::RecordData* , int row, int col) -{ - -} - -void AutoForm::itemSelected(KexiDB::RecordData* ) -{ - -} - void AutoForm::initDataContents() { kDebug(); @@ -153,26 +114,11 @@ int AutoForm::lastVisibleRow() const return 0; } -void AutoForm::newItemAppendedForAfterDeletingInSpreadSheetMode() -{ - -} - void AutoForm::paste() { } -void AutoForm::reloadActions() -{ - -} - -void AutoForm::rowEditTerminated(int row) -{ - -} - int AutoForm::rowsPerPage() const { return 0; @@ -213,11 +159,6 @@ void AutoForm::selectCellInternal() } } -void AutoForm::sortedColumnChanged(int col) -{ - -} - void AutoForm::updateCell(int row, int col) { @@ -297,7 +238,7 @@ void AutoForm::valueChanged(KexiDataItemInterface* item) if (m_editor != item) { kDebug() << "Editing Item Started"; - m_rowEditing = true; + setRowEditing(true); m_editor = item; startEditCurrentCell(); } diff --git a/kexi/plugins/autoforms/widgets/AutoForm.h b/kexi/plugins/autoforms/widgets/AutoForm.h index b03899f..7df525c 100644 --- a/kexi/plugins/autoforms/widgets/AutoForm.h +++ b/kexi/plugins/autoforms/widgets/AutoForm.h @@ -1,6 +1,6 @@ -/* - +/* This file is part of the KDE project Copyright (C) 2011 Adam Pigg + Copyright (C) 2011 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -50,33 +50,22 @@ protected: //Reimplement functions from KexiDataAwareObjectInterface virtual void addHeaderColumn(const QString& caption, const QString& description, const QIcon& icon, int size); - virtual void cellSelected(int col, int row); virtual void clearColumnsInternal(bool repaint); virtual void copySelection(); virtual void createEditor(int row, int col, const QString& addText = QString(), bool removeOld = false); - virtual void currentItemDeleteRequest(); virtual int currentLocalSortColumn() const; virtual int currentLocalSortingOrder() const; virtual void cutSelection(); - virtual void dataRefreshed(); - virtual void dataSet(KexiTableViewData* data); + virtual KexiDataItemInterface* editor(int col, bool ignoreMissingEditor = false); virtual void editorShowFocus(int row, int col); virtual void ensureCellVisible(int row, int col); - virtual void itemChanged(KexiDB::RecordData* , int row, int col); - virtual void itemChanged(KexiDB::RecordData* , int row, int col, QVariant oldValue); - virtual void itemDeleteRequest(KexiDB::RecordData* , int row, int col); - virtual void itemSelected(KexiDB::RecordData* ); virtual void initDataContents(); virtual int lastVisibleRow() const; - virtual void newItemAppendedForAfterDeletingInSpreadSheetMode(); virtual void paste(); - virtual void reloadActions(); - 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(); virtual void updateGUIAfterSorting(); @@ -88,7 +77,48 @@ protected: //Reimplement from KexiFormDataProvider virtual void valueChanged(KexiDataItemInterface* item); + + +signals: + void dataSet(KexiTableViewData *data); + + void itemSelected(KexiDB::RecordData *); + void cellSelected(int col, int row); + + void itemReturnPressed(KexiDB::RecordData *, int row, int col); + void itemDblClicked(KexiDB::RecordData *, int row, int col); + void itemMouseReleased(KexiDB::RecordData *, int row, int col); + + void dragOverRow(KexiDB::RecordData *record, int row, QDragMoveEvent* e); + void droppedAtRow(KexiDB::RecordData *record, int row, QDropEvent *e, KexiDB::RecordData*& newRecord); + + /*! Data has been refreshed on-screen - emitted from initDataContents(). */ + void dataRefreshed(); + + void itemChanged(KexiDB::RecordData *, int row, int col); + void itemChanged(KexiDB::RecordData *, int row, int col, QVariant oldValue); + void itemDeleteRequest(KexiDB::RecordData *, int row, int col); + void currentItemDeleteRequest(); + //! Emitted for spreadsheet mode when an item was deleted and a new item has been appended + void newItemAppendedForAfterDeletingInSpreadSheetMode(); +// void addRecordRequest(); +// void contextMenuRequested(KexiDB::RecordData *, int row, int col, const QPoint &); + void sortedColumnChanged(int col); + + //! emitted when row editing is started (for updating or inserting) + void rowEditStarted(int row); + + //! emitted when row editing is terminated (for updating or inserting) + //! no matter if accepted or not + void rowEditTerminated(int row); + + //! emitted when state of 'save/cancel record changes' actions should be updated. + void updateSaveCancelActions(); + //! Emitted in initActions() to force reload actions + //! You should remove existing actions and add them again. + void reloadActions(); + private: QLabel *m_title; QGridLayout *m_layout;