diff --git a/src/core/kexipartbase.h b/src/core/kexipartbase.h index fe5de10dd..32f1e653f 100644 --- a/src/core/kexipartbase.h +++ b/src/core/kexipartbase.h @@ -1,109 +1,109 @@ /* This file is part of the KDE project Copyright (C) 2003 Lucijan Busch Copyright (C) 2003-2014 Jarosław Staniek This library 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 library 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 library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXIPARTBASE_H #define KEXIPARTBASE_H #include #include "kexi.h" #include #include class QTabWidget; class KexiWindow; namespace KexiPart { class Info; //! @short The base class for Kexi frontend parts (plugins) //! @see KexiPart::Part KexiInternalPart class KEXICORE_EXPORT PartBase : public QObject, protected KexiUtils::InternalPropertyMap { Q_OBJECT public: virtual ~PartBase(); /*! @return Info structure for this part. */ Info *info() const; /*! \return i18n'd message translated from \a englishMessage. This method is useful for messages like: "

Table \"%1\" has been modified.

", -- such messages can be accurately translated, while this could not: "

%1 \"%2\" has been modified.

". See implementation of this method in KexiTablePart to see what strings are needed for translation. Default implementation returns generic \a englishMessage. In special cases, \a englishMessage can start with ":", to indicate that empty string will be generated if a part does not offer a message for such \a englishMessage. This is used e.g. in KexiMainWindow::closeWindow(). @note As number of %n parameters is unspecified, you should add appropriate number of parameters using .subs(). to result of i18nMessage(). - In your your implementation, you should use kxi18nc(I18NC_NOOP("@info", "...")) + In your implementation, you should use kxi18nc(I18NC_NOOP("@info", "...")) instead of i18n(). Example: @code QString tableName = "Employees"; QString translated = part->i18nMessage("Design of object %1 has been modified.") .subs(tableName).toString(); @endcode */ virtual KLocalizedString i18nMessage(const QString& englishMessage, KexiWindow *window) const; /*! @internal This method can be reimplemented to setup additional tabs in the property editor panel. Default implementation does nothing. This method is called whenever current window (KexiWindow) is switched and type (mime type) of its contents differs from previous one. For example, if a user switched from Table Designer to Form Designer, additional tab containing Form Designer's object tree should be shown. */ virtual void setupCustomPropertyPanelTabs(QTabWidget *tab); protected: /*! Creates new Plugin @param parent parent of this plugin @param list extra arguments passed to the plugin */ PartBase(QObject *parent, const QVariantList& list); /*! Sets Info structure for this part. */ void setInfo(Info *info); Q_DISABLE_COPY(PartBase) class Private; Private * const d; friend class Manager; }; } // namespace KexiPart #endif diff --git a/src/doc/dev/kexi_import.txt b/src/doc/dev/kexi_import.txt index b0f66acd5..1f3f90653 100644 --- a/src/doc/dev/kexi_import.txt +++ b/src/doc/dev/kexi_import.txt @@ -1,61 +1,61 @@ kexiImport proposal - piggz (www.piggz.co.uk) ============================================= This is a proposal for some import functionality for kexi. As of this moment i have no idea how it will work, but ive been thinking and figured i should get something down in writing. Hopefully you will all improve on this and we can get something working. The way i see it we need to do a few things: 1) A common api to different import systems This would be similar in concept to kexidb drivers, but would only provide limited, specific functionality 2) DB specific classes that provide import functionality for postgres, mysql firebird etc... -For 1) we need to to: +For 1) we need to: i) Connect to backend -| | ii) Get list of databases | All this is already catered for in | kexidb iii) Get list of tables -| iv) For a given table, get list of columns as stringlist v) For a given table/column combination, get extended information for that column: type +--If a known kexi type then ok +--If unknown then driver may be able to automagically map to suitable type +--Ask the user what to do (map to type, convert column, drop column) index (yes/no) pkex (yes/no) default value Alot of this is already catered for in old kexi api, so maybe some chunks fo code could be reused, though a bit of a rewrite is inevitable to limit the functionality to the above Once the table/column information is available then a tableschema object would be created and standard kexidb api could create nescessary structure. For this there would be 2 modes of operation A) Structure will be created under new db name, and kexidb api would be used as normal B) Structure will be created in existing db. Kexi api would need a mode where kexi__* structure is created, but tables are not created as they already exist Ideas, suggestions and designs welcome :o) PiggZ \ No newline at end of file diff --git a/src/plugins/tables/kexitabledesignercommands.h b/src/plugins/tables/kexitabledesignercommands.h index 35a15dd35..b14e91c8a 100644 --- a/src/plugins/tables/kexitabledesignercommands.h +++ b/src/plugins/tables/kexitabledesignercommands.h @@ -1,189 +1,189 @@ /* This file is part of the KDE project Copyright (C) 2006-2012 Jarosław Staniek This library 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 library 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 library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXITABLEDESIGNER_COMMANDS_H #define KEXITABLEDESIGNER_COMMANDS_H #include #include #include #include #include "kexitabledesignerview.h" class QPoint; class QByteArray; namespace KexiTableDesignerCommands { //! @short Base class for all Table Designer's commands class Command : public KUndo2Command { public: Command(const KUndo2MagicString &text, Command *parent, KexiTableDesignerView* view); Command(Command* parent, KexiTableDesignerView* view); virtual ~Command(); //! Used to collect actions data for AlterTableHandler //! Can return 0 if the action should not be passed to AlterTableHandler virtual KDbAlterTableHandler::ActionBase* createAction() const { return 0; } virtual QString debugString() const { return text().toString(); } virtual void redo(); virtual void undo(); //! Used to block execution of redo() once, on adding the command to the stack. void blockRedoOnce(); protected: virtual void redoInternal(); virtual void undoInternal(); QPointer m_view; bool m_blockRedoOnce; //!< Used to block redo() once friend class KexiTableDesignerView; }; //! @short Undo/redo command used for when changing a property for a table field class ChangeFieldPropertyCommand : public Command { public: /*! Creates the ChangeFieldPropertyCommand object. Note: we use internal "uid" property of a field (set["uid"]) to avoid problems with looking for field by name when more than one field exists with the same name (it's invalid but allowed in design time). - \a oldlistData and and \a newListData can be specified so Property::setListData() will be called + \a oldlistData and \a newListData can be specified so Property::setListData() will be called on execute() and unexecute(). */ ChangeFieldPropertyCommand(Command* parent, KexiTableDesignerView* view, const KPropertySet& set, const QByteArray& propertyName, const QVariant& oldValue, const QVariant& newValue, KPropertyListData* const oldListData = 0, KPropertyListData* const newListData = 0); virtual ~ChangeFieldPropertyCommand(); virtual void redoInternal(); virtual void undoInternal(); virtual KDbAlterTableHandler::ActionBase* createAction() const; virtual QString debugString() const; protected: KDbAlterTableHandler::ChangeFieldPropertyAction m_alterTableAction; QVariant m_oldValue; KPropertyListData* m_oldListData, *m_listData; }; //! @short Undo/redo command used when a field is removed from a table class RemoveFieldCommand : public Command { public: /*! Constructs RemoveFieldCommand object. If \a set is 0, the action only means removing empty row (internal). */ RemoveFieldCommand(Command* parent, KexiTableDesignerView* view, int fieldIndex, const KPropertySet* set); virtual ~RemoveFieldCommand(); virtual void redoInternal(); virtual void undoInternal(); virtual KDbAlterTableHandler::ActionBase* createAction() const; virtual QString debugString() const; protected: KDbAlterTableHandler::RemoveFieldAction m_alterTableAction; KPropertySet* m_set; int m_fieldIndex; }; //! @short Undo/redo command used when a new field is inserted into a table class InsertFieldCommand : public Command { public: InsertFieldCommand(Command* parent, KexiTableDesignerView* view, int fieldIndex/*, const KDbField& field*/, const KPropertySet& set); virtual ~InsertFieldCommand(); virtual void redoInternal(); virtual void undoInternal(); virtual KDbAlterTableHandler::ActionBase* createAction() const; virtual QString debugString() const; protected: KDbAlterTableHandler::InsertFieldAction *m_alterTableAction; KPropertySet m_set; }; /* ---- Internal commands follow (not used for building performing ALTER TABLE ---- */ //! @short Undo/redo command used when property visibility is changed /*! Internal, only used in addition to property change. */ class ChangePropertyVisibilityCommand : public Command { public: /*! Creates the ChangePropertyVisibilityCommand object. Note: we use internal "uid" property of a field (set["uid"]) to avoid problems with looking for field by name when more than one field exists with the same name (it's invalid but allowed in design time). */ ChangePropertyVisibilityCommand(Command* parent, KexiTableDesignerView* view, const KPropertySet& set, const QByteArray& propertyName, bool visible); virtual ~ChangePropertyVisibilityCommand(); virtual void redoInternal(); virtual void undoInternal(); protected: KDbAlterTableHandler::ChangeFieldPropertyAction m_alterTableAction; bool m_oldVisibility; }; //! @short Undo/redo command used when property visibility is changed /*! Internal, only used in addition to property change. */ class InsertEmptyRecordCommand : public Command { public: /*! Creates the InsertEmptyRecordCommand object. */ InsertEmptyRecordCommand(Command* parent, KexiTableDesignerView* view, int row); virtual ~InsertEmptyRecordCommand(); virtual void redoInternal(); virtual void undoInternal(); protected: KDbAlterTableHandler::ChangeFieldPropertyAction m_alterTableAction; int m_row; }; } #endif diff --git a/src/widget/kexidbconnectionwidget.h b/src/widget/kexidbconnectionwidget.h index 2170227c9..75ba528d1 100644 --- a/src/widget/kexidbconnectionwidget.h +++ b/src/widget/kexidbconnectionwidget.h @@ -1,196 +1,196 @@ /* This file is part of the KDE project Copyright (C) 2005 Jarosław Staniek Copyright (C) 2014 Roman Shtemberko 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 KEXIDBCONNECTIONWIDGET_H #define KEXIDBCONNECTIONWIDGET_H #include "kexiextwidgets_export.h" #include "ui_kexidbconnectionwidget.h" #include "ui_kexidbconnectionwidgetdetails.h" #include #include #include #include class QPushButton; class KexiDBDriverComboBox; class KexiDBConnectionTabWidget; class KEXIEXTWIDGETS_EXPORT KexiDBConnectionWidget : public QWidget, protected Ui::KexiDBConnectionWidget { Q_OBJECT public: explicit KexiDBConnectionWidget(QWidget* parent = 0); virtual ~KexiDBConnectionWidget(); /*! Sets project data \a data. \a shortcutFileName is only used to check if the file is writable (if no, "save changes" button will be disabled). */ void setData(const KexiProjectData& data, const QString& shortcutFileName = QString()); /*! Sets connection data \a data. \a shortcutFileName is only used to check if the file is writable (if no, "save changes" button will be disabled). */ void setData(const KDbConnectionData& data, const QString& shortcutFileName = QString()); KexiProjectData data(); //! \return a pointer to 'save changes' button. You can call hide() for this to hide it. QPushButton* saveChangesButton() const; //! \return a pointer to 'test connection' button. You can call hide() for this to hide it. QPushButton* testConnectionButton() const; KexiDBDriverComboBox *driversCombo() const; //! \return true if only connection data is managed by this widget bool connectionOnly() const; Q_SIGNALS: //! emitted when data saving is needed void saveChanges(); void loadDBList(); protected Q_SLOTS: void slotLocationRadioClicked(); void slotCBToggled(bool on); void slotShowSavePasswordHelp(); protected: void setDataInternal(const KexiProjectData& data, bool connectionOnly, const QString& shortcutFileName); private: class Private; Private * const d; friend class KexiDBConnectionTabWidget; friend class KexiDBConnectionDialog; }; class KEXIEXTWIDGETS_EXPORT KexiDBConnectionWidgetDetails : public QWidget, public Ui::KexiDBConnectionWidgetDetails { Q_OBJECT public: explicit KexiDBConnectionWidgetDetails(QWidget* parent = 0); ~KexiDBConnectionWidgetDetails(); }; class KEXIEXTWIDGETS_EXPORT KexiDBConnectionTabWidget : public QTabWidget { Q_OBJECT public: explicit KexiDBConnectionTabWidget(QWidget* parent = 0); virtual ~KexiDBConnectionTabWidget(); /*! Sets connection data \a data. \a shortcutFileName is only used to check if the file is writable (if no, "save changes" button will be disabled). */ void setData(const KexiProjectData& data, const QString& shortcutFileName = QString()); void setData(const KDbConnectionData& data, const QString& shortcutFileName = QString()); KexiProjectData currentProjectData(); //! \return true if 'save password' option is selected bool savePasswordOptionSelected() const; Q_SIGNALS: //! emitted when test connection is needed void testConnection(); protected Q_SLOTS: void slotTestConnection(); void slotSocketComboboxToggled(bool on); protected: KexiDBConnectionWidget *mainWidget; KexiDBConnectionWidgetDetails* detailsWidget; friend class KexiDBConnectionDialog; }; class KEXIEXTWIDGETS_EXPORT KexiDBConnectionDialog : public QDialog { Q_OBJECT public: /*! Creates a new connection dialog for project data \a data. - Not only connection data is visible but also database name and and title. + Not only connection data is visible but also database name and title. \a shortcutFileName is only used to check if the shortcut file is writable (if no, "save changes" button will be disabled). The shortcut file is in .KEXIS format. Connect to saveChanges() signal to react on saving changes. If \a shortcutFileName is empty, the button will be hidden. \a acceptButtonGuiItem allows to override default "Open" button's appearance. */ KexiDBConnectionDialog(QWidget* parent, const KexiProjectData& data, const QString& shortcutFileName = QString(), const KGuiItem& acceptButtonGuiItem = KGuiItem()); /*! Creates a new connection dialog for connection data \a data. - Only connection data is visible: database name and and title fields are hidden. + Only connection data is visible: database name and title fields are hidden. \a shortcutFileName is only used to check if the shortcut file is writable (if no, "save changes" button will be disabled). The shortcut file is in .KEXIC format. See above constructor for more details. */ KexiDBConnectionDialog(QWidget* parent, const KDbConnectionData& data, const QString& shortcutFileName = QString(), const KGuiItem& acceptButtonGuiItem = KGuiItem()); ~KexiDBConnectionDialog(); /*! \return project data displayed within the dialog. Information about database name and title can be empty if the dialog contain only a connection data (if second constructor was used). */ KexiProjectData currentProjectData(); //! \return true if 'save password' option is selected bool savePasswordOptionSelected() const; KexiDBConnectionWidget *mainWidget() const; KexiDBConnectionWidgetDetails* detailsWidget() const; Q_SIGNALS: //! emitted when data saving is needed void saveChanges(); //! emitted when test connection is needed void testConnection(); void loadDBList(); private: void init(const KGuiItem& acceptButtonGuiItem); class Private; Private * const d; }; #endif // KEXIDBCONNECTIONWIDGET_H