[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=3A_Refacto?=
From: Adam Pigg <adam () piggz ! co ! uk>
Date: 2011-04-03 20:06:23
Message-ID: 20110403200623.8CEA1A60AE () git ! kde ! org
[Download RAW message or body]
Git commit b824c664e16eaa5402354511c7779ef439cc8bde by Adam Pigg.
Committed on 03/04/2011 at 16:16.
Pushed by piggz into branch 'kexi-mobile-adam_pigg'.
Refactored out the interface classes for KexiRecordNavigator
Builds ok with and without KEXI_MOBILE
M +2 -1 kexi/core/CMakeLists.txt
A +31 -0 kexi/core/KexiRecordNavigatorHandler.cpp [License: LGPL (v2+)]
A +46 -0 kexi/core/KexiRecordNavigatorHandler.h [License: GENERATED \
FILE] * A +30 -0 kexi/core/KexiRecordNavigatorIface.cpp [License: LGPL \
(v2+)] A +72 -0 kexi/core/KexiRecordNavigatorIface.h [License: LGPL \
(v2+)] M +1 -1 kexi/mobile/KexiMobileMainWindow.cpp
M +1 -1 kexi/mobile/KexiMobileToolbar.cpp
M +4 -0 kexi/plugins/autoforms/KexiAutoFormView.cpp
M +1 -1 kexi/plugins/autoforms/KexiAutoFormView.h
M +3 -0 kexi/plugins/forms/kexiformscrollview.h
M +1 -1 kexi/plugins/reports/kexireportview.h
M +1 -0 kexi/widget/tableview/kexitableview.h
M +9 -1 kexi/widget/utils/CMakeLists.txt
M +1 -19 kexi/widget/utils/kexirecordnavigator.cpp
M +4 -63 kexi/widget/utils/kexirecordnavigator.h
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/calligra/b824c664e16eaa5402354511c7779ef439cc8bde
diff --git a/kexi/core/CMakeLists.txt b/kexi/core/CMakeLists.txt
index 9aa861b..9a0c5e8 100644
--- a/kexi/core/CMakeLists.txt
+++ b/kexi/core/CMakeLists.txt
@@ -40,9 +40,10 @@ set(kexicore_LIB_SRCS
kexitabledesignerinterface.cpp
kexisearchandreplaceiface.cpp
kexitemplateloader.cpp
+ KexiRecordNavigatorHandler.cpp
+ KexiRecordNavigatorIface.cpp
)
-
kde4_add_library(kexicore SHARED ${kexicore_LIB_SRCS})
target_link_libraries(kexicore
diff --git a/kexi/core/KexiRecordNavigatorHandler.cpp \
b/kexi/core/KexiRecordNavigatorHandler.cpp new file mode 100644
index 0000000..316103a
--- /dev/null
+++ b/kexi/core/KexiRecordNavigatorHandler.cpp
@@ -0,0 +1,31 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
+ * Copyright (C) 2003-2007 Jarosław Staniek <staniek@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include"KexiRecordNavigatorHandler.h"
+
+KexiRecordNavigatorHandler::KexiRecordNavigatorHandler()
+{
+
+}
+
+KexiRecordNavigatorHandler::~KexiRecordNavigatorHandler()
+{
+
+}
diff --git a/kexi/core/KexiRecordNavigatorHandler.h \
b/kexi/core/KexiRecordNavigatorHandler.h new file mode 100644
index 0000000..b03f6ae
--- /dev/null
+++ b/kexi/core/KexiRecordNavigatorHandler.h
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
+ * Copyright (C) 2003-2007 Jarosław Staniek <staniek@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KEXIRECORDNAVIGATORHANLDER_H
+#define KEXIRECORDNAVIGATORHANDLER_H
+
+#include <kexi_export.h>
+
+//! @short An interface handling requests generated by KexiRecordNavigator
+class KEXICORE_EXPORT KexiRecordNavigatorHandler
+{
+public:
+ KexiRecordNavigatorHandler();
+ virtual ~KexiRecordNavigatorHandler();
+
+ //! Moving to record \a r is requested. Records are counted from 0.
+ virtual void moveToRecordRequested(uint r) = 0;
+ virtual void moveToLastRecordRequested() = 0;
+ virtual void moveToPreviousRecordRequested() = 0;
+ virtual void moveToNextRecordRequested() = 0;
+ virtual void moveToFirstRecordRequested() = 0;
+ virtual void addNewRecordRequested() = 0;
+
+ //!Allow the handler to tell the navigator about the records
+ virtual long recordCount() { return 0; }
+ virtual long currentRecord() { return 0; }
+};
+
+#endif
diff --git a/kexi/core/KexiRecordNavigatorIface.cpp \
b/kexi/core/KexiRecordNavigatorIface.cpp new file mode 100644
index 0000000..f9f23ec
--- /dev/null
+++ b/kexi/core/KexiRecordNavigatorIface.cpp
@@ -0,0 +1,30 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2011 Adam Pigg <adam@piggz.co.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include"KexiRecordNavigatorIface.h"
+
+KexiRecordNavigatorIface::KexiRecordNavigatorIface()
+{
+
+}
+
+KexiRecordNavigatorIface::~KexiRecordNavigatorIface()
+{
+
+}
\ No newline at end of file
diff --git a/kexi/core/KexiRecordNavigatorIface.h \
b/kexi/core/KexiRecordNavigatorIface.h new file mode 100644
index 0000000..c3e5ca6
--- /dev/null
+++ b/kexi/core/KexiRecordNavigatorIface.h
@@ -0,0 +1,72 @@
+/* This file is part of the KDE project
+ Copyright (C) 2011 Adam Pigg <adam@piggz.co.uk>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KEXIRECORDNAVIGATORIFACE_H
+#define KEXIRECORDNAVIGATORIFACE_H
+
+#include <kexi_export.h>
+#include <QScrollBar>
+
+class KexiRecordNavigatorHandler;
+
+class KEXICORE_EXPORT KexiRecordNavigatorIface
+{
+public:
+ KexiRecordNavigatorIface();
+ virtual ~KexiRecordNavigatorIface();
+
+ /*! Sets current record number for this navigator,
+ * i .e. a value that will be displ*ayed in the 'record number' text box.
+ * This can also affect button's enabling and disabling.
+ * If @p r is 0, 'record number' text box's content is cleared. */
+ virtual void setCurrentRecordNumber(uint r) = 0;
+
+ /*! Sets record count for this navigator.
+ * T his can also affect button's e*nabling and disabling.
+ * By default count is 0. */
+ virtual void setRecordCount(uint count) = 0;
+
+ /*! Sets insertingEnabled flag. If true, "+" button will be enabled. */
+ virtual void setInsertingEnabled(bool set) = 0;
+
+ /*! Sets visibility of "inserting" button. */
+ virtual void setInsertingButtonVisible(bool set) = 0;
+
+ /*! Sets record navigator handler. This allows to react
+ * o n actions performed within navigator and vice versa. */
+ virtual void setRecordHandler(KexiRecordNavigatorHandler *handler) = 0;
+
+ /*! Shows or hides "editing" indicator. */
+ virtual void showEditingIndicator(bool show) = 0;
+
+ /*! Sets horizontal bar's \a hbar (at the bottom) geometry so this record \
navigator + * i s properly positioned together with horizontal scroll bar. This \
me*thod is used + * in QScrollView::setHBarGeometry() implementations:
+ * see KexiTableView::setHBarGeometry() and \
KexiFormScrollView::setHBarGeometry() + * for usage examples. */
+ virtual void setHBarGeometry(QScrollBar & hbar, int x, int y, int w, int h) = 0;
+
+ virtual void updateGeometry(int leftMargin) = 0;
+
+ /*! Sets label text at the left of the for record navigator's button.
+ * By default this label contains transla*ted "Row:" text. */
+ virtual void setLabelText(const QString& text) = 0;
+};
+
+#endif
diff --git a/kexi/mobile/KexiMobileMainWindow.cpp \
b/kexi/mobile/KexiMobileMainWindow.cpp index 82c75ff..4ba531e 100644
--- a/kexi/mobile/KexiMobileMainWindow.cpp
+++ b/kexi/mobile/KexiMobileMainWindow.cpp
@@ -17,7 +17,7 @@
#include <kexipartinfo.h>
#include <KexiWindow.h>
#include <KexiView.h>
-#include <widget/utils/kexirecordnavigator.h>
+#include <core/KexiRecordNavigatorHandler.h>
KexiMobileMainWindow::KexiMobileMainWindow()
{
diff --git a/kexi/mobile/KexiMobileToolbar.cpp b/kexi/mobile/KexiMobileToolbar.cpp
index bb23aab..9a4d21f 100644
--- a/kexi/mobile/KexiMobileToolbar.cpp
+++ b/kexi/mobile/KexiMobileToolbar.cpp
@@ -25,7 +25,7 @@
#include <QAction>
#include <kdebug.h>
#include <QPushButton>
-#include <utils/kexirecordnavigator.h>
+#include <core/KexiRecordNavigatorHandler.h>
KexiMobileToolbar::KexiMobileToolbar(QWidget* parent): QToolBar(parent),
m_recordHandler(0)
diff --git a/kexi/plugins/autoforms/KexiAutoFormView.cpp \
b/kexi/plugins/autoforms/KexiAutoFormView.cpp index 4fc312d..0a18604 100644
--- a/kexi/plugins/autoforms/KexiAutoFormView.cpp
+++ b/kexi/plugins/autoforms/KexiAutoFormView.cpp
@@ -27,6 +27,10 @@
#include <kexidb/cursor.h>
#include <KexiMainWindowIface.h>
+#ifndef KEXI_MOBILE
+#include <widget/utils/kexirecordnavigator.h>
+#endif
+
KexiAutoFormView::KexiAutoFormView(QWidget* parent): KexiView(parent), \
m_autoForm(0), m_pageSelector(0) {
kDebug();
diff --git a/kexi/plugins/autoforms/KexiAutoFormView.h \
b/kexi/plugins/autoforms/KexiAutoFormView.h index dcc84bb..d19aec5 100644
--- a/kexi/plugins/autoforms/KexiAutoFormView.h
+++ b/kexi/plugins/autoforms/KexiAutoFormView.h
@@ -22,7 +22,7 @@
#define KEXIAUTOFORMVIEW_H
#include <core/KexiView.h>
-#include <widget/utils/kexirecordnavigator.h>
+#include <core/KexiRecordNavigatorHandler.h>
#include <widget/dataviewcommon/kexidataawareobjectiface.h>
#include <widget/dataviewcommon/kexidataprovider.h>
#include "KexiAutoFormPart.h"
diff --git a/kexi/plugins/forms/kexiformscrollview.h \
b/kexi/plugins/forms/kexiformscrollview.h index a198911..50f85e5 100644
--- a/kexi/plugins/forms/kexiformscrollview.h
+++ b/kexi/plugins/forms/kexiformscrollview.h
@@ -39,6 +39,9 @@
@see KexiTableView
*/
+
+#include <core/KexiRecordNavigatorHandler.h>
+
class KEXIFORMUTILS_EXPORT KexiFormScrollView :
public KexiScrollView,
public KexiRecordNavigatorHandler,
diff --git a/kexi/plugins/reports/kexireportview.h \
b/kexi/plugins/reports/kexireportview.h index 57ab6f2..42e2701 100644
--- a/kexi/plugins/reports/kexireportview.h
+++ b/kexi/plugins/reports/kexireportview.h
@@ -36,7 +36,7 @@ class KRScriptFunctions;
class KexiRecordNavigator;
#endif
-#include <widget/utils/kexirecordnavigator.h>
+#include <core/KexiRecordNavigatorHandler.h>
/**
@author Adam Pigg <adam@piggz.co.uk>
diff --git a/kexi/widget/tableview/kexitableview.h \
b/kexi/widget/tableview/kexitableview.h index 2db532c..86a6f54 100644
--- a/kexi/widget/tableview/kexitableview.h
+++ b/kexi/widget/tableview/kexitableview.h
@@ -48,6 +48,7 @@
#include <widget/utils/kexirecordnavigator.h>
#include <widget/utils/kexisharedactionclient.h>
#include <widget/dataviewcommon/kexidataawareobjectiface.h>
+#include <core/KexiRecordNavigatorHandler.h>
class QPrinter;
class QPrintDialog;
diff --git a/kexi/widget/utils/CMakeLists.txt b/kexi/widget/utils/CMakeLists.txt
index 6189f07..a2b5230 100644
--- a/kexi/widget/utils/CMakeLists.txt
+++ b/kexi/widget/utils/CMakeLists.txt
@@ -14,15 +14,23 @@ set(kexiguiutils_LIB_SRCS
kexicomboboxdropdownbutton.cpp
kexidatetimeformatter.cpp
KexiDockableWidget.cpp
- kexirecordnavigator.cpp
)
+IF (KEXI_MOBILE)
+
+ELSE (KEXI_MOBILE)
+ LIST(APPEND kexiguiutils_LIB_SRCS
+ kexirecordnavigator.cpp
+ )
+ENDIF (KEXI_MOBILE)
+
# todo: use new Qt4's painting engine: kexigradientwidget.cpp
kde4_add_library(kexiguiutils SHARED ${kexiguiutils_LIB_SRCS})
target_link_libraries(kexiguiutils
+kexicore
kexiutils ${KDE4_KIO_LIBS}
)
diff --git a/kexi/widget/utils/kexirecordnavigator.cpp \
b/kexi/widget/utils/kexirecordnavigator.cpp index 185f75f..2e1c694 100644
--- a/kexi/widget/utils/kexirecordnavigator.cpp
+++ b/kexi/widget/utils/kexirecordnavigator.cpp
@@ -21,9 +21,7 @@
#include <QLabel>
#include <QIntValidator>
-#ifndef KEXI_MOBILE
#include <Q3ScrollView>
-#endif
#include <QPixmap>
#include <QFocusEvent>
@@ -43,8 +41,7 @@
#include "kexirecordmarker.h"
#include <kexiutils/SmallToolButton.h>
#include <kexiutils/utils.h>
-
-#ifndef KEXI_MOBILE
+#include <core/KexiRecordNavigatorHandler.h>
//! @internal
class KexiRecordNavigator::Private
@@ -80,22 +77,8 @@ public:
bool isInsertingEnabled;
};
-#endif
-
//--------------------------------------------------
-KexiRecordNavigatorHandler::KexiRecordNavigatorHandler()
-{
-}
-
-KexiRecordNavigatorHandler::~KexiRecordNavigatorHandler()
-{
-}
-
-//--------------------------------------------------
-
-#ifndef KEXI_MOBILE
-
KexiRecordNavigator::KexiRecordNavigator(QWidget *parent, Q3ScrollView* parentView, \
int leftMargin) : QWidget(parent)
, d(new Private)
@@ -566,6 +549,5 @@ const KGuiItem& KexiRecordNavigator::Actions::moveToNewRecord()
{
return KexiRecordNavigatorActions_internal->moveToNewRecord;
}
-#endif
#include "kexirecordnavigator.moc"
diff --git a/kexi/widget/utils/kexirecordnavigator.h \
b/kexi/widget/utils/kexirecordnavigator.h index 90227e5..e5ab7c8 100644
--- a/kexi/widget/utils/kexirecordnavigator.h
+++ b/kexi/widget/utils/kexirecordnavigator.h
@@ -34,68 +34,6 @@ class QPaintEvent;
class KLineEdit;
class KGuiItem;
-//! @short An interface handling requests generated by KexiRecordNavigator
-class KEXIGUIUTILS_EXPORT KexiRecordNavigatorHandler
-{
-public:
- KexiRecordNavigatorHandler();
- virtual ~KexiRecordNavigatorHandler();
-
- //! Moving to record \a r is requested. Records are counted from 0.
- virtual void moveToRecordRequested(uint r) = 0;
- virtual void moveToLastRecordRequested() = 0;
- virtual void moveToPreviousRecordRequested() = 0;
- virtual void moveToNextRecordRequested() = 0;
- virtual void moveToFirstRecordRequested() = 0;
- virtual void addNewRecordRequested() = 0;
-
- //!Allow the handler to tell the navigator about the records
- virtual long recordCount() { return 0; }
- virtual long currentRecord() { return 0; }
-};
-
-class KEXIGUIUTILS_EXPORT KexiRecordNavigatorIface
-{
-public:
- /*! Sets current record number for this navigator,
- i .e. a value that will be displ*ayed in the 'record number' text box.
- This can also affect button's enabling and disabling.
- If @p r is 0, 'record number' text box's content is cleared. */
- virtual void setCurrentRecordNumber(uint r) = 0;
-
- /*! Sets record count for this navigator.
- T his can also affect button's e*nabling and disabling.
- By default count is 0. */
- virtual void setRecordCount(uint count) = 0;
-
- /*! Sets insertingEnabled flag. If true, "+" button will be enabled. */
- virtual void setInsertingEnabled(bool set) = 0;
-
- /*! Sets visibility of "inserting" button. */
- virtual void setInsertingButtonVisible(bool set) = 0;
-
- /*! Sets record navigator handler. This allows to react
- o n actions performed within navigator and vice versa. */
- virtual void setRecordHandler(KexiRecordNavigatorHandler *handler) = 0;
-
- /*! Shows or hides "editing" indicator. */
- virtual void showEditingIndicator(bool show) = 0;
-
- /*! Sets horizontal bar's \a hbar (at the bottom) geometry so this record \
navigator
- i s properly positioned together with horizontal scroll bar. This me*thod is \
used
- in QScrollView::setHBarGeometry() implementations:
- see KexiTableView::setHBarGeometry() and KexiFormScrollView::setHBarGeometry()
- for usage examples. */
- virtual void setHBarGeometry(QScrollBar & hbar, int x, int y, int w, int h) = 0;
-
- virtual void updateGeometry(int leftMargin) = 0;
-
- /*! Sets label text at the left of the for record navigator's button.
- By default this label contains transla*ted "Row:" text. */
- virtual void setLabelText(const QString& text) = 0;
-};
-
-#ifndef KEXI_MOBILE
//! @short KexiRecordNavigator class provides a record navigator.
/*! Record navigator is usually used for data tables (e.g. KexiTableView)
@@ -111,6 +49,9 @@ public:
Note that using this method 2), you can create more than one navigator widget
connected with your data-aware object (does not matter if this is useful).
*/
+
+#include <core/KexiRecordNavigatorIface.h>
+
class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QWidget, public \
KexiRecordNavigatorIface {
Q_OBJECT
@@ -234,5 +175,5 @@ protected:
class Private;
Private * const d;
};
-#endif
+
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic