File indexing completed on 2024-05-19 12:54:51

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
0003    Copyright (C) 2003-2018 Jarosław Staniek <staniek@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KEXIMAINWINDOW_H
0022 #define KEXIMAINWINDOW_H
0023 
0024 //#define KEXI_IMPL_WARNINGS
0025 
0026 #include "keximain_export.h"
0027 
0028 #include <core/KexiMainWindowIface.h>
0029 #include <core/kexiguimsghandler.h>
0030 
0031 #include <QCommandLineOption>
0032 #include <QMainWindow>
0033 #include <QTabWidget>
0034 
0035 class QPaintEvent;
0036 class KDbObject;
0037 class KDbConnectionData;
0038 class KexiProjectData;
0039 class KexiObjectViewWidget;
0040 namespace KexiPart
0041 {
0042 class Info;
0043 class Part;
0044 }
0045 
0046 /**
0047  * @short Kexi's main window implementation
0048  */
0049 class KEXIMAIN_EXPORT KexiMainWindow
0050             : public QMainWindow, public KexiMainWindowIface, public KexiGUIMessageHandler
0051 {
0052     Q_OBJECT
0053 
0054 public:
0055     /*! Creates an empty mainwindow. */
0056     explicit KexiMainWindow(QWidget *parent = 0);
0057     virtual ~KexiMainWindow();
0058 
0059     virtual KActionCollection* actionCollection() const override;
0060 
0061 //! @todo virtual QWidget* focusWidget() const;
0062     virtual QWidget* focusWidget() const override {
0063         return QMainWindow::focusWidget();
0064     }
0065 
0066     /*! Used by the main Kexi's routine. Creates a new Kexi main window.
0067      For Kexi applications @a arguments are equal to CoreApplication::arguments() but test
0068      applications alter the list.
0069      If @a componentName is provided, it is assigned to application's KAboutData::componentName.
0070      It's not used by Kexi itself but is useful for test application that are based
0071      on KexiMainWindow.
0072      @a extraOptions can be supplied to extend the list of supported options.
0073      @note Extra options must not override Kexi's built-in options.
0074      @return 0 on success (the result can be used as a result of main()) and other value on error */
0075     static int create(const QStringList &arguments, const QString &componentName = QString(),
0076                       const QList<QCommandLineOption> &extraOptions = QList<QCommandLineOption>());
0077 
0078     //! Project data of currently opened project or NULL if no project here yet.
0079     virtual KexiProject *project() override;
0080 
0081     /*! Registers window \a window for watching and adds it to the main window's stack. */
0082     virtual void registerChild(KexiWindow *window) override;
0083 
0084     /*! Activates a window by it's document identifier.
0085      \return false if doc couldn't be raised or isn't opened. */
0086     bool activateWindow(int id);
0087 
0088     /*! Like above, using \a window passed explicitly. Above method just calls this one. */
0089     bool activateWindow(KexiWindow& window);
0090 
0091     /*! Performs startup actions. \return false if application should exit immediately
0092      with an error status. */
0093     tristate startup();
0094 
0095     /*! \return true if the application window is in the User Mode. */
0096     virtual bool userMode() const override;
0097 
0098     //! @return current global mode
0099     Kexi::GlobalViewMode currentMode() const override;
0100 
0101     /*! \return true if opening of item \a item in \a viewMode mode is allowed.
0102      userMode() is taken into account as well
0103      as KexiPart::PartInfo::supportedUserViewModes() for \a  item. */
0104     bool openingAllowed(KexiPart::Item* item, Kexi::ViewMode viewMode, QString* errorMessage = 0);
0105 
0106     /*! Implemented for KexiMainWindow. */
0107     virtual QList<QAction*> allActions() const override;
0108 
0109     /*! \return currently active window or 0 if there is no active window.
0110      Implemented for KexiWindow. */
0111     virtual KexiWindow* currentWindow() const override;
0112 
0113     /*! @return window for tab @a tabIndex or 0 if there is no such tab. */
0114     KexiWindow* windowForTab(int tabIndex) const;
0115 
0116 //! @todo temporary solution before the tabbed toolbar framework emerges
0117     // see KexiMainWindowIface
0118     virtual void appendWidgetToToolbar(const QString& name, QWidget* widget) override;
0119 
0120 //! @todo temporary solution before the tabbed toolbar framework emerges
0121     // see KexiMainWindowIface
0122     virtual void setWidgetVisibleInToolbar(QWidget* widget, bool visible) override;
0123 
0124 //! @todo replace with the final Actions API
0125     // see KexiMainWindowIface
0126     virtual void addToolBarAction(const QString& toolBarName, QAction *action) override;
0127 
0128     // see KexiMainWindowIface
0129     virtual KToolBar *toolBar(const QString& name) const override;
0130 
0131     //! Shows design tab @a tabName again and activates it as current if it was hidden
0132     //! before for the same object.
0133     void restoreDesignTabAndActivateIfNeeded(const QString &tabName);
0134 
0135     //! Shows design tab again when switching between objects or views.
0136     void restoreDesignTabIfNeeded(const QString &pluginId, Kexi::ViewMode viewMode, int previousItemId);
0137 
0138     //! Sets currently visible design tab when switching to design view, according to object type opened.
0139     virtual void activateDesignTabIfNeeded(const QString &pluginId, Kexi::ViewMode viewMode);
0140 
0141     //! Hides design tabs when they are closed (depending on ID @a pluginId).
0142     //! If @a pluginId is empty, all tabs get hidden.
0143     virtual void hideDesignTab(int itemId, const QString &pluginId = QString());
0144 
0145     /*! Implemented for KexiMainWindow */
0146     virtual KexiUserFeedbackAgent* userFeedbackAgent() const override;
0147 
0148     /*! Implemented for KexiMainWindow */
0149     virtual KexiMigrateManagerInterface* migrateManager() override;
0150 
0151 public Q_SLOTS:
0152     /*! Implemented for KexiMainWindow */
0153     virtual tristate closeWindow(KexiWindow *window) override;
0154 
0155     /*! Closes the current window. */
0156     tristate closeCurrentWindow();
0157 
0158     /*! Closes window inside tab @a tabIndex. */
0159     tristate closeWindowForTab(int tabIndex);
0160 
0161     /*! Closes all windows. */
0162     tristate closeAllWindows();
0163 
0164     /*! Internal implementation. If \a doNotSaveChanges is true,
0165      messages asking for saving the will be skipped and the changes will be dropped.
0166      This should not be usually used, maybe except for test suites
0167      (see kexi/tests/altertable/ directory). */
0168     tristate closeWindow(KexiWindow *window, bool layoutTaskBar, bool doNotSaveChanges = false);
0169 
0170     /**
0171      * Activates next window
0172      *
0173      * If any assistant window is active and visible, moves to previous page of the assistant.
0174      * If assistant window is not active, this action triggers activateNextTab() if tabs are present.
0175      */
0176     void activateNextWindow();
0177 
0178     /**
0179      * Activates previous window
0180      *
0181      * If any assistant window is active and visible, moves to previous page of the assistant.
0182      * If assistant window is not active, this action triggers activatePreviousTab() if tabs are present.
0183      */
0184     void activatePreviousWindow();
0185 
0186     /*! Activates next tab if tabs are present. */
0187     void activateNextTab();
0188 
0189     /*! Activates next tab if tabs are present. */
0190     void activatePreviousTab();
0191 
0192 //! @todo move part of this to KexiProject, because currently KexiProject::openObject() allows multiple opens!
0193     /*! Opens object pointed by \a item in a view \a viewMode.
0194      \a staticObjectArgs can be passed for static object
0195      (only works when part for this item is of type KexiPart::StaticPart).
0196      \a openingCancelled is set to true if opening has been cancelled.
0197      \a errorMessage, if not 0, points to a string that can be set to error message
0198      if one encountered.
0199      @c nullptr can be returned if the KexiWindow object for @a item is not yet fully constructed
0200      but openObject() has been quickly called again for the same @a item. This can happen if user
0201      clicked multiple times on the same Project navigator's item. In this case @a openingCancelled
0202      is not set; the caller should not display error message but the opening should be silently abandoned. */
0203     virtual KexiWindow* openObject(KexiPart::Item *item, Kexi::ViewMode viewMode,
0204                                    bool *openingCancelled, QMap<QString, QVariant>* staticObjectArgs = 0,
0205                                    QString* errorMessage = 0) override;
0206 
0207     //! For convenience
0208     virtual KexiWindow* openObject(const QString& pluginId, const QString& name,
0209                                    Kexi::ViewMode viewMode, bool *openingCancelled,
0210                                    QMap<QString, QVariant>* staticObjectArgs = 0) override;
0211 
0212     /*! Closes the object for \a item.
0213      \return true on success (closing can be dealyed though), false on failure and cancelled
0214      if the object has "opening" job assigned. */
0215     virtual tristate closeObject(KexiPart::Item* item) override;
0216 
0217     /*! Implemented for KexiMainWindow */
0218     virtual tristate saveObject(KexiWindow *window,
0219                                 const QString& messageWhenAskingForName = QString(),
0220                                 SaveObjectOptions options = 0) override;
0221 
0222     /*! Implemented for KexiMainWindowIface. */
0223     virtual KexiWindow *openedWindowFor(int identifier) override;
0224     virtual KexiWindow *openedWindowFor(const KexiPart::Item *item) override;
0225 
0226     /*! Implemented for KexiMainWindowIface */
0227     virtual QList<QVariant> currentParametersForQuery(int queryId) const override;
0228 
0229     /*! Implemented for KexiMainWindowIface. */
0230     virtual KDbQuerySchema *unsavedQuery(int queryId) override;
0231 
0232     /*! Implemented for KexiMainWindow */
0233     virtual tristate getNewObjectInfo(KexiPart::Item *partItem,
0234                                       const QString &originalName,
0235                                       KexiPart::Part *part,
0236                                       bool allowOverwriting, bool *overwriteNeeded,
0237                                       const QString& messageWhenAskingForName = QString()) override;
0238 
0239     /*! Implemented for KexiMainWindow */
0240     virtual void highlightObject(const QString& pluginId, const QString& name) override;
0241 
0242     /*! Opens project pointed by \a projectData.
0243      Application state (e.g. actions) is updated.
0244      \a projectData is copied into a project structures.
0245      \return true on success */
0246     tristate openProject(const KexiProjectData& projectData);
0247 
0248     /*! Helper. Opens project pointed by \a aFileName.
0249      If \a aFileName is empty, a connection shortcut (.kexic file name) is obtained from
0250      global connection set using \a cdata (if present).
0251      In this case:
0252      * If connection shortcut has been found and \a dbName (a server database name) is provided
0253       'kexi --skip-dialog --connection file.kexic dbName' is executed (or the project
0254       is opened directly if there's no project opened in the current Kexi main window.
0255      * If connection shortcut has been found and \a dbName is not provided,
0256       'kexi --skip-dialog file.kexic' is executed (or the connection is opened
0257       directly if there's no porject opened in the current Kexi main window. */
0258     tristate openProject(const QString& aFileName, KDbConnectionData *cdata,
0259                          const QString& dbName = QString(),
0260                          const KexiProjectData::AutoOpenObjects& autoopenObjects = KexiProjectData::AutoOpenObjects());
0261 
0262     /*! Helper. Opens project pointed by \a aFileName.
0263      Like above but \a fileNameForConnectionData can be passed instead of
0264      a pointer to connection data itself.
0265      \return false if \a fileNameForConnectionData is not empty but there is no such
0266      connection in Kexi::connset() for this filename.
0267      \a fileNameForConnectionData can be empty. */
0268     tristate openProject(const QString& aFileName,
0269                          const QString& fileNameForConnectionData, const QString& dbName = QString());
0270 
0271     /*! Helper. Opens project pointed by \a aFileName. */
0272     tristate openProject(const QString& aFileName);
0273 
0274     /*! Opens project referenced by @a data.
0275      If @a shortcutPath is a empty .kexis filename and there is another project opened,
0276      a new instance of Kexi is started with the .kexis file as argument.
0277      Value pointed by @a opened is set to true if the database has been opened successfully.
0278      @return true on successful opening, cancelled if the operation was cancelled
0279      and false on failure.*/
0280     tristate openProject(const KexiProjectData& data, const QString& shortcutPath, bool *opened);
0281 
0282     /*! Creates a new project using template pointed by \a projectData.
0283      Application state (e.g. actions) is updated.
0284      New project data is copied into a project structures.
0285      \return true on success */
0286     tristate createProjectFromTemplate(const KexiProjectData& projectData);
0287 
0288     /*! Closes current project, \return true on success.
0289      Application state (e.g. actions) is updated.
0290      \return true on success.
0291      If closing was cancelled by user, cancelled is returned. */
0292     tristate closeProject();
0293 
0294     //! Shows "print" dialog for \a item.
0295     //! \return true on success.
0296     virtual tristate printItem(KexiPart::Item* item) override;
0297 
0298     //! Shows "print preview" window.
0299     //! \return true on success.
0300     virtual tristate printPreviewForItem(KexiPart::Item* item) override;
0301 
0302     //! Shows "page setup" window for \a item.
0303     //! \return true on success and cancelled when the action was cancelled.
0304     virtual tristate showPageSetupForItem(KexiPart::Item* item) override;
0305 
0306     /*! Executes custom action for the main window, usually provided by a plugin.
0307      Also used by KexiFormEventAction. */
0308     virtual tristate executeCustomActionForObject(KexiPart::Item* item, const QString& actionName) override;
0309 
0310     /*! Add searchable model to the main window. This extends search to a new area.
0311      One example is Project Navigator. @see KexiMainWindowIface */
0312     void addSearchableModel(KexiSearchableModel *model) override;
0313 
0314     /*! Removes searchable model from the main window. @a model is not deleted.
0315      @see KexiMainWindowIface */
0316     void removeSearchableModel(KexiSearchableModel *model) override;
0317 
0318     //! Shows design tab when switching between objects or views. Depends on current window and view mode.
0319     void showDesignTabIfNeeded(int previousItemId);
0320 
0321     void toggleFullScreen(bool isFullScreen);
0322 
0323     /*! Implemented for KexiMainWindowIface.
0324      Sets reasonable dialog size based on main window size, that is 80% of its size. */
0325     virtual void setReasonableDialogSize(QDialog *dialog) override;
0326 
0327 Q_SIGNALS:
0328     //! Emitted to make sure the project can be close.
0329     //! Connect a slot here and set \a cancel to true to cancel the closing.
0330     void acceptProjectClosingRequested(bool *cancel) override;
0331 
0332     //! Emitted before closing the project (and destroying all it's data members).
0333     //! You can do you cleanup of your structures here.
0334     void beforeProjectClosing() override;
0335 
0336     //! Emitted after closing the project.
0337     void projectClosed() override;
0338 
0339     //! Emitted after opening a project, even after slotAutoOpenObjectsLater().
0340     void projectOpened();
0341 
0342 protected:
0343     /*! Setups main menu with sub-menus */
0344     void setupMainMenu();
0345 
0346     /*! Setups main widget */
0347     void setupMainWidget();
0348 
0349     /*! Creates a view widget for object view, used in edit and design global view mode
0350      if it's not yet created. This includes project navigator and property editor. */
0351     void setupObjectView();
0352 
0353     //! Setups object view and assigns project to the project navigator.
0354     void updateObjectView();
0355 
0356     void setupContextHelp();
0357 
0358     void setupPropertyEditor();
0359 
0360     void setupMainMenuActionShortcut(QAction * action);
0361 
0362     /*! Creates standard actions like new, open, save ... */
0363     void setupActions();
0364 
0365     /*! Creates user project-wide actions */
0366     void setupUserActions();
0367 
0368     /*! Sets up the window from user settings. */
0369     void restoreSettings();
0370 
0371     /*! Writes user settings back. */
0372     void storeSettings();
0373 
0374     /*! Invalidates availability of all actions for current application state. */
0375     void invalidateActions();
0376 
0377     /*! Invalidates action availability for current application state.
0378      These actions are dependent on active window. */
0379     virtual void invalidateSharedActions(QObject *o) override;
0380 
0381     /*! Invalidates action availability for current application state.
0382      These actions only depend on project availability, not on curently active window. */
0383     void invalidateProjectWideActions();
0384 
0385     /*! Shows dialog for creating new project, and creates one.
0386      The dialog is not shown if option for automatic creation
0387      is checked or KexiStartupHandler::global()->projectData() was provided from command line.
0388      \a cancelled is set to true if creation has been cancelled (e.g. user answered
0389      no when asked for database overwriting, etc.
0390      \return true if database was created, false on error or when cancel was pressed */
0391     void createNewProject();
0392 
0393     /*! Shows dialog for creating new blank project,
0394      and return a data describing it. If the dialog was cancelled,
0395      \a cancelled will be set to true (false otherwise).
0396      \a shortcutFileName, if not 0, will be set to a shortcut filename
0397      (in case when server database project was selected). */
0398     KexiProjectData* createBlankProjectData(bool *cancelled, bool confirmOverwrites = true, QString *shortcutFileName = 0);
0399 
0400     /*! Reimplemented from KexiSharedActionHost:
0401      accepts only KexiDockBase and KexiWindow subclasses.  */
0402     virtual bool acceptsSharedActions(QObject *w);
0403 
0404     /*! Performs lookup like in KexiSharedActionHost::focusWindow()
0405      but starting from \a w instead of a widget returned by QWidget::focusWidget().
0406      \return NULL if no widget matches acceptsSharedActions() or if \a w is NULL. */
0407     virtual QWidget* findWindow(QWidget *w) override;
0408 
0409     /*! Updates application's caption - also shows project's name. */
0410     void updateAppCaption();
0411 
0412     virtual void closeEvent(QCloseEvent *ev) override;
0413 
0414     void resizeEvent(QResizeEvent *e) override;
0415 
0416     //! Called by KexiMainWidget::queryClose()
0417     bool queryClose();
0418 
0419     /*! Implemented for KexiMainWindowIface.
0420      Switches \a window to view \a mode. Activates the window if it is not the current window. */
0421     virtual tristate switchToViewMode(KexiWindow& window, Kexi::ViewMode viewMode) override;
0422 
0423     /*! Helper. Updates setup of property panel's tabs. Used when switching
0424      from \a prevWindow window to a current window. */
0425     void updateCustomPropertyPanelTabs(KexiWindow *prevWindow, Kexi::ViewMode prevViewMode);
0426 
0427     /*! @overload void updateCustomPropertyPanelTabs(KexiWindow *prevWindow, Kexi::ViewMode prevViewMode) */
0428     void updateCustomPropertyPanelTabs(KexiPart::Part *prevWindowPart,
0429                                        Kexi::ViewMode prevViewMode, KexiPart::Part *curWindowPart, Kexi::ViewMode curViewMode);
0430 
0431     /*! Used in openProject when running another Kexi process is required. */
0432     tristate openProjectInExternalKexiInstance(const QString& aFileName, KDbConnectionData *cdata, const QString& dbName);
0433 
0434     /*! Used in openProject when running another Kexi process is required. */
0435     tristate openProjectInExternalKexiInstance(const QString& aFileName, const QString& fileNameForConnectionData, const QString& dbName);
0436 
0437     /*! Updates info label of the property editor by reusing properties provided
0438      by the current property set.
0439      Read documentation of KexiPropertyPaneWidget class for information about accepted properties.
0440 
0441      Implemented for KexiMainWindow.
0442      @see KexiPropertyPaneWidget::updateInfoLabelForPropertySet() */
0443     void updatePropertyEditorInfoLabel() override;
0444 
0445     //! Activates design tab when switching to design view, according to \a pluginId.
0446     void activateDesignTab(const QString &pluginId);
0447 
0448     //! Sets current global mode
0449     void setCurrentMode(Kexi::GlobalViewMode mode) override;
0450 
0451     void beginPropertyPaneUpdate() override;
0452 
0453     void endPropertyPaneUpdate() override;
0454 
0455 protected Q_SLOTS:
0456     tristate createNewProject(const KexiProjectData &projectData);
0457 
0458     /*! Called once after timeout (after ctors are executed). */
0459     void slotAutoOpenObjectsLater();
0460 
0461     /*! Called if a window (tab) changes from \a prevWindow to \a window. Both parameters can be 0. */
0462     void activeWindowChanged(KexiWindow *window, KexiWindow *prevWindow);
0463 
0464     void slotPartLoaded(KexiPart::Part* p);
0465 
0466     //! Internal - creates and initializes Kexi project object based on @a data.
0467     KexiProject* createKexiProjectObject(const KexiProjectData &data);
0468 
0469     /*! Handles event when user double clicked (or single -depending on settings)
0470      or pressed Return key on the part item in the navigator.
0471      This differs from openObject() signal in that if the object is already opened
0472      in view mode other than \a viewMode, the mode is not changed.
0473      \sa KexiProjectNavigator::openOrActivateItem() */
0474     KexiWindow* openObjectFromNavigator(KexiPart::Item* item,
0475                                         Kexi::ViewMode viewMode, bool *openingCancelled);
0476 
0477     //! For convenience
0478     KexiWindow* openObjectFromNavigator(KexiPart::Item* item, Kexi::ViewMode viewMode);
0479 
0480     /*! Creates new object of type defined by \a info part info.
0481      \a openingCancelled is set to true if opening has been cancelled.
0482      \return true on success. */
0483     virtual bool newObject(KexiPart::Info *info, bool *openingCancelled) override;
0484 
0485     //! For convenience
0486     bool newObject(KexiPart::Info *info) {
0487         bool openingCancelled;
0488         return newObject(info, &openingCancelled);
0489     }
0490 
0491     //! For convenience
0492     KexiWindow* openObject(KexiPart::Item *item, Kexi::ViewMode viewMode,
0493                            QMap<QString, QVariant>* staticObjectArgs = 0) {
0494         bool openingCancelled;
0495         return openObject(item, viewMode, &openingCancelled, staticObjectArgs);
0496     }
0497 
0498     /*! Removes object pointed by \a item from current project.
0499      Asks for confirmation. \return true on success
0500      or cancelled if removing was cancelled (only possible if \a dontAsk is false). */
0501     tristate removeObject(KexiPart::Item *item, bool dontAsk = false);
0502 
0503     /*! Renames object pointed by \a item to a new name \a _newName.
0504      Sets \a success to false on failure. Used as a slot connected
0505      to KexiProjectNavigator::renameItem() signal. */
0506     void renameObject(KexiPart::Item *item, const QString& _newName, bool *succes);
0507 
0508     /*! Changes caption of object pointed by \a item to \a _newCaption.
0509      Sets \a success to false on failure. Used as a slot connected
0510      to KexiProjectNavigator::changeItemCaption() signal. */
0511     void setObjectCaption(KexiPart::Item *item, const QString& _newCaption, bool *succes);
0512 
0513     /*! Reaction for object rename (signalled by KexiProject).
0514      If this item has opened window, it's caption is updated,
0515      and also optionally application's caption. */
0516     virtual void slotObjectRenamed(const KexiPart::Item &item, const QString& oldName) override;
0517 
0518 //! @todo virtual void fillWindowMenu();
0519 
0520     void invalidateSharedActions();
0521     void invalidateSharedActionsLater();
0522 
0523     //! Updates the statusbar, navigator and "Insert->....." actions, dependent on read-only state.
0524     //! Only called on project opening and closing.
0525     void updateReadOnlyState();
0526 
0527     void slotProjectWelcome();
0528     void slotProjectNew();
0529     void slotProjectOpen();
0530     void slotProjectSave();
0531     void slotProjectSaveAs();
0532     void slotProjectPrint();
0533     void slotProjectPrintPreview();
0534     void slotProjectPageSetup();
0535     void slotProjectProperties();
0536     void slotProjectImportExportOrSend();
0537     void slotProjectClose();
0538     void slotProjectRelations();
0539     void slotProjectImportDataTable();
0540     void slotProjectExportDataTable();
0541     void slotProjectQuit();
0542     void slotEditPasteSpecialDataTable();
0543     void slotEditCopySpecialDataTable();
0544     void slotEditFind();
0545     void slotEditFind(bool next); //!< helper
0546     void slotEditFindNext();
0547     void slotEditFindPrevious();
0548     void slotEditReplace(bool all); //!< helper
0549     void slotEditReplace();
0550     void slotEditReplaceNext();
0551     void slotEditReplaceAll();
0552     void slotActivateNavigator();
0553     void slotActivateMainArea();
0554     void slotActivatePropertyPane();
0555     void slotToggleProjectNavigator();
0556     void slotTogglePropertyEditor();
0557     void slotViewDataMode();
0558     void slotViewDesignMode();
0559     void slotViewTextMode(); //!< sometimes called "SQL View"
0560     void slotSettings();
0561     void slotConfigureKeys();
0562     void slotConfigureToolbars();
0563     void slotToolsImportProject();
0564     void slotToolsImportTables();
0565     void slotToolsCompactDatabase();
0566 
0567     void slotReportBug();
0568     void slotTipOfTheDay();
0569     void slotImportFile();
0570     void slotImportServer();
0571 
0572     //! There are performed all actions that need to be done immediately after  ctro (using timer)
0573     void slotLastActions();
0574 
0575     virtual void acceptPropertySetEditing() override;
0576 
0577     virtual void propertySetSwitched(KexiWindow *window, bool force = false,
0578                                      bool preservePrevSelection = true,
0579                                      bool sortedProperties = false,
0580                                      const QByteArray& propertyToSelect = QByteArray()) override;
0581 
0582     /*! Handles changes in 'dirty' flag for windows. */
0583     void slotDirtyFlagChanged(KexiWindow* window);
0584 
0585     /*! Shows Project Migration Wizard. \return true on successful migration,
0586      cancelled on cancellation, and false on failure.
0587      If \a mimeType and \a databaseName are not empty, the wizard will only ask about
0588      parameters of destination project and skip pages related to source project. */
0589     tristate showProjectMigrationWizard(const QString& mimeType, const QString& databaseName);
0590 
0591     /*! @overload tristate showProjectMigrationWizard(const QString& mimeType, const QString& databaseName)
0592      @a cdata is used preselect a server-based connection. */
0593     tristate showProjectMigrationWizard(const QString& mimeType, const QString& databaseName,
0594                                         const KDbConnectionData &cdata);
0595 
0596     //! Receives "selectionChanged()" signal from navigator to update some actions.
0597     void slotPartItemSelectedInNavigator(KexiPart::Item* item);
0598 
0599     /*! Receives the "executeItem" signal from navigator to perform "execute" action
0600      on \a item. \return true on success */
0601     tristate executeItem(KexiPart::Item* item);
0602 
0603     //! Shows "export as data table" dialog for \a item.
0604     tristate exportItemAsDataTable(KexiPart::Item* item);
0605 
0606     //! Shows "copy special as data table" dialog for \a item.
0607     tristate copyItemToClipboardAsDataTable(KexiPart::Item* item);
0608 
0609     bool checkForDirtyFlagOnExport(KexiPart::Item *item, QMap<QString, QString> *args);
0610 
0611     /*! Shows a question message
0612      * "Design of query %1 that you want to export data from is changed and has not yet been saved.
0613      * Do you want to use data from the changed query for exporting or from its original (saved) version?"
0614     \return true if the user picked the first option,
0615      * false if the user picked the second option and cancelled value if user cancelled the export.
0616      */
0617     tristate askOnExportingChangedQuery(KexiPart::Item* item) const;
0618 
0619     //! Shows "print" dialog for \a item.
0620     //! \return true on success.
0621     bool printItem(KexiPart::Item* item, const QString& titleText);
0622 
0623     //! Shows "print" dialog for \a item and \a settings.
0624     //! \return true on success.
0625     //! @todo reenable when ported  bool printItem(KexiPart::Item* item, const KexiSimplePrintingSettings& settings, const QString& titleText = QString());
0626 
0627     /*! Shows "print preview" window for \a item.
0628      The preview windoe is cached, so \a reload == true is sometimes needed
0629      if data or print settings have changed in the meantime.
0630      \return true on success. */
0631     bool printPreviewForItem(KexiPart::Item* item, const QString& titleText, bool reload);
0632 
0633     //! Shows "print preview" window.
0634     //! \return true on success.
0635     //! @todo reenable when ported  bool printPreviewForItem(KexiPart::Item* item, const KexiSimplePrintingSettings& settings, const QString& titleText = QString(), bool reload = false);
0636 
0637     /*! Implemented for KexiMainWindow. Helper for printItem() and printPreviewForItem().
0638      Also used by KexiFormEventAction.
0639      \return true on success and cancelled when the action was cancelled. */
0640     //! @todo reenable when ported  tristate printActionForItem(KexiPart::Item* item, PrintActionType action);
0641 
0642     //void slotSetProjectNavigatorVisible(bool set);
0643     //void slotSetPropertyEditorVisible(bool set);
0644     //void slotProjectNavigatorVisibilityChanged(bool visible);
0645     //void slotPropertyEditorVisibilityChanged(bool visible);
0646     //void slotMultiTabBarTabClicked(int id);
0647     void slotCurrentModeChanged(Kexi::GlobalViewMode previousMode);
0648 
0649     void slotProjectNavigatorVisibilityChanged(bool visible);
0650 
0651 private:
0652     //! Adds action @a name with text @a text and optional shortcut @a shortcut.
0653     //! This is helper method containing workaround for Kexi
0654     //! until QAction::setShortcut() works again.
0655     //! @return created action
0656     QAction * addAction(const char *name, const QString &text, const char *shortcut = 0);
0657 
0658     //! Like @ref addAction(const char *, const QString&, const char *) but also adds
0659     //! icon @a icon.
0660     //! @return created action
0661     QAction * addAction(const char *name, const QIcon &icon, const QString& text,
0662                        const char *shortcut = 0);
0663 
0664     class MessageHandler;
0665     class Private;
0666     Private * const d;
0667 
0668     friend class KexiWindow;
0669     friend class KexiObjectViewWidget;
0670 };
0671 
0672 #endif