summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/tables/kexitabledesignerview_p.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/plugins/tables/kexitabledesignerview_p.h
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/tables/kexitabledesignerview_p.h')
-rw-r--r--kexi/plugins/tables/kexitabledesignerview_p.h191
1 files changed, 191 insertions, 0 deletions
diff --git a/kexi/plugins/tables/kexitabledesignerview_p.h b/kexi/plugins/tables/kexitabledesignerview_p.h
new file mode 100644
index 00000000..f5650e74
--- /dev/null
+++ b/kexi/plugins/tables/kexitabledesignerview_p.h
@@ -0,0 +1,191 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004-2006 Jaroslaw Staniek <[email protected]>
+
+ 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 KEXIALTERTABLEDIALOG_P_H
+#define KEXIALTERTABLEDIALOG_P_H
+
+#include "kexitabledesignerview.h"
+#include <kcommand.h>
+
+class KexiDataAwarePropertySet;
+
+//! @internal indices for table columns
+#define COLUMN_ID_ICON 0
+#define COLUMN_ID_CAPTION 1
+#define COLUMN_ID_TYPE 2
+#define COLUMN_ID_DESC 3
+
+/*! @internal
+ Command group, reimplemented to get access to commands().
+ We need it to iterate through commands so we can perform a set of ALTER TABLE atomic actions. */
+class CommandGroup : public KMacroCommand
+{
+ public:
+ CommandGroup( const QString & name )
+ : KMacroCommand(name)
+ {}
+ virtual ~CommandGroup() {}
+ const QPtrList<KCommand>& commands() const { return m_commands; }
+};
+
+/*! @internal
+ Command history, reimplemented to get access to commands().
+ We need it to iterate through commands so we can perform a set of ALTER TABLE atomic actions. */
+class CommandHistory : public KCommandHistory
+{
+ Q_OBJECT
+ public:
+ CommandHistory(KActionCollection *actionCollection, bool withMenus = true);
+
+ const QPtrList<KCommand>& commands() const { return m_commandsToUndo; }
+
+ void addCommand(KCommand *command, bool execute = true);
+
+ void clear();
+
+ public slots:
+ virtual void undo();
+ virtual void redo();
+
+ protected:
+ QPtrList<KCommand> m_commandsToUndo, m_commandsToRedo;
+};
+
+//----------------------------------------------
+
+//! @internal
+class KexiTableDesignerViewPrivate
+{
+ public:
+ KexiTableDesignerViewPrivate(KexiTableDesignerView* aDesignerView);
+ ~KexiTableDesignerViewPrivate();
+
+ int generateUniqueId();
+
+ /*! @internal
+ Sets property \a propertyName in property set \a set to \a newValue.
+ If \a commandGroup is not 0, a new ChangeFieldPropertyCommand object is added there as well.
+ While setting the new value, addHistoryCommand_in_slotPropertyChanged_enabled is set to false,
+ so addHistoryCommand() wont be executed in slotPropertyChanged() as an answer to setting
+ the property.
+
+ If \a forceAddCommand is false (the default) and \a newValue does not differ from curent property value
+ (set[propertyName].value()), ChangeFieldPropertyCommand command is not added to the \a commandGroup.
+ Otherwise, command is always added.
+
+ \a rememberOldValue argument is passed to Property::setValue()
+
+ If \a slist and \a nlist if not NULL and not empty, these are passed to Property::setListData().
+ If \a slist and \a nlist if not NULL but empty, Property::setListData(0) is called.
+
+ addHistoryCommand_in_slotPropertyChanged_enabled is then set back to the original state.
+ */
+ void setPropertyValueIfNeeded( const KoProperty::Set& set, const QCString& propertyName,
+ const QVariant& newValue, CommandGroup* commandGroup,
+ bool forceAddCommand = false, bool rememberOldValue = true,
+ QStringList* const slist = 0, QStringList* const nlist = 0);
+
+ /*! Like above but allows to specify \a oldValue. */
+ void setPropertyValueIfNeeded(
+ const KoProperty::Set& set, const QCString& propertyName,
+ const QVariant& newValue, const QVariant& oldValue, CommandGroup* commandGroup,
+ bool forceAddCommand = false, bool rememberOldValue = true,
+ QStringList* const slist = 0, QStringList* const nlist = 0);
+
+ /*! @internal
+ Used in updatePropertiesVisibility().
+ Does nothing if visibility should not be changed, i.e. when prop->isVisible()==visible,
+ otherwise sets changed to true and sets visibility of property \a prop to \a visible.
+ */
+ void setVisibilityIfNeeded( const KoProperty::Set& set, KoProperty::Property* prop,
+ bool visible, bool &changed, CommandGroup *commandGroup );
+
+ bool updatePropertiesVisibility(KexiDB::Field::Type fieldType, KoProperty::Set &set,
+ CommandGroup *commandGroup = 0);
+
+ /*! \return message used to ask user for accepting saving the design.
+ \a emptyTable is set to true if the table designed contains no rows.
+ If \a skipWarning is true, no warning about data loss is appended (useful when
+ only non-physical altering actions will be performed). */
+ QString messageForSavingChanges(bool &emptyTable, bool skipWarning = false);
+
+ /*! Updates icon in the first column, depending on property set \a set.
+ For example, when "rowSource" and "rowSourceType" propertiesa are not empty,
+ "combo" icon appears. */
+ void updateIconForItem(KexiTableItem &item, KoProperty::Set& set);
+
+ KexiTableDesignerView* designerView;
+
+ KexiTableView *view; //!< helper
+
+ KexiTableViewData *data;
+
+ KexiDataAwarePropertySet *sets;
+
+ int row; //!< used to know if a new row is selected in slotCellSelected()
+
+ KToggleAction *action_toggle_pkey;
+
+ KPopupTitle *contextMenuTitle;
+
+ int uniqueIdCounter;
+
+ //! internal
+ int maxTypeNameTextWidth;
+ //! Set to true in beforeSwitchTo() to avoid asking again in storeData()
+ bool dontAskOnStoreData : 1;
+
+ bool slotTogglePrimaryKeyCalled : 1;
+
+ bool primaryKeyExists : 1;
+ //! Used in slotPropertyChanged() to avoid infinite recursion
+ bool slotPropertyChanged_primaryKey_enabled : 1;
+ //! Used in slotPropertyChanged() to avoid infinite recursion
+ bool slotPropertyChanged_subType_enabled : 1;
+ //! used in slotPropertyChanged() to disable addHistoryCommand()
+ bool addHistoryCommand_in_slotPropertyChanged_enabled : 1;
+ //! used in slotRowUpdated() to disable addHistoryCommand()
+ bool addHistoryCommand_in_slotRowUpdated_enabled : 1;
+ //! used in slotAboutToDeleteRow() to disable addHistoryCommand()
+ bool addHistoryCommand_in_slotAboutToDeleteRow_enabled : 1;
+ //! used in slotRowInserted() to disable addHistoryCommand()
+ bool addHistoryCommand_in_slotRowInserted_enabled : 1;
+
+ //! used to disable slotBeforeCellChanged()
+ bool slotBeforeCellChanged_enabled : 1;
+
+//! @tood temp; remove this:
+ //! Temporary flag, used for testingu the Alter Table machinery. Affects storeData()
+ //! Used in slotExecuteRealAlterTable() to switch on real alter table for a while.
+ bool tempStoreDataUsingRealAlterTable : 1;
+
+ /*! Set to a recent result of calling \ref tristate KexiTableDesignerView::storeData(bool dontAsk).
+ Then, it is used in \ref void KexiTableDesignerView::executeRealAlterTable()
+ to know what return value should be. */
+ tristate recentResultOfStoreData;
+
+ KActionCollection* historyActionCollection;
+ CommandHistory* history;
+
+ //! A cache used in KexiTableDesignerView::buildField() to quickly identify
+ //! properties internal to the designer
+ QAsciiDict<char> internalPropertyNames;
+};
+
+#endif