diff --git a/src/core/KexiGroupButton.h b/src/core/KexiGroupButton.h index 19ef8c501..900b574b3 100644 --- a/src/core/KexiGroupButton.h +++ b/src/core/KexiGroupButton.h @@ -1,76 +1,76 @@ /* This file is part of the KDE libraries Copyright (C) 2007 Aurélien Gâteau Copyright (C) 2012 Jean-Nicolas Artaud Copyright (C) 2012-2016 Jarosław Staniek Based on Calligra libs' KoGroupButton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 KEXIGROUPBUTTON_H #define KEXIGROUPBUTTON_H #include "kexicore_export.h" // Qt #include /** * A thin tool button which can be visually grouped with other buttons. * * The group can thus look like one solid bar: ( button1 | button2 | button3 ) * * For groupping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons. */ class KEXICORE_EXPORT KexiGroupButton : public QToolButton { Q_OBJECT Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition ) public: /** * Position of the button within the button group what affects the appearance. */ enum GroupPosition { NoGroup, //!< No particular position, gives the button unchanged appearance GroupLeft, //!< The button is at the left of the group, so it would have rounded the left part GroupRight, //!< The button is at the right of the group, so it would have rounded the right part GroupCenter //!< The button is on the center of the group, so it would have separators on both sides }; Q_ENUM(GroupPosition) explicit KexiGroupButton(GroupPosition position, QWidget* parent = 0); /** * Creates button with no NoGroup position. */ explicit KexiGroupButton(QWidget* parent = 0); virtual ~KexiGroupButton(); void setGroupPosition(KexiGroupButton::GroupPosition groupPosition); KexiGroupButton::GroupPosition groupPosition() const; protected: virtual void paintEvent(QPaintEvent* event) override; - void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *e) override; private: class Private; Private *const d; }; #endif /* KEXIGROUPBUTTON_H */ diff --git a/src/kexiutils/KexiFadeWidgetEffect.h b/src/kexiutils/KexiFadeWidgetEffect.h index ccd536fe6..588cef772 100644 --- a/src/kexiutils/KexiFadeWidgetEffect.h +++ b/src/kexiutils/KexiFadeWidgetEffect.h @@ -1,98 +1,98 @@ /* This file is part of the KDE project Copyright (C) 2008 Matthias Kretz 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) version 3. 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 KEXIFADEWIDGETEFFECT_H #define KEXIFADEWIDGETEFFECT_H #include #include class KexiFadeWidgetEffectPrivate; /** \class KexiFadeWidgetEffect KexiFadeWidgetEffect.h KexiFadeWidgetEffect * \brief Animates changes fading the new UI over the old look. * * This widget will put itself above the widget that will change and show a fading transition from * the old to the new UI. It will delete itself after the animation is finished. * Example: * \code * KexiFadeWidgetEffect *animation = new KexiFadeWidgetEffect(widgetThatWillChange); * // do changes on widgetThatWillChange * // ... * animation->start(); * \endcode * * \note The widget that changes needs to have a parent widget. KexiFadeWidgetEffect does not work * for toplevel widgets (windows). */ class KEXIUTILS_EXPORT KexiFadeWidgetEffect : public QWidget { Q_OBJECT public: /** * Create the animation widget. Takes a snapshot of the \p destWidget to use as old image * that gets faded out. * * \param destWidget The widget that will change and should fade to the new look. * \param defaultDuration The duration of the animation activated by start() in milliseconds. */ KexiFadeWidgetEffect(QWidget *destWidget, int defaultDuration = 250); /** * Destructor. * * \warning KexiFadeWidgetEffect deletes itself after the animation is finished. */ ~KexiFadeWidgetEffect(); public Q_SLOTS: /** * Starts the animation. * * Call this function after all visual changes are done. * * \param duration The duration of the animation in milliseconds. */ void start(int duration); /** * Starts the animation with default duration specified in ctor. * * Call this function after all visual changes are done. */ void start(); protected: /** * \internal */ - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *) override; /** * \internal */ KexiFadeWidgetEffectPrivate *const d; private Q_SLOTS: void finished(); }; #endif diff --git a/src/main/KexiMainWindow_p.h b/src/main/KexiMainWindow_p.h index b85296031..4cb27c5e5 100644 --- a/src/main/KexiMainWindow_p.h +++ b/src/main/KexiMainWindow_p.h @@ -1,714 +1,714 @@ /* This file is part of the KDE project Copyright (C) 2003 Lucijan Busch Copyright (C) 2003-2018 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 KEXIMAINWINDOW_P_H #define KEXIMAINWINDOW_P_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "KexiMainWindow.h" #include "KexiSearchLineEdit.h" #include "KexiUserFeedbackAgent.h" #include "KexiMenuWidget.h" #include "kexifinddialog.h" #include "KexiStartup.h" #include #include #include #include #include #include #include #define KEXI_NO_PROCESS_EVENTS #ifdef KEXI_NO_PROCESS_EVENTS # define KEXI_NO_PENDING_DIALOGS #endif #define PROJECT_NAVIGATOR_TABBAR_ID 0 #define PROPERTY_EDITOR_TABBAR_ID 1 #define KEXITABBEDTOOLBAR_SPACER_TAB_INDEX 1 class QPainter; class KexiAssistantPage; class KexiProjectNavigator; //! @short Main application's tabbed toolbar class KexiTabbedToolBar : public QTabWidget { Q_OBJECT public: explicit KexiTabbedToolBar(QWidget *parent); virtual ~KexiTabbedToolBar(); KToolBar *createWidgetToolBar() const; KToolBar *toolBar(const QString& name) const; void appendWidgetToToolbar(const QString& name, QWidget* widget); void setWidgetVisibleInToolbar(QWidget* widget, bool visible); //! @todo replace with the final Actions API void addAction(const QString& toolBarName, QAction *action); bool mainMenuVisible() const; QRect tabRect(int index) const; KHelpMenu *helpMenu() const; void addSearchableModel(KexiSearchableModel *model); void removeSearchableModel(KexiSearchableModel *model); KToolBar *createToolBar(const char *name, const QString& caption); void setCurrentTab(const QString& name); //! Sets current tab to @a index, counting from first visible (non-Kexi) tab. //! In non-user mode, the first visible tab is "create" tab. void setCurrentTab(int index); void hideTab(const QString& name); void showTab(const QString& name); bool isTabVisible(const QString& name) const; bool isRolledUp(); const QWidget* mainMenuContent(); public Q_SLOTS: void setMainMenuContent(QWidget *w); void selectMainMenuItem(const char *actionName); void showMainMenu(const char* actionName = 0); void hideMainMenu(); void toggleMainMenu(); void activateSearchLineEdit(); void toggleRollDown(); protected: virtual void mouseMoveEvent(QMouseEvent* event) override; virtual void leaveEvent(QEvent* event) override; virtual bool eventFilter(QObject* watched, QEvent* event) override; protected Q_SLOTS: void slotCurrentChanged(int index); void slotDelayedTabRaise(); void slotSettingsChanged(int category); //! Used for delayed loading of the "create" toolbar. Called only once. void setupCreateWidgetToolbar(); void slotTabDoubleClicked(int index); void tabBarAnimationFinished(); private: void addAction(KToolBar *tbar, const char* actionName); void addSeparatorAndAction(KToolBar *tbar, const char* actionName); class Private; Private * const d; }; //! @internal window container created to speedup opening new tabs class KexiWindowContainer : public QWidget { Q_OBJECT public: explicit KexiWindowContainer(QWidget* parent); virtual ~KexiWindowContainer(); void setWindow(KexiWindow* w); QPointer window; private: QVBoxLayout *lyr; }; class EmptyMenuContentWidget : public QWidget { Q_OBJECT public: explicit EmptyMenuContentWidget(QWidget* parent = 0); void alterBackground(); virtual void changeEvent(QEvent *e) override; }; //! @todo KEXI3 is KexiMenuWidgetStyle needed? #if 0 //! A style proxy for KexiMenuWidget class KexiMenuWidgetStyle : public KexiUtils::StyleProxy { public: explicit KexiMenuWidgetStyle(QStyle *style, QObject *parent = 0); virtual ~KexiMenuWidgetStyle(); virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; }; #endif //! Main menu class KexiMainMenu : public QWidget { Q_OBJECT public: explicit KexiMainMenu(KexiTabbedToolBar *toolBar, QWidget* parent = 0); ~KexiMainMenu(); virtual bool eventFilter(QObject * watched, QEvent* event) override; void setContent(QWidget *contentWidget); const QWidget *contentWidget() const; void setPersistentlySelectedAction(KexiMenuWidgetAction* action, bool set); /* void setActiveAction(QAction* action = 0);*/ void selectFirstItem(); tristate showProjectMigrationWizard( const QString& mimeType, const QString& databaseName, const KDbConnectionData *cdata); Q_SIGNALS: void contentAreaPressed(); void hideContentsRequested(); protected Q_SLOTS: //void contentWidgetDestroyed(); protected: virtual void showEvent(QShowEvent * event) override; private: QPointer m_menuWidget; KexiTabbedToolBar* m_toolBar; bool m_initialized; EmptyMenuContentWidget *m_content; QStackedLayout *m_contentLayout = nullptr; QPointer m_contentWidget; QVBoxLayout* m_mainContentLayout = nullptr; QPointer m_persistentlySelectedAction; bool m_selectFirstItem; }; class KexiTabbedToolBarTabBar; //! @internal class Q_DECL_HIDDEN KexiTabbedToolBar::Private : public QObject { Q_OBJECT public: explicit Private(KexiTabbedToolBar *t); KToolBar *createToolBar(const char *name, const QString& caption); int tabIndex; public Q_SLOTS: void showMainMenu(const char* actionName = 0); void hideMainMenu(); void hideContentsOrMainMenu(); void toggleMainMenu(); void updateMainMenuGeometry(); //! Initializes global search line edit. If it is enabled, it's created, if disabled, it's deleted. void initSearchLineEdit(); public: KexiTabbedToolBarTabBar *customTabBar; QPointer mainMenu; KexiTabbedToolBar *q; KActionCollection *ac; int createId; KToolBar *createWidgetToolBar; QHBoxLayout *helpLayer; #ifdef KEXI_AUTORISE_TABBED_TOOLBAR //! Used for delayed tab raising int tabToRaise; //! Used for delayed tab raising QTimer tabRaiseTimer; #endif //! Toolbars for name QHash toolbarsForName; QHash toolbarsIndexForName; QHash toolbarsCaptionForName; QVector toolbarsVisibleForIndex; QHash extraActions; bool rolledUp; QPropertyAnimation tabBarAnimation; QGraphicsOpacityEffect tabBarOpacityEffect; int rolledUpIndex; KHelpMenu *helpMenu; KexiSearchLineEdit *searchLineEdit = nullptr; void setCurrentTab(const QString& name); void hideTab(const QString& name); void showTab(const QString& name); bool isTabVisible(const QString& name) const; #ifndef NDEBUG void debugToolbars() const; #endif int lowestIndex; }; class KexiTabbedToolBarStyle; //! Tab bar reimplementation for KexiTabbedToolBar. /*! The main its purpose is to alter the width of "Kexi" tab. */ class KexiTabbedToolBarTabBar : public QTabBar { Q_OBJECT public: explicit KexiTabbedToolBarTabBar(QWidget *parent = 0); virtual QSize originalTabSizeHint(int index) const; virtual QSize tabSizeHint(int index) const override; KexiTabbedToolBarStyle* customStyle; }; //! Style proxy for KexiTabbedToolBar, to get the "Kexi" tab style right. class KexiTabbedToolBarStyle : public QProxyStyle { Q_OBJECT public: explicit KexiTabbedToolBarStyle(const QString &baseStyleName); virtual ~KexiTabbedToolBarStyle(); virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const override; virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const override; virtual int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const override; }; //! Style proxy for KexiTabbedToolBar, to fix the hardcoded margins (e.g. for Breeze). class KexiDockWidgetStyle : public QProxyStyle { Q_OBJECT public: explicit KexiDockWidgetStyle(const QString &baseStyleName); virtual ~KexiDockWidgetStyle(); using QProxyStyle::polish; - void polish(QWidget* widget) Q_DECL_OVERRIDE; + void polish(QWidget* widget) override; }; class KexiMainWidget; //! @internal tab widget acting as central widget for KexiMainWindow class KexiMainWindowTabWidget : public QTabWidget { Q_OBJECT public: KexiMainWindowTabWidget(QWidget *parent, KexiMainWidget *mainWidget); virtual ~KexiMainWindowTabWidget(); public Q_SLOTS: void closeTab(); tristate closeAllTabs(); protected: //! Shows context menu for tab at @a index at point @a point. //! If @a index is -1, context menu for empty area is requested. void showContextMenuForTab(int index, const QPoint& point); //! Reimplemented to hide frame when no tabs are displayed virtual void paintEvent(QPaintEvent * event) override; virtual void mousePressEvent(QMouseEvent *event) override; KexiMainWidget *m_mainWidget; QAction *m_closeAction; QAction *m_closeAllTabsAction; private: int m_tabIndex; void setTabIndexFromContextMenu(int clickedIndex); }; //! @short A widget being main part of KexiMainWindow class KexiMainWidget : public KMainWindow { Q_OBJECT public: KexiMainWidget(); virtual ~KexiMainWidget(); void setParent(KexiMainWindow* mainWindow); KexiMainWindowTabWidget* tabWidget() const; protected: virtual bool queryClose() override; protected Q_SLOTS: void slotCurrentTabIndexChanged(int index); Q_SIGNALS: void currentTabIndexChanged(int index); private: void setupCentralWidget(); KexiMainWindowTabWidget* m_tabWidget; KexiMainWindow *m_mainWindow; QPointer m_previouslyActiveWindow; friend class KexiMainWindow; friend class KexiMainWindowTabWidget; }; //------------------------------------------ //! @internal Dock widget with floating disabled but still collapsible class KexiDockWidget : public QDockWidget { Q_OBJECT public: KexiDockWidget(const QString &tabText, QWidget *parent); virtual ~KexiDockWidget(); virtual void setSizeHint(const QSize& hint); virtual QSize sizeHint() const override; const QString tabText; //!< for tab bar tabs protected: virtual void paintEvent(QPaintEvent *pe) override; private: class Private; Private * const d; }; //------------------------------------------ //! @internal safer dictionary typedef QMap< int, KexiWindow* > KexiWindowDict; //! @internal class Q_DECL_HIDDEN KexiMainWindow::Private { public: explicit Private(KexiMainWindow* w); ~Private(); #ifndef KEXI_NO_PENDING_DIALOGS //! Job type. Currently used for marking items as being opened or closed. enum PendingJobType { NoJob = 0, WindowOpeningJob, WindowClosingJob }; KexiWindow *openedWindowFor(const KexiPart::Item* item, PendingJobType &pendingType); KexiWindow *openedWindowFor(int identifier, PendingJobType &pendingType); void addItemToPendingWindows(const KexiPart::Item* item, PendingJobType jobType); bool pendingWindowsExist(); void removePendingWindow(int identifier); #else KexiWindow *openedWindowFor(int identifier); #endif void insertWindow(KexiWindow *window); bool windowContainerExistsFor(int identifier) const; void setWindowContainerExistsFor(int identifier, bool set); void updateWindowId(KexiWindow *window, int oldItemID); void removeWindow(int identifier); int openedWindowsCount(); //! Used in KexiMainWindowe::closeProject() void clearWindows(); void showStartProcessMsg(const QStringList& args); //! Updates Property Editor Pane's visibility for the current window and the @a viewMode view mode. /*! @a info can be provided to hadle cases when current window is not yet defined (in openObject()). */ void updatePropEditorVisibility(Kexi::ViewMode viewMode, KexiPart::Info *info = 0); void setTabBarVisible(KMultiTabBar::KMultiTabBarPosition position, int id, KexiDockWidget *dockWidget, bool visible); void setPropertyEditorTabBarVisible(bool visible); QObject *openedCustomObjectsForItem(KexiPart::Item* item, const char* name); void addOpenedCustomObjectForItem(KexiPart::Item* item, QObject* object, const char* name); KexiFindDialog *findDialog(); /*! Updates the find/replace dialog depending on the active view. Nothing is performed if the dialog is not instantiated yet or is invisible. */ void updateFindDialogContents(bool createIfDoesNotExist = false); //! \return the current view if it supports \a actionName, otherwise returns 0. KexiView *currentViewSupportingAction(const char* actionName) const; //! \return the current view if it supports KexiSearchAndReplaceViewInterface. KexiSearchAndReplaceViewInterface* currentViewSupportingSearchAndReplaceInterface() const; tristate showProjectMigrationWizard( const QString& mimeType, const QString& databaseName, const KDbConnectionData *cdata); /** * Returns current page of active visible main menu widget or @c nullptr if there is no visible * menu widget or menu widget contains no page. */ KexiAssistantPage *visibleMainMenuWidgetPage(); KexiMainWindow *wnd; KexiMainWidget *mainWidget; KActionCollection *actionCollection; KHelpMenu *helpMenu; KexiProject *prj; KSharedConfig::Ptr config; #ifdef KEXI_SHOW_CONTEXT_HELP KexiContextHelp *ctxHelp; #endif KexiProjectNavigator *navigator; KexiTabbedToolBar *tabbedToolBar; QMap tabsToActivateOnShow; KexiDockWidget *navDockWidget; QTabWidget *propEditorTabWidget; KexiDockWidget *propEditorDockWidget; QPointer propEditorDockableWidget; //! poits to kexi part which has been previously used to setup proppanel's tabs using //! KexiPart::setupCustomPropertyPanelTabs(), in updateCustomPropertyPanelTabs(). QPointer partForPreviouslySetupPropertyPanelTabs; QMap recentlySelectedPropertyPanelPages; QPointer propEditor; QPointer propertySet; KexiNameDialog *nameDialog; QTimer timer; //!< helper timer QString appCaptionPrefix; // focus_before_popup; //! Set to true only in destructor, used by closeWindow() to know if //! user can cancel window closing. If true user even doesn't see any messages //! before closing a window. This is for extremely sanity... and shouldn't be even needed. bool forceWindowClosing; //! Indicates that we're inside closeWindow() method - to avoid inf. recursion //! on window removing bool insideCloseWindow; #ifndef KEXI_NO_PENDING_DIALOGS //! Used in executeActionWhenPendingJobsAreFinished(). enum ActionToExecuteWhenPendingJobsAreFinished { NoAction, QuitAction, CloseProjectAction }; ActionToExecuteWhenPendingJobsAreFinished actionToExecuteWhenPendingJobsAreFinished; void executeActionWhenPendingJobsAreFinished(); #endif //! Used for delayed windows closing for 'close all' QList windowsToClose; #ifdef KEXI_QUICK_PRINTING_SUPPORT //! Opened page setup dialogs, used by printOrPrintPreviewForItem(). QHash pageSetupWindows; /*! A map from Kexi dialog to "print setup" part item's ID of the data item used by closeWindow() to find an ID of the data item, so the entry can be removed from pageSetupWindows dictionary. */ QMap pageSetupWindowItemID2dataItemID_map; #endif //! Indicates if project is started in User Mode bool userMode; //! Indicates if project navigator should be visible bool isProjectNavigatorVisible; //! Indicates if the main menu should be visible bool isMainMenuVisible; //! Set in restoreSettings() and used in initNavigator() //! to customize navigator visibility on startup bool forceShowProjectNavigatorOnCreation; bool forceHideProjectNavigatorOnCreation; bool navWasVisibleBeforeProjectClosing; bool saveSettingsForShowProjectNavigator; //! Used by openedCustomObjectsForItem() and addOpenedCustomObjectForItem() QHash m_openedCustomObjectsForItem; int propEditorDockSeparatorPos, navDockSeparatorPos; bool wasAutoOpen; bool windowExistedBeforeCloseProject; QMap multiTabBars; bool propertyEditorCollapsed; bool enable_slotPropertyEditorVisibilityChanged; KexiUserFeedbackAgent userFeedback; KexiMigrateManagerInterface* migrateManager; private: //! @todo move to KexiProject KexiWindowDict windows; //! A set of item identifiers for whose there are KexiWindowContainer instances already. //! This lets to verify that KexiWindow is about to be constructed and opened so multiple //! opening can be avoided. QSet windowContainers; #ifndef KEXI_NO_PROCESS_EVENTS QHash pendingWindows; //!< part item identifiers for windows whoose opening has been started //! @todo QMutex dialogsMutex; //!< used for locking windows and pendingWindows dicts #endif KexiFindDialog *m_findDialog; }; //------------------------------------------ //! Action shortcut used by KexiMainWindow::setupMainMenuActionShortcut(QAction *) //! Activates action only if enabled. class KexiMainMenuActionShortcut : public QShortcut { Q_OBJECT public: KexiMainMenuActionShortcut(const QKeySequence& key, QAction *action, QWidget *parent); virtual ~KexiMainMenuActionShortcut(); protected Q_SLOTS: //! Triggers associated action only when this action is enabled void slotActivated(); private: QPointer m_action; }; #endif diff --git a/src/main/kexifinddialog.h b/src/main/kexifinddialog.h index c6ae0fd03..c14f1a4c7 100644 --- a/src/main/kexifinddialog.h +++ b/src/main/kexifinddialog.h @@ -1,139 +1,139 @@ /* This file is part of the KDE project Copyright (C) 2004-2016 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 KEXIFINDDIALOG_H #define KEXIFINDDIALOG_H #include "ui_kexifinddialog.h" #include #include class QAction; //! @short A Kexi-specific "Find" dialog. /*! Also used for as replace dialog. @todo replace m_textToFind and m_textToReplace KComboBoxes with Kexi's db-aware comboboxes, so we ca adapt to datatype being searched, e.g. date, time and numbers */ class KexiFindDialog : public QDialog, private Ui::KexiFindDialog { Q_OBJECT public: //! Creates a new find dialog. Replace mode is off by default. explicit KexiFindDialog(QWidget* parent); virtual ~KexiFindDialog(); //! Sets actions that receive button clicks and shortcuts within the dialog. Should be called once. void setActions(QAction *findnext, QAction *findprev, QAction *replace, QAction *replaceall); //! Shows the dialog as a modal dialog. virtual void show(); //! \return current find and replace options set within the dialog //! @todo should we have setOptions() too? KexiSearchAndReplaceViewInterface::Options options() const; /*! \return a list of column names for 'look in column' combo box. Neither "(All fields)" nor "(Current field)" items are prepended. */ QStringList lookInColumnNames() const; /*! \return a list of column captions (i.e. visible values) for 'look in column' combo box. Neither "(All fields)" nor "(Current field)" items are prepended. */ QStringList lookInColumnCaptions() const; /*! \return column name selected in "look in column" combo box. If "(All fields)" item is selected, empty string is returned. If "(Current field)" item is selected, "(field)" string is returned. */ QString currentLookInColumnName() const; //! \return value that to be used for searching QVariant valueToFind() const; //! \return value that to be used as a replacement QVariant valueToReplaceWith() const; public Q_SLOTS: /*! Sets \a columnNames list and \a columnCaptions for 'look in column' combo box. \a columnCaptions are visible values, while \a columnNames are used for returning in currentLookInColumn(). "(All fields)" and "(Current field)" items are also prepended. */ void setLookInColumnList(const QStringList& columnNames, const QStringList& columnCaptions); /*! Selects \a columnName to be selected 'look in column'. By default "(All fields)" item is selected. To select this item, pass empty string as \a columnName. To select "(Current field)" item, "(field)" string should be passed as \a columnName. */ void setCurrentLookInColumnName(const QString& columnName); /*! Sets or clears replace mode. For replace mode 'prompt or replace' option is visible. */ void setReplaceMode(bool set); /*! Sets object name for caption, so for example it will be set to xi18n("Find \"Persons\"")). */ void setObjectNameForCaption(const QString& name); /*! Enables of disables the find/replace/replace all buttons. This is used if for the current context the dialog could not be used. If \a enable is false, object name for caption is cleared using setObjectNameForCaption() too. */ void setButtonsEnabled(bool enable); /*! Sets message at the bottom to \a message. */ void setMessage(const QString& message); /*! Updates message at the bottom; "The search item was not found" is set if \a found is true, else the message is cleared. */ //! @todo add "Search again" hyperlink void updateMessage(bool found = true); void addToFindHistory(); void addToReplaceHistory(); Q_SIGNALS: //! Emitted after clicking "Find next" button or pressing appropriate shortcut set by setActions() void findNext(); //! Emitted after pressing appropriate shortcut set by setActions() void findPrevious(); //! Emitted after clicking "Replace" button or pressing appropriate shortcut set by setActions() void replaceNext(); //! Emitted after clicking "Replace All" button or pressing appropriate shortcut set by setActions() void replaceAll(); protected Q_SLOTS: void updateMessage(const QString&) { updateMessage(); } protected: - bool event(QEvent *e) Q_DECL_OVERRIDE; + bool event(QEvent *e) override; class Private; Private * const d; }; #endif diff --git a/src/migration/AlterSchemaTableModel.h b/src/migration/AlterSchemaTableModel.h index a557a978b..378c34cb5 100644 --- a/src/migration/AlterSchemaTableModel.h +++ b/src/migration/AlterSchemaTableModel.h @@ -1,58 +1,58 @@ /* This file is part of the KDE project Copyright (C) 2009 Adam Pigg Copyright (C) 2009-2016 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 version 2 as published by the Free Software Foundation. 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 ALTERSCHEMATABLEMODEL_H #define ALTERSCHEMATABLEMODEL_H #include #include #include class KDbTableSchema; class AlterSchemaTableModel : public QAbstractTableModel { Q_OBJECT public: explicit AlterSchemaTableModel(QObject* parent = nullptr); ~AlterSchemaTableModel(); virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; void setSchema(KDbTableSchema *schema); void setData(QList *data); void setRowCount(int i); private: //! Reimplemented just to avoid 'hidden' warnings bool setData(const QModelIndex & index, const QVariant & value, - int role = Qt::EditRole) Q_DECL_OVERRIDE + int role = Qt::EditRole) override { return QAbstractTableModel::setData(index, value, role); } KDbTableSchema *m_schema; QList *m_data; //!< Small amount of data to display to user int m_recordCount; }; #endif // ALTERSCHEMATABLEMODEL_H diff --git a/src/migration/KexiSqlMigrate.h b/src/migration/KexiSqlMigrate.h index 1cda1c23e..b68692b87 100644 --- a/src/migration/KexiSqlMigrate.h +++ b/src/migration/KexiSqlMigrate.h @@ -1,81 +1,81 @@ /* This file is part of the KDE project Copyright (C) 2004 Martin Ellis Copyright (C) 2006-2016 Jarosław Staniek 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 KEXISQLMIGRATE_H #define KEXISQLMIGRATE_H #include //! @short A specialized class for a migrate plugin that imports native SQL databases into Kexi projects //! Compared to more generic KexiMigrate, KexiSqlMigrate implements needed methods using //! low level APIs of KDb. This is used for example by MySQL and PostgreSQL migration plugins. class KEXIMIGRATE_EXPORT KexiSqlMigrate : public KexiMigration::KexiMigrate { Q_OBJECT public: //! Constructs a migrate plugin that uses low level APIs of KDb driver @a kdbDriverId. //! @a kdbDriverId must not be empty. explicit KexiSqlMigrate(const QString &kdbDriverId, QObject *parent, const QVariantList& args = QVariantList()); virtual ~KexiSqlMigrate(); protected: //! Driver specific function to return table names - bool drv_tableNames(QStringList *tablenames) Q_DECL_OVERRIDE; + bool drv_tableNames(QStringList *tablenames) override; //! Driver specific implementation to read a table schema bool drv_readTableSchema( - const QString& originalName, KDbTableSchema *tableSchema) Q_DECL_OVERRIDE; + const QString& originalName, KDbTableSchema *tableSchema) override; //! Driver specific connection creation - KDbConnection* drv_createConnection() Q_DECL_OVERRIDE; + KDbConnection* drv_createConnection() override; /*! Fetches single string at column \a columnNumber for each record from result obtained by running \a sqlStatement. \a numRecords can be specified to limit number of records read. If \a numRecords is -1, all records are loaded. @see KexiMigrate::drv_queryStringListFromSql() */ tristate drv_queryStringListFromSql( const KDbEscapedString& sqlStatement, int columnNumber, - QStringList *stringList, int numRecords = -1) Q_DECL_OVERRIDE; + QStringList *stringList, int numRecords = -1) override; //! Copy a table from source DB to target DB (driver specific) bool drv_copyTable(const QString& srcTable, KDbConnection *destConn, KDbTableSchema* dstTable, - const RecordFilter *recordFilter = nullptr) Q_DECL_OVERRIDE; + const RecordFilter *recordFilter = nullptr) override; - bool drv_progressSupported() Q_DECL_OVERRIDE { + bool drv_progressSupported() override { return true; } - bool drv_getTableSize(const QString& table, quint64* size) Q_DECL_OVERRIDE; + bool drv_getTableSize(const QString& table, quint64* size) override; //! @todo move this somewhere to low level class (MIGRATION?) virtual bool drv_getTablesList( QStringList &list ); //! @todo move this somewhere to low level class (MIGRATION?) virtual bool drv_containsTable( const QString &tableName ); //Extended API //! Starts reading data from the source dataset's table - QSharedPointer drv_readFromTable(const QString & tableName) Q_DECL_OVERRIDE; + QSharedPointer drv_readFromTable(const QString & tableName) override; const QString m_kdbDriverId; }; #endif diff --git a/src/migration/mdb/src/keximdb/mdbmigrate.h b/src/migration/mdb/src/keximdb/mdbmigrate.h index 99d0f2dda..eb6f9e4d8 100644 --- a/src/migration/mdb/src/keximdb/mdbmigrate.h +++ b/src/migration/mdb/src/keximdb/mdbmigrate.h @@ -1,95 +1,95 @@ /* This file is part of the KDE project Copyright (C) 2005,2006 Martin Ellis Copyright (C) 2005-2016 Jarosław Staniek 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 MDBMIGRATE_H #define MDBMIGRATE_H #include #include #include #include namespace KexiMigration { class MDBMigrate : public KexiMigrate { Q_OBJECT public: explicit MDBMigrate(QObject *parent, const QVariantList& args = QVariantList()); virtual ~MDBMigrate(); //! Convert an MDB type to a KDb type, prompting user if necessary. KDbField::Type type(int type); //! Get the table definition for a given table name /*! Look up the table definition for the given table. This only returns a ptr to the MdbTableDef - it doesn't load e.g. the column data. Remember to mdb_free_tabledef the table definition when it's finished with. \return the table definition, or null if no matching table was found */ MdbTableDef* getTableDef(const QString& tableName); QVariant toQVariant(const char* data, unsigned int len, int type); bool getPrimaryKey(KDbTableSchema* table, MdbTableDef* tableDef); //! Reimplemented to add support for "sourceDatabaseHasNonUnicodeEncoding" property //! @todo this should be in KDbConnection class but Migration framework has no such yet! virtual QVariant propertyValue(const QByteArray& propName) override; protected: //! Driver specific function to return table names virtual bool drv_tableNames(QStringList *tablenames) override; //! Driver specific implementation to read a table schema virtual bool drv_readTableSchema( const QString& originalName, KDbTableSchema *tableSchema) override; //! Creates connection object to the source database (driver-specific). - KDbConnection* drv_createConnection() Q_DECL_OVERRIDE; + KDbConnection* drv_createConnection() override; //! Driver specific connection implementation virtual bool drv_connect() override; //! Disconnect from the db backend virtual bool drv_disconnect() override; //! Copy MDB table to a KDb table bool drv_copyTable(const QString& srcTable, KDbConnection *destConn, KDbTableSchema* dstTable, - const RecordFilter *recordFilter = nullptr) Q_DECL_OVERRIDE; + const RecordFilter *recordFilter = nullptr) override; virtual bool drv_progressSupported() override { return true; } virtual bool drv_getTableSize(const QString& table, quint64 *size) override; private: MdbHandle *m_mdb = nullptr; }; } #endif diff --git a/src/migration/migratemanager.h b/src/migration/migratemanager.h index 1efc5f7b8..c9b604dc2 100644 --- a/src/migration/migratemanager.h +++ b/src/migration/migratemanager.h @@ -1,89 +1,89 @@ /* This file is part of the KDE project Copyright (C) 2003-2016 Jarosław Staniek 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 KEXI_MIGRATION_MNGR_H #define KEXI_MIGRATION_MNGR_H #include #include #include #include #include "keximigrate.h" namespace KexiMigration { class MigrateManagerInternal; //! @short Migration library management, for finding and loading migration drivers. class KEXIMIGRATE_EXPORT MigrateManager : public QObject, public KexiMigrateManagerInterface { Q_OBJECT public: MigrateManager(); virtual ~MigrateManager(); //! @return result of the recent operation. KDbResult result() const; //! @return KDbResultable object for the recent operation. //! It adds serverResultName() in addition to the result(). const KDbResultable* resultable() const; /*! Tries to load db driver with identifier @a id. The id is case insensitive. \return db driver, or @c nullptr on error (then error message is also set) */ KexiMigrate* driver(const QString &id); /*! returns list of available drivers IDs. That drivers can be loaded by first use of driver() method. */ const QStringList driverIds(); /*! @return list of driver IDs for @a mimeType mime type. Empty list is returned if no driver has been found. Works only with drivers of file-based databases such as SQLite. The lookup is case insensitive. */ QStringList driverIdsForMimeType(const QString &mimeType); /*! @return list of all migration driver IDs that support source KDb database driver ID @a sourceDriverId. The lookup is case insensitive. */ QStringList driverIdsForSourceDriver(const QString &sourceDriverId); //! @todo copied from KDbDriverManager, merge it. /*! HTML information about possible problems encountered. It's displayed in 'details' section, if an error encountered. Currently it contains a list of incompatible migration drivers. */ QString possibleProblemsMessage() const; //! @return list of file MIME types that are supported by migration drivers - QStringList supportedFileMimeTypes() Q_DECL_OVERRIDE; + QStringList supportedFileMimeTypes() override; //! @return list of KDb driver IDs supported that are supported by migration drivers - QStringList supportedSourceDriverIds() Q_DECL_OVERRIDE; + QStringList supportedSourceDriverIds() override; }; } //namespace KexiMigrate #endif diff --git a/src/migration/tsv/TsvMigrate.cpp b/src/migration/tsv/TsvMigrate.cpp index 75dd6aa2c..22a0d648f 100644 --- a/src/migration/tsv/TsvMigrate.cpp +++ b/src/migration/tsv/TsvMigrate.cpp @@ -1,269 +1,269 @@ /* This file is part of the KDE project Copyright (C) 2004-2009 Adam Pigg Copyright (C) 2016 Jarosław Staniek 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 "TsvMigrate.h" #include #include #include #include #include #include #include const int MAX_SAMPLE_TEXT_SIZE = 1024 * 10; // max 10KiB of text to detect encoding using namespace KexiMigration; /* This is the implementation for the TSV file import routines. */ KEXI_PLUGIN_FACTORY(TsvMigrate, "keximigrate_tsv.json") namespace KexiMigration { struct FileInfo { QFile file; QTextCodec *codec; QVector fieldNames; }; } TsvMigrate::TsvMigrate(QObject *parent, const QVariantList& args) : KexiMigrate(parent, args) { } TsvMigrate::~TsvMigrate() { } KDbConnection* TsvMigrate::drv_createConnection() { // nothing to do, just success m_result = KDbResult(); return nullptr; } bool TsvMigrate::drv_connect() { return QDir().exists(data()->source->databaseName()); } bool TsvMigrate::drv_disconnect() { return true; } bool TsvMigrate::drv_tableNames(QStringList *tablenames) { // return base part of filename only so table name will look better tablenames->append(QFileInfo(data()->source->databaseName()).baseName()); return true; } //! @return next line read from the file split by tabs, decoded to unicode and with last \n removed static QVector readLine(FileInfo *info, bool *eof) { QByteArray line = info->file.readLine(); int count = line.length(); if (line.endsWith('\n')) { --count; } if (line.isEmpty()) { *eof = true; return QVector(); } *eof = false; int i = 0; int start = 0; int fields = 0; QVector result(info->fieldNames.isEmpty() ? 10 : info->fieldNames.count()); for (; i < count; ++i) { if (line[i] == '\t') { if (fields >= result.size()) { result.resize(result.size() * 2); } result[fields] = line.mid(start, i - start); ++fields; start = i + 1; } } result[fields] = line.mid(start, i - start); // last value result.resize(fields + 1); return result; } bool TsvMigrate::drv_copyTable(const QString& srcTable, KDbConnection *destConn, KDbTableSchema* dstTable, const RecordFilter *recordFilter) { Q_UNUSED(srcTable) FileInfo info; if (!openFile(&info)) { return false; } Q_FOREVER { bool eof; QVector line = readLine(&info, &eof); if (eof) { break; } QList vals; for(int i = 0; i < line.count(); ++i) { vals.append(line.at(i)); } if (recordFilter && !(*recordFilter)(vals)) { continue; } if (!destConn->insertRecord(dstTable, vals)) { return false; } } return true; } bool TsvMigrate::drv_readTableSchema(const QString& originalName, KDbTableSchema *tableSchema) { Q_UNUSED(originalName) FileInfo info; if (!openFile(&info)) { return false; } for (const QString &name : info.fieldNames) { KDbField *f = new KDbField(name, KDbField::Text); if (!tableSchema->addField(f)) { delete f; tableSchema->clear(); return false; } } return true; } class TsvRecord : public KDbSqlRecord { public: inline explicit TsvRecord(const QVector &values, const FileInfo &m_info) : m_values(values), m_info(&m_info) { } - inline QString stringValue(int index) Q_DECL_OVERRIDE { + inline QString stringValue(int index) override { return m_info->codec->toUnicode(m_values.value(index)); } - inline QByteArray toByteArray(int index) Q_DECL_OVERRIDE { + inline QByteArray toByteArray(int index) override { return m_values.value(index); } - inline KDbSqlString cstringValue(int index) Q_DECL_OVERRIDE { + inline KDbSqlString cstringValue(int index) override { return KDbSqlString(m_values[index].constData(), m_values[index].length()); } private: const QVector m_values; const FileInfo *m_info; }; class TsvResult : public KDbSqlResult { public: inline explicit TsvResult(FileInfo *info) : m_info(info), m_eof(false) { Q_ASSERT(info); } - inline int fieldsCount() Q_DECL_OVERRIDE { + inline int fieldsCount() override { return m_info->fieldNames.count(); } //! Not needed for ImportTableWizard - inline KDbSqlField *field(int index) Q_DECL_OVERRIDE { + inline KDbSqlField *field(int index) override { Q_UNUSED(index); return nullptr; } //! Not needed for ImportTableWizard - inline KDbField* createField(const QString &tableName, int index) Q_DECL_OVERRIDE { + inline KDbField* createField(const QString &tableName, int index) override { Q_UNUSED(tableName); Q_UNUSED(index); return nullptr; } - inline QSharedPointer fetchRecord() Q_DECL_OVERRIDE { + inline QSharedPointer fetchRecord() override { QSharedPointer sqlRecord; QVector record = readLine(m_info, &m_eof); if (!m_eof) { sqlRecord.reset(new TsvRecord(record, *m_info)); } return sqlRecord; } - inline KDbResult lastResult() Q_DECL_OVERRIDE { + inline KDbResult lastResult() override { return KDbResult(); } inline ~TsvResult() { delete m_info; } private: FileInfo *m_info; bool m_eof; }; QSharedPointer TsvMigrate::drv_readFromTable(const QString &tableName) { Q_UNUSED(tableName) QSharedPointer sqlResult; QScopedPointer info(new FileInfo); if (openFile(info.data())) { sqlResult.reset(new TsvResult(info.take())); } return sqlResult; } bool TsvMigrate::openFile(FileInfo *info) { info->file.setFileName(data()->source->databaseName()); if (!info->file.open(QIODevice::ReadOnly | QIODevice::Text)) { return false; } { const QByteArray sample(info->file.read(MAX_SAMPLE_TEXT_SIZE)); info->codec = QTextCodec::codecForUtfText(sample); } if (!info->file.seek(0)) { info->codec = 0; info->file.close(); return false; } bool eof; QVector record = readLine(info, &eof); info->fieldNames.resize(record.count()); for (int i = 0; i < record.count(); ++i) { info->fieldNames[i] = info->codec->toUnicode(record[i]); } return !eof; } #include "TsvMigrate.moc" diff --git a/src/migration/tsv/TsvMigrate.h b/src/migration/tsv/TsvMigrate.h index c59f540e2..cd7c22779 100644 --- a/src/migration/tsv/TsvMigrate.h +++ b/src/migration/tsv/TsvMigrate.h @@ -1,73 +1,73 @@ /* This file is part of the KDE project Copyright (C) 2004-2009 Adam Pigg Copyright (C) 2016 Jarosław Staniek 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 KEXITSVMIGRATE_H #define KEXITSVMIGRATE_H #include #include class QTextCodec; namespace KexiMigration { struct FileInfo; //! "Tab Separated Values" document import plugin class TsvMigrate : public KexiMigrate { Q_OBJECT public: explicit TsvMigrate(QObject *parent, const QVariantList &args = QVariantList()); virtual ~TsvMigrate(); protected: //! Connect to source - KDbConnection* drv_createConnection() Q_DECL_OVERRIDE; + KDbConnection* drv_createConnection() override; - bool drv_connect() Q_DECL_OVERRIDE; + bool drv_connect() override; //! Disconnect from source virtual bool drv_disconnect() override; //! Get table names in source virtual bool drv_tableNames(QStringList *tablenames) override; bool drv_copyTable(const QString& srcTable, KDbConnection *destConn, KDbTableSchema* dstTable, - const RecordFilter *recordFilter = 0) Q_DECL_OVERRIDE; + const RecordFilter *recordFilter = 0) override; //! Read schema for a given table virtual bool drv_readTableSchema(const QString& originalName, KDbTableSchema *tableSchema) override; //! Starts reading data from the source dataset's table - QSharedPointer drv_readFromTable(const QString & tableName) Q_DECL_OVERRIDE; + QSharedPointer drv_readFromTable(const QString & tableName) override; private: bool openFile(FileInfo *info); }; } #endif diff --git a/src/widget/KexiListView.h b/src/widget/KexiListView.h index 6c69c606e..b3eee670d 100644 --- a/src/widget/KexiListView.h +++ b/src/widget/KexiListView.h @@ -1,46 +1,46 @@ /* This file is part of the KDE project Copyright (C) 2016 Jarosław Staniek Forked from kwidgetsaddons/src/kpageview_p.h: Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) Copyright (C) 2007 Rafael Fernández López (ereslibre@kde.org) 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 KEXILISTVIEW_H #define KEXILISTVIEW_H #include #include "kexiextwidgets_export.h" class KEXIEXTWIDGETS_EXPORT KexiListView : public QListView { Q_OBJECT public: explicit KexiListView(QWidget *parent = 0); virtual ~KexiListView(); - void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; + void setModel(QAbstractItemModel *model) override; private Q_SLOTS: void updateWidth(); }; #endif diff --git a/src/widget/KexiListView_p.h b/src/widget/KexiListView_p.h index 1c21690f7..3a2071ec9 100644 --- a/src/widget/KexiListView_p.h +++ b/src/widget/KexiListView_p.h @@ -1,61 +1,61 @@ /* This file is part of the KDE project Copyright (C) 2016 Jarosław Staniek Forked from kwidgetsaddons/src/kpageview_p.h: Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) Copyright (C) 2007 Rafael Fernández López (ereslibre@kde.org) 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 KEXILISTVIEW_P_H #define KEXILISTVIEW_P_H #include #include class KexiListViewDelegate : public QAbstractItemDelegate { Q_OBJECT public: explicit KexiListViewDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; + const QModelIndex &index) const override; QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; + const QModelIndex &index) const override; private: void drawFocus(QPainter *, const QStyleOptionViewItem &, const QRect &) const; }; class KexiListViewSelectionModel : public QItemSelectionModel { Q_OBJECT public: KexiListViewSelectionModel(QAbstractItemModel *model, QObject *parent); public Q_SLOTS: - void clear() Q_DECL_OVERRIDE; + void clear() override; void select(const QModelIndex &index, - QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE; + QItemSelectionModel::SelectionFlags command) override; void select(const QItemSelection &selection, - QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE; + QItemSelectionModel::SelectionFlags command) override; }; #endif