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