File indexing completed on 2024-05-12 16:40:05

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_P_H
0022 #define KEXIMAINWINDOW_P_H
0023 
0024 #include <QKeyEvent>
0025 #include <QScopedPointer>
0026 #include <QTabWidget>
0027 #include <QGraphicsOpacityEffect>
0028 #include <QPropertyAnimation>
0029 #include <QStackedLayout>
0030 #include <QProxyStyle>
0031 #include <QTabBar>
0032 #include <QTimer>
0033 #include <QDockWidget>
0034 #include <QShortcut>
0035 
0036 #include <KToolBar>
0037 #include <KHelpMenu>
0038 #include <KAboutData>
0039 #include <KActionCollection>
0040 #include <KMultiTabBar>
0041 #include <KActionMenu>
0042 #include <KMainWindow>
0043 #include <KSharedConfig>
0044 
0045 #include "KexiMainWindow.h"
0046 #include "KexiSearchLineEdit.h"
0047 #include "KexiUserFeedbackAgent.h"
0048 #include "KexiMenuWidget.h"
0049 #include "kexifinddialog.h"
0050 #include "KexiStartup.h"
0051 #include <kexiutils/utils.h>
0052 #include <widget/utils/KexiDockableWidget.h>
0053 #include <widget/properties/KexiPropertyEditorView.h>
0054 #include <widget/KexiNameDialog.h>
0055 #include <core/kexi.h>
0056 #include <core/KexiWindow.h>
0057 #include <core/kexipartinfo.h>
0058 
0059 #define KEXI_NO_PROCESS_EVENTS
0060 
0061 #ifdef KEXI_NO_PROCESS_EVENTS
0062 # define KEXI_NO_PENDING_DIALOGS
0063 #endif
0064 
0065 #define PROJECT_NAVIGATOR_TABBAR_ID 0
0066 #define PROPERTY_EDITOR_TABBAR_ID 1
0067 #define KEXITABBEDTOOLBAR_SPACER_TAB_INDEX 1
0068 
0069 class QPainter;
0070 class KexiAssistantPage;
0071 class KexiProjectNavigator;
0072 
0073 //! @short Main application's tabbed toolbar
0074 class KexiTabbedToolBar : public QTabWidget
0075 {
0076     Q_OBJECT
0077 public:
0078     explicit KexiTabbedToolBar(QWidget *parent);
0079     virtual ~KexiTabbedToolBar();
0080 
0081     KToolBar *createWidgetToolBar() const;
0082 
0083     KToolBar *toolBar(const QString& name) const;
0084 
0085     void appendWidgetToToolbar(const QString& name, QWidget* widget);
0086 
0087     void setWidgetVisibleInToolbar(QWidget* widget, bool visible);
0088 
0089 //! @todo replace with the final Actions API
0090     void addAction(const QString& toolBarName, QAction *action);
0091 
0092     bool mainMenuVisible() const;
0093 
0094     QRect tabRect(int index) const;
0095 
0096     KHelpMenu *helpMenu() const;
0097 
0098     void addSearchableModel(KexiSearchableModel *model);
0099 
0100     void removeSearchableModel(KexiSearchableModel *model);
0101 
0102     KToolBar *createToolBar(const char *name, const QString& caption);
0103 
0104     void setCurrentTab(const QString& name);
0105 
0106     //! Sets current tab to @a index, counting from first visible (non-Kexi) tab.
0107     //! In non-user mode, the first visible tab is "create" tab.
0108     void setCurrentTab(int index);
0109 
0110     void hideTab(const QString& name);
0111 
0112     void showTab(const QString& name);
0113 
0114     bool isTabVisible(const QString& name) const;
0115 
0116     bool isRolledUp();
0117 
0118     const QWidget* mainMenuContent();
0119 
0120 public Q_SLOTS:
0121     void setMainMenuContent(QWidget *w);
0122     void selectMainMenuItem(const char *actionName);
0123     void showMainMenu(const char* actionName = 0);
0124     void hideMainMenu();
0125     void toggleMainMenu();
0126     void activateSearchLineEdit();
0127     void toggleRollDown();
0128 
0129 protected:
0130     virtual void mouseMoveEvent(QMouseEvent* event) override;
0131     virtual void leaveEvent(QEvent* event) override;
0132     virtual bool eventFilter(QObject* watched, QEvent* event) override;
0133 
0134 protected Q_SLOTS:
0135     void slotCurrentChanged(int index);
0136     void slotDelayedTabRaise();
0137     void slotSettingsChanged(int category);
0138     //! Used for delayed loading of the "create" toolbar. Called only once.
0139     void setupCreateWidgetToolbar();
0140     void slotTabDoubleClicked(int index);
0141     void tabBarAnimationFinished();
0142 
0143 private:
0144     void addAction(KToolBar *tbar, const char* actionName);
0145     void addSeparatorAndAction(KToolBar *tbar, const char* actionName);
0146 
0147     class Private;
0148     Private * const d;
0149 };
0150 
0151 //! @internal window container created to speedup opening new tabs
0152 class KexiWindowContainer : public QWidget
0153 {
0154     Q_OBJECT
0155 public:
0156     explicit KexiWindowContainer(QWidget* parent);
0157 
0158     virtual ~KexiWindowContainer();
0159 
0160     void setWindow(KexiWindow* w);
0161 
0162     QPointer<KexiWindow> window;
0163 
0164 private:
0165     QVBoxLayout *lyr;
0166 };
0167 
0168 class EmptyMenuContentWidget : public QWidget
0169 {
0170     Q_OBJECT
0171 public:
0172     explicit EmptyMenuContentWidget(QWidget* parent = 0);
0173 
0174     void alterBackground();
0175 
0176     virtual void changeEvent(QEvent *e) override;
0177 };
0178 
0179 //! @todo KEXI3 is KexiMenuWidgetStyle needed?
0180 #if 0
0181 //! A style proxy for KexiMenuWidget
0182 class KexiMenuWidgetStyle : public KexiUtils::StyleProxy
0183 {
0184 public:
0185     explicit KexiMenuWidgetStyle(QStyle *style, QObject *parent = 0);
0186 
0187     virtual ~KexiMenuWidgetStyle();
0188 
0189     virtual void drawControl(ControlElement element, const QStyleOption *option,
0190                              QPainter *painter, const QWidget *widget = 0) const;
0191 };
0192 #endif
0193 
0194 //! Main menu
0195 class KexiMainMenu : public QWidget
0196 {
0197     Q_OBJECT
0198 public:
0199     explicit KexiMainMenu(KexiTabbedToolBar *toolBar, QWidget* parent = 0);
0200 
0201     ~KexiMainMenu();
0202 
0203     virtual bool eventFilter(QObject * watched, QEvent* event) override;
0204 
0205     void setContent(QWidget *contentWidget);
0206 
0207     const QWidget *contentWidget() const;
0208 
0209     void setPersistentlySelectedAction(KexiMenuWidgetAction* action, bool set);
0210 
0211 /*    void setActiveAction(QAction* action = 0);*/
0212 
0213     void selectFirstItem();
0214 
0215     tristate showProjectMigrationWizard(
0216         const QString& mimeType, const QString& databaseName, const KDbConnectionData *cdata);
0217 
0218 Q_SIGNALS:
0219     void contentAreaPressed();
0220     void hideContentsRequested();
0221 
0222 protected Q_SLOTS:
0223     //void contentWidgetDestroyed();
0224 
0225 protected:
0226     virtual void showEvent(QShowEvent * event) override;
0227 
0228 private:
0229     QPointer<KexiMenuWidget> m_menuWidget;
0230     KexiTabbedToolBar* m_toolBar;
0231     bool m_initialized;
0232     EmptyMenuContentWidget *m_content;
0233     QStackedLayout *m_contentLayout = nullptr;
0234     QPointer<QWidget> m_contentWidget;
0235     QVBoxLayout* m_mainContentLayout = nullptr;
0236     QPointer<KexiMenuWidgetAction> m_persistentlySelectedAction;
0237     bool m_selectFirstItem;
0238 };
0239 
0240 class KexiTabbedToolBarTabBar;
0241 
0242 //! @internal
0243 class Q_DECL_HIDDEN KexiTabbedToolBar::Private : public QObject
0244 {
0245     Q_OBJECT
0246 public:
0247     explicit Private(KexiTabbedToolBar *t);
0248 
0249     KToolBar *createToolBar(const char *name, const QString& caption);
0250 
0251     int tabIndex;
0252 
0253 public Q_SLOTS:
0254     void showMainMenu(const char* actionName = 0);
0255     void hideMainMenu();
0256     void hideContentsOrMainMenu();
0257     void toggleMainMenu();
0258     void updateMainMenuGeometry();
0259 
0260     //! Initializes global search line edit. If it is enabled, it's created, if disabled, it's deleted.
0261     void initSearchLineEdit();
0262 
0263 public:
0264     KexiTabbedToolBarTabBar *customTabBar;
0265     QPointer<KexiMainMenu> mainMenu;
0266 
0267     KexiTabbedToolBar *q;
0268     KActionCollection *ac;
0269     int createId;
0270     KToolBar *createWidgetToolBar;
0271     QHBoxLayout *helpLayer;
0272 #ifdef KEXI_AUTORISE_TABBED_TOOLBAR
0273     //! Used for delayed tab raising
0274     int tabToRaise;
0275     //! Used for delayed tab raising
0276     QTimer tabRaiseTimer;
0277 #endif
0278     //! Toolbars for name
0279     QHash<QString, KToolBar*> toolbarsForName;
0280     QHash<QString, int> toolbarsIndexForName;
0281     QHash<QString, QString> toolbarsCaptionForName;
0282     QVector<bool> toolbarsVisibleForIndex;
0283     QHash<QWidget*, QAction*> extraActions;
0284     bool rolledUp;
0285     QPropertyAnimation tabBarAnimation;
0286     QGraphicsOpacityEffect tabBarOpacityEffect;
0287     int rolledUpIndex;
0288     KHelpMenu *helpMenu;
0289     KexiSearchLineEdit *searchLineEdit = nullptr;
0290     void setCurrentTab(const QString& name);
0291     void hideTab(const QString& name);
0292     void showTab(const QString& name);
0293     bool isTabVisible(const QString& name) const;
0294 #ifndef NDEBUG
0295     void debugToolbars() const;
0296 #endif
0297     int lowestIndex;
0298 };
0299 
0300 class KexiTabbedToolBarStyle;
0301 
0302 //! Tab bar reimplementation for KexiTabbedToolBar.
0303 /*! The main its purpose is to alter the width of "Kexi" tab.
0304 */
0305 class KexiTabbedToolBarTabBar : public QTabBar
0306 {
0307     Q_OBJECT
0308 public:
0309     explicit KexiTabbedToolBarTabBar(QWidget *parent = 0);
0310     virtual QSize originalTabSizeHint(int index) const;
0311     virtual QSize tabSizeHint(int index) const override;
0312 
0313     KexiTabbedToolBarStyle* customStyle;
0314 };
0315 
0316 //! Style proxy for KexiTabbedToolBar, to get the "Kexi" tab style right.
0317 class KexiTabbedToolBarStyle : public QProxyStyle
0318 {
0319     Q_OBJECT
0320 public:
0321     explicit KexiTabbedToolBarStyle(const QString &baseStyleName);
0322 
0323     virtual ~KexiTabbedToolBarStyle();
0324 
0325     virtual void drawControl(ControlElement element, const QStyleOption *option,
0326                              QPainter *painter, const QWidget *widget = 0) const override;
0327 
0328     virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
0329                                QPainter *painter, const QWidget *widget = 0) const override;
0330 
0331     virtual int pixelMetric(PixelMetric metric, const QStyleOption* option = 0,
0332                             const QWidget* widget = 0) const override;
0333 };
0334 
0335 //! Style proxy for KexiTabbedToolBar, to fix the hardcoded margins (e.g. for Breeze).
0336 class KexiDockWidgetStyle : public QProxyStyle
0337 {
0338     Q_OBJECT
0339 public:
0340     explicit KexiDockWidgetStyle(const QString &baseStyleName);
0341 
0342     virtual ~KexiDockWidgetStyle();
0343 
0344     using QProxyStyle::polish;
0345     void polish(QWidget* widget) override;
0346 };
0347 
0348 class KexiMainWidget;
0349 
0350 //! @internal tab widget acting as central widget for KexiMainWindow
0351 class KexiMainWindowTabWidget : public QTabWidget
0352 {
0353     Q_OBJECT
0354 public:
0355     KexiMainWindowTabWidget(QWidget *parent, KexiMainWidget *mainWidget);
0356     virtual ~KexiMainWindowTabWidget();
0357 public Q_SLOTS:
0358     void closeTab();
0359     tristate closeAllTabs();
0360 
0361 protected:
0362     //! Shows context menu for tab at @a index at point @a point.
0363     //! If @a index is -1, context menu for empty area is requested.
0364     void showContextMenuForTab(int index, const QPoint& point);
0365 
0366     //! Reimplemented to hide frame when no tabs are displayed
0367     virtual void paintEvent(QPaintEvent * event) override;
0368 
0369     virtual void mousePressEvent(QMouseEvent *event) override;
0370 
0371     KexiMainWidget *m_mainWidget;
0372     QAction *m_closeAction;
0373     QAction *m_closeAllTabsAction;
0374 
0375 private:
0376     int m_tabIndex;
0377 
0378     void setTabIndexFromContextMenu(int clickedIndex);
0379 };
0380 
0381 //! @short A widget being main part of KexiMainWindow
0382 class KexiMainWidget : public KMainWindow
0383 {
0384     Q_OBJECT
0385 public:
0386     KexiMainWidget();
0387 
0388     virtual ~KexiMainWidget();
0389 
0390     void setParent(KexiMainWindow* mainWindow);
0391 
0392     KexiMainWindowTabWidget* tabWidget() const;
0393 
0394 protected:
0395     virtual bool queryClose() override;
0396 protected Q_SLOTS:
0397     void slotCurrentTabIndexChanged(int index);
0398 Q_SIGNALS:
0399     void currentTabIndexChanged(int index);
0400 
0401 private:
0402     void setupCentralWidget();
0403 
0404     KexiMainWindowTabWidget* m_tabWidget;
0405     KexiMainWindow *m_mainWindow;
0406     QPointer<KexiWindow> m_previouslyActiveWindow;
0407 
0408     friend class KexiMainWindow;
0409     friend class KexiMainWindowTabWidget;
0410 };
0411 
0412 //------------------------------------------
0413 
0414 //! @internal Dock widget with floating disabled but still collapsible
0415 class KexiDockWidget : public QDockWidget
0416 {
0417     Q_OBJECT
0418 public:
0419     KexiDockWidget(const QString &tabText, QWidget *parent);
0420 
0421     virtual ~KexiDockWidget();
0422 
0423     virtual void setSizeHint(const QSize& hint);
0424 
0425     virtual QSize sizeHint() const override;
0426 
0427     const QString tabText; //!< for tab bar tabs
0428 
0429 protected:
0430     virtual void paintEvent(QPaintEvent *pe) override;
0431 
0432 private:
0433     class Private;
0434     Private * const d;
0435 };
0436 
0437 //------------------------------------------
0438 
0439 //! @internal safer dictionary
0440 typedef QMap< int, KexiWindow* > KexiWindowDict;
0441 
0442 //! @internal
0443 class Q_DECL_HIDDEN KexiMainWindow::Private
0444 {
0445 public:
0446     explicit Private(KexiMainWindow* w);
0447 
0448     ~Private();
0449 
0450 #ifndef KEXI_NO_PENDING_DIALOGS
0451     //! Job type. Currently used for marking items as being opened or closed.
0452     enum PendingJobType {
0453         NoJob = 0,
0454         WindowOpeningJob,
0455         WindowClosingJob
0456     };
0457 
0458     KexiWindow *openedWindowFor(const KexiPart::Item* item, PendingJobType &pendingType);
0459 
0460     KexiWindow *openedWindowFor(int identifier, PendingJobType &pendingType);
0461 
0462     void addItemToPendingWindows(const KexiPart::Item* item, PendingJobType jobType);
0463 
0464     bool pendingWindowsExist();
0465 
0466     void removePendingWindow(int identifier);
0467 #else
0468     KexiWindow *openedWindowFor(int identifier);
0469 #endif
0470 
0471     void insertWindow(KexiWindow *window);
0472 
0473     bool windowContainerExistsFor(int identifier) const;
0474 
0475     void setWindowContainerExistsFor(int identifier, bool set);
0476 
0477     void updateWindowId(KexiWindow *window, int oldItemID);
0478 
0479     void removeWindow(int identifier);
0480 
0481     int openedWindowsCount();
0482 
0483     //! Used in KexiMainWindowe::closeProject()
0484     void clearWindows();
0485 
0486     void showStartProcessMsg(const QStringList& args);
0487 
0488     //! Updates Property Editor Pane's visibility for the current window and the @a viewMode view mode.
0489     /*! @a info can be provided to hadle cases when current window is not yet defined (in openObject()). */
0490     void updatePropEditorVisibility(Kexi::ViewMode viewMode, KexiPart::Info *info = 0);
0491 
0492     void setTabBarVisible(KMultiTabBar::KMultiTabBarPosition position, int id,
0493                           KexiDockWidget *dockWidget, bool visible);
0494 
0495     void setPropertyEditorTabBarVisible(bool visible);
0496 
0497     QObject *openedCustomObjectsForItem(KexiPart::Item* item, const char* name);
0498 
0499     void addOpenedCustomObjectForItem(KexiPart::Item* item, QObject* object, const char* name);
0500 
0501     KexiFindDialog *findDialog();
0502 
0503     /*! Updates the find/replace dialog depending on the active view.
0504      Nothing is performed if the dialog is not instantiated yet or is invisible. */
0505     void updateFindDialogContents(bool createIfDoesNotExist = false);
0506 
0507     //! \return the current view if it supports \a actionName, otherwise returns 0.
0508     KexiView *currentViewSupportingAction(const char* actionName) const;
0509 
0510     //! \return the current view if it supports KexiSearchAndReplaceViewInterface.
0511     KexiSearchAndReplaceViewInterface* currentViewSupportingSearchAndReplaceInterface() const;
0512 
0513     tristate showProjectMigrationWizard(
0514         const QString& mimeType, const QString& databaseName, const KDbConnectionData *cdata);
0515 
0516     /**
0517      * Returns current page of active visible main menu widget or @c nullptr if there is no visible
0518      * menu widget or menu widget contains no page.
0519      */
0520     KexiAssistantPage *visibleMainMenuWidgetPage();
0521 
0522     KexiMainWindow *wnd;
0523     KexiMainWidget *mainWidget;
0524     KActionCollection *actionCollection;
0525     KHelpMenu *helpMenu;
0526     KexiProject *prj;
0527     KSharedConfig::Ptr config;
0528 #ifdef KEXI_SHOW_CONTEXT_HELP
0529     KexiContextHelp *ctxHelp;
0530 #endif
0531     KexiProjectNavigator *navigator;
0532     KexiTabbedToolBar *tabbedToolBar;
0533     QMap<int, QString> tabsToActivateOnShow;
0534     KexiDockWidget *navDockWidget;
0535     QTabWidget *propEditorTabWidget;
0536     KexiDockWidget *propEditorDockWidget;
0537     QPointer<KexiDockableWidget> propEditorDockableWidget;
0538     //! poits to kexi part which has been previously used to setup proppanel's tabs using
0539     //! KexiPart::setupCustomPropertyPanelTabs(), in updateCustomPropertyPanelTabs().
0540     QPointer<KexiPart::Part> partForPreviouslySetupPropertyPanelTabs;
0541     QMap<KexiPart::Part*, int> recentlySelectedPropertyPanelPages;
0542     QPointer<KexiPropertyEditorView> propEditor;
0543     QPointer<KPropertySet> propertySet;
0544 
0545     KexiNameDialog *nameDialog;
0546     QTimer timer; //!< helper timer
0547     QString appCaptionPrefix; //<! application's caption prefix - prj name (if opened), else: null
0548 
0549 #ifndef KEXI_SHOW_UNIMPLEMENTED
0550     KActionMenu *dummy_action;
0551 #endif
0552 
0553     //! Kexi menu
0554     QAction *action_save, *action_save_as,
0555     *action_project_import_export_send, *action_close,
0556     *action_project_properties,
0557     *action_project_relations, *action_project_import_data_table,
0558     *action_project_export_data_table;
0559 #ifdef KEXI_QUICK_PRINTING_SUPPORT
0560     QAction *action_project_print, *action_project_print_preview,
0561         *action_project_print_setup;
0562 #endif
0563     QAction *action_project_welcome;
0564     QAction *action_show_other;
0565     int action_welcome_projects_title_id,
0566     action_welcome_connections_title_id;
0567     QAction *action_settings;
0568 
0569     //! edit menu
0570     QAction *action_edit_delete, *action_edit_delete_row,
0571     *action_edit_cut, *action_edit_copy, *action_edit_paste,
0572     *action_edit_find, *action_edit_findnext, *action_edit_findprev,
0573     *action_edit_replace, *action_edit_replace_all,
0574     *action_edit_select_all,
0575     *action_edit_undo, *action_edit_redo,
0576     *action_edit_insert_empty_row,
0577     *action_edit_edititem, *action_edit_clear_table,
0578     *action_edit_paste_special_data_table,
0579     *action_edit_copy_special_data_table;
0580 
0581     //! view menu
0582     QAction *action_show_nav, *action_show_propeditor;
0583     QAction *action_activate_nav;
0584     QAction *action_activate_mainarea;
0585     QAction *action_activate_propeditor;
0586 #ifdef KEXI_SHOW_CONTEXT_HELP
0587     KToggleAction *action_show_helper;
0588 #endif
0589     //! data menu
0590     QAction *action_data_save_row;
0591     QAction *action_data_cancel_row_changes;
0592     QAction *action_data_execute;
0593 
0594     //! format menu
0595     QAction *action_format_font;
0596 
0597     //! tools menu
0598     QAction *action_tools_import_project, *action_tools_compact_database, *action_tools_data_import;
0599     KActionMenu *action_tools_scripts;
0600 
0601     //! window menu
0602     QAction *action_window_next, *action_window_previous, *action_window_fullscreen;
0603     QAction *action_tab_next, *action_tab_previous;
0604 
0605     //! global
0606     QAction *action_show_help_menu;
0607     QAction *action_view_global_search;
0608     //! for dock windows
0609 
0610     QPointer<QWidget> focus_before_popup;
0611 
0612     //! Set to true only in destructor, used by closeWindow() to know if
0613     //! user can cancel window closing. If true user even doesn't see any messages
0614     //! before closing a window. This is for extremely sanity... and shouldn't be even needed.
0615     bool forceWindowClosing;
0616 
0617     //! Indicates that we're inside closeWindow() method - to avoid inf. recursion
0618     //! on window removing
0619     bool insideCloseWindow;
0620 
0621 #ifndef KEXI_NO_PENDING_DIALOGS
0622     //! Used in executeActionWhenPendingJobsAreFinished().
0623     enum ActionToExecuteWhenPendingJobsAreFinished {
0624         NoAction,
0625         QuitAction,
0626         CloseProjectAction
0627     };
0628     ActionToExecuteWhenPendingJobsAreFinished actionToExecuteWhenPendingJobsAreFinished;
0629 
0630     void executeActionWhenPendingJobsAreFinished();
0631 #endif
0632 
0633     //! Used for delayed windows closing for 'close all'
0634     QList<KexiWindow*> windowsToClose;
0635 
0636 #ifdef KEXI_QUICK_PRINTING_SUPPORT
0637     //! Opened page setup dialogs, used by printOrPrintPreviewForItem().
0638     QHash<int, KexiWindow*> pageSetupWindows;
0639 
0640     /*! A map from Kexi dialog to "print setup" part item's ID of the data item
0641      used by closeWindow() to find an ID of the data item, so the entry
0642      can be removed from pageSetupWindows dictionary. */
0643     QMap<int, int> pageSetupWindowItemID2dataItemID_map;
0644 #endif
0645 
0646     //! Indicates if project is started in User Mode
0647     bool userMode;
0648 
0649     //! Indicates if project navigator should be visible
0650     bool isProjectNavigatorVisible;
0651 
0652     //! Indicates if the main menu should be visible
0653     bool isMainMenuVisible;
0654 
0655     //! Set in restoreSettings() and used in initNavigator()
0656     //! to customize navigator visibility on startup
0657     bool forceShowProjectNavigatorOnCreation;
0658     bool forceHideProjectNavigatorOnCreation;
0659 
0660     bool navWasVisibleBeforeProjectClosing;
0661     bool saveSettingsForShowProjectNavigator;
0662 
0663     //! Used by openedCustomObjectsForItem() and addOpenedCustomObjectForItem()
0664     QHash<QByteArray, QObject*> m_openedCustomObjectsForItem;
0665 
0666     int propEditorDockSeparatorPos, navDockSeparatorPos;
0667 
0668     bool wasAutoOpen;
0669     bool windowExistedBeforeCloseProject;
0670 
0671     QMap<KMultiTabBar::KMultiTabBarPosition, KMultiTabBar*> multiTabBars;
0672     bool propertyEditorCollapsed;
0673 
0674     bool enable_slotPropertyEditorVisibilityChanged;
0675 
0676     KexiUserFeedbackAgent userFeedback;
0677 
0678     KexiMigrateManagerInterface* migrateManager;
0679 
0680 private:
0681     //! @todo move to KexiProject
0682     KexiWindowDict windows;
0683     //! A set of item identifiers for whose there are KexiWindowContainer instances already.
0684     //! This lets to verify that KexiWindow is about to be constructed and opened so multiple
0685     //! opening can be avoided.
0686     QSet<int> windowContainers;
0687 #ifndef KEXI_NO_PROCESS_EVENTS
0688     QHash<int, PendingJobType> pendingWindows; //!< part item identifiers for windows whoose opening has been started
0689     //! @todo QMutex dialogsMutex; //!< used for locking windows and pendingWindows dicts
0690 #endif
0691     KexiFindDialog *m_findDialog;
0692 };
0693 
0694 //------------------------------------------
0695 
0696 //! Action shortcut used by KexiMainWindow::setupMainMenuActionShortcut(QAction *)
0697 //! Activates action only if enabled.
0698 class KexiMainMenuActionShortcut : public QShortcut
0699 {
0700     Q_OBJECT
0701 public:
0702     KexiMainMenuActionShortcut(const QKeySequence& key, QAction *action, QWidget *parent);
0703 
0704     virtual ~KexiMainMenuActionShortcut();
0705 
0706 protected Q_SLOTS:
0707     //! Triggers associated action only when this action is enabled
0708     void slotActivated();
0709 
0710 private:
0711     QPointer<QAction> m_action;
0712 };
0713 
0714 #endif