Changeset View
Changeset View
Standalone View
Standalone View
src/main/KexiMainWindow.cpp
Show All 30 Lines | |||||
31 | #include "kexiinternalpart.h" | 31 | #include "kexiinternalpart.h" | ||
32 | #include "kexiactioncategories.h" | 32 | #include "kexiactioncategories.h" | ||
33 | #include "kexifinddialog.h" | 33 | #include "kexifinddialog.h" | ||
34 | #include "kexisearchandreplaceiface.h" | 34 | #include "kexisearchandreplaceiface.h" | ||
35 | #include "KexiBugReportDialog.h" | 35 | #include "KexiBugReportDialog.h" | ||
36 | #define KEXI_SKIP_REGISTERICONSRESOURCE | 36 | #define KEXI_SKIP_REGISTERICONSRESOURCE | ||
37 | #define KEXI_SKIP_SETUPPRIVATEICONSRESOURCE | 37 | #define KEXI_SKIP_SETUPPRIVATEICONSRESOURCE | ||
38 | #include "KexiRegisterResource_p.h" | 38 | #include "KexiRegisterResource_p.h" | ||
39 | #include "KexiObjectViewWidget.h" | ||||
40 | #include "KexiObjectViewTabWidget.h" | ||||
39 | #include <kexiutils/utils.h> | 41 | #include <kexiutils/utils.h> | ||
42 | #include <KexiStyle.h> | ||||
40 | #include <kexiutils/KexiCloseButton.h> | 43 | #include <kexiutils/KexiCloseButton.h> | ||
41 | #include <kexiutils/KexiTester.h> | 44 | #include <kexiutils/KexiTester.h> | ||
42 | #include <KexiVersion.h> | 45 | #include <KexiVersion.h> | ||
43 | #include <core/KexiWindow.h> | 46 | #include <core/KexiWindow.h> | ||
44 | #include <core/KexiRecentProjects.h> | 47 | #include <core/KexiRecentProjects.h> | ||
45 | #include <core/kexiaboutdata.h> | 48 | #include <core/kexiaboutdata.h> | ||
46 | #include <core/KexiCommandLineOptions.h> | 49 | #include <core/KexiCommandLineOptions.h> | ||
47 | #include <KexiIcon.h> | 50 | #include <KexiIcon.h> | ||
48 | #include <kexi_global.h> | 51 | #include <kexi_global.h> | ||
49 | #include <widget/properties/KexiPropertyEditorView.h> | 52 | #include <KexiPropertyPaneWidget.h> | ||
50 | #include <widget/utils/kexirecordnavigator.h> | 53 | #include <widget/utils/kexirecordnavigator.h> | ||
51 | #include <widget/utils/KexiDockableWidget.h> | 54 | #include <widget/utils/KexiDockableWidget.h> | ||
52 | #include <widget/navigator/KexiProjectNavigator.h> | 55 | #include <widget/navigator/KexiProjectNavigator.h> | ||
53 | #include <widget/navigator/KexiProjectModel.h> | 56 | #include <widget/navigator/KexiProjectModel.h> | ||
54 | #include <widget/KexiNameDialog.h> | 57 | #include <widget/KexiNameDialog.h> | ||
55 | #include <widget/KexiNameWidget.h> | 58 | #include <widget/KexiNameWidget.h> | ||
56 | #include <widget/KexiDBPasswordDialog.h> | 59 | #include <widget/KexiDBPasswordDialog.h> | ||
57 | #include "startup/KexiStartup.h" | 60 | #include "startup/KexiStartup.h" | ||
Show All 11 Lines | |||||
69 | #include <KDbObjectNameValidator> | 72 | #include <KDbObjectNameValidator> | ||
70 | 73 | | |||
71 | #include <KPropertyEditorView> | 74 | #include <KPropertyEditorView> | ||
72 | #include <KPropertySet> | 75 | #include <KPropertySet> | ||
73 | 76 | | |||
74 | #include <KActionCollection> | 77 | #include <KActionCollection> | ||
75 | #include <KActionMenu> | 78 | #include <KActionMenu> | ||
76 | #include <KToggleAction> | 79 | #include <KToggleAction> | ||
80 | #include <KRecentFilesAction> | ||||
77 | #include <KStandardShortcut> | 81 | #include <KStandardShortcut> | ||
78 | #include <KStandardGuiItem> | 82 | #include <KStandardGuiItem> | ||
79 | #include <KConfig> | 83 | #include <KConfig> | ||
80 | #include <KShortcutsDialog> | 84 | #include <KShortcutsDialog> | ||
81 | #include <KEditToolBar> | 85 | #include <KEditToolBar> | ||
82 | #include <KToggleFullScreenAction> | 86 | #include <KToggleFullScreenAction> | ||
83 | #include <KIconLoader> | 87 | #include <KIconLoader> | ||
84 | #include <KHelpMenu> | 88 | #include <KHelpMenu> | ||
85 | #include <KMultiTabBar> | 89 | #include <KMultiTabBar> | ||
86 | #include <KLocalizedString> | 90 | #include <KLocalizedString> | ||
87 | #include <KMessageBox> | 91 | #include <KMessageBox> | ||
88 | #include <KConfigGroup> | 92 | #include <KConfigGroup> | ||
89 | #include <KAcceleratorManager> | 93 | #include <KAcceleratorManager> | ||
90 | 94 | | |||
91 | #include <QApplication> | 95 | #include <QApplication> | ||
92 | #include <QFile> | 96 | #include <QFile> | ||
93 | #include <QProcess> | 97 | #include <QProcess> | ||
94 | #include <QToolButton> | 98 | #include <QToolButton> | ||
95 | #include <QDebug> | 99 | #include <QDebug> | ||
96 | #include <QHash> | 100 | #include <QHash> | ||
97 | #include <QStylePainter> | 101 | #include <QStylePainter> | ||
98 | #include <QStyleFactory> | 102 | #include <QStyleFactory> | ||
99 | #include <QDesktopWidget> | 103 | #include <QDesktopWidget> | ||
100 | #include <QResource> | 104 | #include <QResource> | ||
105 | #include <QMenuBar> | ||||
101 | 106 | | |||
102 | #if !defined(KexiVDebug) | 107 | #if !defined(KexiVDebug) | ||
103 | # define KexiVDebug if (0) qDebug() | 108 | # define KexiVDebug if (0) qDebug() | ||
104 | #endif | 109 | #endif | ||
105 | 110 | | |||
106 | #ifdef HAVE_KCRASH | 111 | #ifdef HAVE_KCRASH | ||
107 | #include <kcrash.h> | 112 | #include <kcrash.h> | ||
108 | //! @todo else, add Breakpad? https://phabricator.kde.org/T1642 | 113 | //! @todo else, add Breakpad? https://phabricator.kde.org/T1642 | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | |||||
180 | 185 | | |||
181 | QSize KexiDockWidget::sizeHint() const | 186 | QSize KexiDockWidget::sizeHint() const | ||
182 | { | 187 | { | ||
183 | return d->hint.isValid() ? d->hint : QDockWidget::sizeHint(); | 188 | return d->hint.isValid() ? d->hint : QDockWidget::sizeHint(); | ||
184 | } | 189 | } | ||
185 | 190 | | |||
186 | //------------------------------------------------- | 191 | //------------------------------------------------- | ||
187 | 192 | | |||
188 | KexiMainWindowTabWidget::KexiMainWindowTabWidget(QWidget *parent, KexiMainWidget* mainWidget) | | |||
189 | : QTabWidget(parent) | | |||
190 | , m_mainWidget(mainWidget) | | |||
191 | , m_tabIndex(-1) | | |||
192 | { | | |||
193 | m_closeAction = new QAction(koIcon("tab-close"), xi18n("&Close Tab"), this); | | |||
194 | m_closeAction->setToolTip(xi18n("Close the current tab")); | | |||
195 | m_closeAction->setWhatsThis(xi18n("Closes the current tab.")); | | |||
196 | m_closeAllTabsAction = new QAction(xi18n("Cl&ose All Tabs"), this); | | |||
197 | m_closeAllTabsAction->setToolTip(xi18n("Close all tabs")); | | |||
198 | m_closeAllTabsAction->setWhatsThis(xi18n("Closes all tabs.")); | | |||
199 | connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeTab())); | | |||
200 | connect(m_closeAllTabsAction, SIGNAL(triggered()), this, SLOT(closeAllTabs())); | | |||
201 | //! @todo insert window list in the corner widget as in firefox | | |||
202 | #if 0 | | |||
203 | // close-tab button: | | |||
204 | QToolButton* rightWidget = new QToolButton(this); | | |||
205 | rightWidget->setDefaultAction(m_closeAction); | | |||
206 | rightWidget->setText(QString()); | | |||
207 | rightWidget->setAutoRaise(true); | | |||
208 | rightWidget->adjustSize(); | | |||
209 | setCornerWidget(rightWidget, Qt::TopRightCorner); | | |||
210 | #endif | | |||
211 | setMovable(true); | | |||
212 | setDocumentMode(true); | | |||
213 | tabBar()->setExpanding(false); | | |||
214 | } | | |||
215 | | ||||
216 | KexiMainWindowTabWidget::~KexiMainWindowTabWidget() | | |||
217 | { | | |||
218 | } | | |||
219 | | ||||
220 | void KexiMainWindowTabWidget::paintEvent(QPaintEvent * event) | | |||
221 | { | | |||
222 | if (count() > 0) | | |||
223 | QTabWidget::paintEvent(event); | | |||
224 | else | | |||
225 | QWidget::paintEvent(event); | | |||
226 | } | | |||
227 | | ||||
228 | void KexiMainWindowTabWidget::mousePressEvent(QMouseEvent *event) | | |||
229 | { | | |||
230 | //! @todo KEXI3 test KexiMainWindowTabWidget's contextMenu event port from KTabWidget | | |||
231 | if (event->button() == Qt::RightButton) { | | |||
232 | int tab = tabBar()->tabAt(event->pos()); | | |||
233 | const QPoint realPos(tabBar()->mapToGlobal(event->pos())); | | |||
234 | if (QRect(tabBar()->mapToGlobal(QPoint(0,0)), | | |||
235 | tabBar()->mapToGlobal(QPoint(tabBar()->width()-1, tabBar()->height()-1))).contains(realPos)) | | |||
236 | { | | |||
237 | showContextMenuForTab(tab, tabBar()->mapToGlobal(event->pos())); | | |||
238 | return; | | |||
239 | } | | |||
240 | } | | |||
241 | QTabWidget::mousePressEvent(event); | | |||
242 | } | | |||
243 | | ||||
244 | void KexiMainWindowTabWidget::closeTab() | | |||
245 | { | | |||
246 | KexiMainWindow *main = dynamic_cast<KexiMainWindow*>(KexiMainWindowIface::global()); | | |||
247 | if (main) { | | |||
248 | main->closeWindowForTab(m_tabIndex); | | |||
249 | } | | |||
250 | } | | |||
251 | | ||||
252 | tristate KexiMainWindowTabWidget::closeAllTabs() | | |||
253 | { | | |||
254 | tristate alternateResult = true; | | |||
255 | QList<KexiWindow*> windowList; | | |||
256 | KexiMainWindow *main = dynamic_cast<KexiMainWindow*>(KexiMainWindowIface::global()); | | |||
257 | if (!main) { | | |||
258 | return alternateResult; | | |||
259 | } | | |||
260 | for (int i = 0; i < count(); i++) { | | |||
261 | KexiWindow *window = main->windowForTab(i); | | |||
262 | if (window) { | | |||
263 | windowList.append(window); | | |||
264 | } | | |||
265 | } | | |||
266 | foreach (KexiWindow *window, windowList) { | | |||
267 | tristate result = main->closeWindow(window); | | |||
268 | if (result != true && result != false) { | | |||
269 | return result; | | |||
270 | } | | |||
271 | if (result == false) { | | |||
272 | alternateResult = false; | | |||
273 | } | | |||
274 | } | | |||
275 | return alternateResult; | | |||
276 | } | | |||
277 | | ||||
278 | void KexiMainWindowTabWidget::showContextMenuForTab(int index, const QPoint& point) | | |||
279 | { | | |||
280 | QMenu menu; | | |||
281 | if (index >= 0) { | | |||
282 | menu.addAction(m_closeAction); | | |||
283 | } | | |||
284 | if (count() > 0) { | | |||
285 | menu.addAction(m_closeAllTabsAction); | | |||
286 | } | | |||
287 | //! @todo add "&Detach Tab" | | |||
288 | if (menu.actions().isEmpty()) { | | |||
289 | return; | | |||
290 | } | | |||
291 | setTabIndexFromContextMenu(index); | | |||
292 | menu.exec(point); | | |||
293 | } | | |||
294 | | ||||
295 | void KexiMainWindowTabWidget::setTabIndexFromContextMenu(int clickedIndex) | | |||
296 | { | | |||
297 | if (currentIndex() == -1) { | | |||
298 | m_tabIndex = -1; | | |||
299 | return; | | |||
300 | } | | |||
301 | m_tabIndex = clickedIndex; | | |||
302 | } | | |||
303 | | ||||
304 | //------------------------------------------------- | | |||
305 | | ||||
306 | static bool setupIconTheme(KLocalizedString *errorMessage, KLocalizedString *detailsErrorMessage) | 193 | static bool setupIconTheme(KLocalizedString *errorMessage, KLocalizedString *detailsErrorMessage) | ||
307 | { | 194 | { | ||
308 | // Register kexi resource first to have priority over the standard breeze theme. | 195 | // Register kexi resource first to have priority over the standard breeze theme. | ||
309 | // For example "table" icon exists in both resources. | 196 | // For example "table" icon exists in both resources. | ||
310 | if (!registerResource("icons/kexi_breeze.rcc", QStandardPaths::AppDataLocation, | 197 | if (!registerResource("icons/kexi_breeze.rcc", QStandardPaths::AppDataLocation, | ||
311 | QString(), QString(), errorMessage, detailsErrorMessage) | 198 | QString(), QString(), errorMessage, detailsErrorMessage) | ||
312 | || !registerGlobalBreezeIconsResource(errorMessage, detailsErrorMessage)) | 199 | || !registerGlobalBreezeIconsResource(errorMessage, detailsErrorMessage)) | ||
313 | { | 200 | { | ||
314 | return false; | 201 | return false; | ||
315 | } | 202 | } | ||
316 | setupBreezeIconTheme(); | 203 | setupBreezeIconTheme(); | ||
317 | 204 | | |||
318 | // tell KIconLoader an co. about the theme | 205 | // tell KIconLoader an co. about the theme | ||
319 | KConfigGroup cg(KSharedConfig::openConfig(), "Icons"); | 206 | KConfigGroup cg(KSharedConfig::openConfig(), "Icons"); | ||
320 | cg.writeEntry("Theme", "breeze"); | 207 | cg.writeEntry("Theme", "breeze"); | ||
321 | cg.sync(); | 208 | cg.sync(); | ||
322 | return true; | 209 | return true; | ||
323 | } | 210 | } | ||
324 | 211 | | |||
325 | //! @todo 3.1 replace with KexiStyle | 212 | //! @todo 3.1 replace with KexiStyle | ||
326 | bool setupApplication() | 213 | bool setupApplication() | ||
327 | { | 214 | { | ||
328 | #if defined Q_OS_WIN || defined Q_OS_MACOS | 215 | #if defined Q_OS_WIN || defined Q_OS_MACOS | ||
329 | // Only this style matches current Kexi theme and can be supported/tested | 216 | // Only this style matches current KEXI theme and can be supported/tested | ||
330 | const char *name = "breeze"; | 217 | const char *name = "breeze"; | ||
331 | QScopedPointer<QStyle> style(QStyleFactory::create(name)); | 218 | QScopedPointer<QStyle> style(QStyleFactory::create(name)); | ||
332 | if (!style || style->objectName() != name) { | 219 | if (!style || style->objectName() != name) { | ||
333 | qWarning() << | 220 | qWarning() << | ||
334 | qPrintable(QString("Could not find application style %1. " | 221 | qPrintable(QString("Could not find application style %1. " | ||
335 | "Kexi will not start. Please check if KEXI is properly installed. ") | 222 | "KEXI will not start. Please check if KEXI is properly installed. ") | ||
336 | .arg(name)); | 223 | .arg(name)); | ||
337 | return false; | 224 | return false; | ||
338 | } | 225 | } | ||
339 | qApp->setStyle(style.take()); | 226 | qApp->setStyle(style.take()); | ||
340 | #endif | 227 | #endif | ||
341 | return true; | 228 | return true; | ||
342 | } | 229 | } | ||
343 | 230 | | |||
Show All 17 Lines | 234 | { | |||
361 | } | 248 | } | ||
362 | 249 | | |||
363 | #ifdef HAVE_KCRASH | 250 | #ifdef HAVE_KCRASH | ||
364 | KCrash::initialize(); | 251 | KCrash::initialize(); | ||
365 | #endif | 252 | #endif | ||
366 | 253 | | |||
367 | KLocalizedString errorMessage; | 254 | KLocalizedString errorMessage; | ||
368 | KLocalizedString detailsErrorMessage; | 255 | KLocalizedString detailsErrorMessage; | ||
369 | if (!setupIconTheme(&errorMessage, &detailsErrorMessage)) { | 256 | if (!setupIconTheme(&errorMessage, &detailsErrorMessage) | ||
257 | || !KexiStyle::setupApplication(&errorMessage)) | ||||
258 | { | ||||
370 | if (detailsErrorMessage.isEmpty()) { | 259 | if (detailsErrorMessage.isEmpty()) { | ||
371 | KMessageBox::error(nullptr, errorMessage.toString()); | 260 | KMessageBox::error(nullptr, errorMessage.toString()); | ||
372 | } else { | 261 | } else { | ||
373 | KMessageBox::detailedError(nullptr, errorMessage.toString(), detailsErrorMessage.toString()); | 262 | KMessageBox::detailedError(nullptr, errorMessage.toString(), detailsErrorMessage.toString()); | ||
374 | } | 263 | } | ||
375 | qWarning() << qPrintable(errorMessage.toString(Kuit::PlainText)); | 264 | qWarning() << qPrintable(errorMessage.toString(Kuit::PlainText)); | ||
376 | return 1; | 265 | return 1; | ||
377 | } | 266 | } | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 323 | if (!m_action->isEnabled()) { | |||
435 | return; | 324 | return; | ||
436 | } | 325 | } | ||
437 | m_action->trigger(); | 326 | m_action->trigger(); | ||
438 | } | 327 | } | ||
439 | 328 | | |||
440 | //------------------------------------------------- | 329 | //------------------------------------------------- | ||
441 | 330 | | |||
442 | KexiMainWindow::KexiMainWindow(QWidget *parent) | 331 | KexiMainWindow::KexiMainWindow(QWidget *parent) | ||
443 | : KexiMainWindowSuper(parent) | 332 | : QMainWindow(parent) | ||
444 | , KexiMainWindowIface() | 333 | , KexiMainWindowIface() | ||
445 | , KexiGUIMessageHandler(this) | 334 | , KexiGUIMessageHandler(this) | ||
446 | , d(new KexiMainWindow::Private(this)) | 335 | , d(new KexiMainWindow::Private(this)) | ||
447 | { | 336 | { | ||
448 | setObjectName("KexiMainWindow"); | 337 | setObjectName("KexiMainWindow"); | ||
449 | setAttribute(Qt::WA_DeleteOnClose); | 338 | setAttribute(Qt::WA_DeleteOnClose); | ||
450 | kexiTester() << KexiTestObject(this); | 339 | kexiTester() << KexiTestObject(this); | ||
451 | 340 | | |||
452 | if (d->userMode) | 341 | if (d->userMode) { | ||
453 | qDebug() << "starting up in the User Mode"; | 342 | //qDebug() << "starting up in the User Mode"; | ||
454 | 343 | } | |||
455 | setAsDefaultHost(); //this is default host now. | 344 | setAsDefaultHost(); //this is default host now. | ||
456 | 345 | | |||
457 | //get informed | 346 | //get informed | ||
458 | connect(&Kexi::partManager(), SIGNAL(partLoaded(KexiPart::Part*)), | 347 | connect(&Kexi::partManager(), SIGNAL(partLoaded(KexiPart::Part*)), | ||
459 | this, SLOT(slotPartLoaded(KexiPart::Part*))); | 348 | this, SLOT(slotPartLoaded(KexiPart::Part*))); | ||
460 | connect(&Kexi::partManager(), SIGNAL(newObjectRequested(KexiPart::Info*)), | 349 | connect(&Kexi::partManager(), SIGNAL(newObjectRequested(KexiPart::Info*)), | ||
461 | this, SLOT(newObject(KexiPart::Info*))); | 350 | this, SLOT(newObject(KexiPart::Info*))); | ||
462 | 351 | | |||
463 | setAcceptDrops(true); | 352 | setAcceptDrops(true); | ||
464 | setupActions(); | 353 | setupActions(); | ||
465 | setupMainWidget(); | 354 | setupMainWidget(); | ||
355 | setupMainMenu(); | ||||
466 | updateAppCaption(); | 356 | updateAppCaption(); | ||
467 | 357 | | |||
468 | if (!d->userMode) { | 358 | if (!d->userMode) { | ||
469 | setupContextHelp(); | 359 | setupContextHelp(); | ||
470 | setupPropertyEditor(); | 360 | //setupPropertyEditor(); | ||
471 | } | 361 | } | ||
472 | 362 | | |||
473 | invalidateActions(); | 363 | invalidateActions(); | ||
474 | d->timer.singleShot(0, this, SLOT(slotLastActions())); | 364 | d->timer.singleShot(0, this, SLOT(slotLastActions())); | ||
475 | if (KexiStartupHandler::global()->forcedFullScreen()) { | 365 | if (KexiStartupHandler::global()->forcedFullScreen()) { | ||
476 | toggleFullScreen(true); | 366 | toggleFullScreen(true); | ||
477 | } | 367 | } | ||
478 | 368 | | |||
Show All 27 Lines | |||||
506 | 396 | | |||
507 | KActionCollection *KexiMainWindow::actionCollection() const | 397 | KActionCollection *KexiMainWindow::actionCollection() const | ||
508 | { | 398 | { | ||
509 | return d->actionCollection; | 399 | return d->actionCollection; | ||
510 | } | 400 | } | ||
511 | 401 | | |||
512 | KexiWindow* KexiMainWindow::currentWindow() const | 402 | KexiWindow* KexiMainWindow::currentWindow() const | ||
513 | { | 403 | { | ||
514 | return windowForTab(d->mainWidget->tabWidget()->currentIndex()); | 404 | if (!d->objectViewWidget || !d->objectViewWidget->tabWidget()) { | ||
405 | return 0; | ||||
406 | } | ||||
407 | return windowForTab(d->objectViewWidget->tabWidget()->currentIndex()); | ||||
515 | } | 408 | } | ||
516 | 409 | | |||
517 | KexiWindow* KexiMainWindow::windowForTab(int tabIndex) const | 410 | KexiWindow* KexiMainWindow::windowForTab(int tabIndex) const | ||
518 | { | 411 | { | ||
519 | if (!d->mainWidget->tabWidget()) | 412 | if (!d->objectViewWidget || !d->objectViewWidget->tabWidget()) | ||
520 | return 0; | 413 | return 0; | ||
521 | KexiWindowContainer *windowContainer | 414 | return d->objectViewWidget->tabWidget()->window(tabIndex); | ||
522 | = dynamic_cast<KexiWindowContainer*>(d->mainWidget->tabWidget()->widget(tabIndex)); | | |||
523 | if (!windowContainer) | | |||
524 | return 0; | | |||
525 | return windowContainer->window; | | |||
526 | } | 415 | } | ||
527 | 416 | | |||
528 | void KexiMainWindow::setupMainMenuActionShortcut(QAction * action) | 417 | void KexiMainWindow::setupMainMenuActionShortcut(QAction * action) | ||
529 | { | 418 | { | ||
530 | if (!action->shortcut().isEmpty()) { | 419 | if (!action->shortcut().isEmpty()) { | ||
531 | foreach(const QKeySequence &shortcut, action->shortcuts()) { | 420 | //foreach(const QKeySequence &shortcut, action->shortcuts()) { | ||
532 | (void)new KexiMainMenuActionShortcut(shortcut, action, this); | 421 | //(void)new KexiMainMenuActionShortcut(shortcut, action, this); | ||
533 | } | 422 | //} | ||
534 | } | 423 | } | ||
535 | } | 424 | } | ||
536 | 425 | | |||
537 | static void addThreeDotsToActionText(QAction* action) | 426 | static void addThreeDotsToActionText(QAction* action) | ||
538 | { | 427 | { | ||
539 | action->setText(xi18nc("Action name with three dots...", "%1...", action->text())); | 428 | action->setText(xi18nc("Action name with three dots...", "%1...", action->text())); | ||
540 | } | 429 | } | ||
541 | 430 | | |||
542 | QAction * KexiMainWindow::addAction(const char *name, const QIcon &icon, const QString& text, | 431 | QAction * KexiMainWindow::addAction(const char *name, const QIcon &icon, const QString& text, | ||
543 | const char *shortcut) | 432 | const char *shortcut) | ||
544 | { | 433 | { | ||
545 | QAction *action = icon.isNull() ? new QAction(text, this) : new QAction(icon, text, this); | 434 | QAction *action = icon.isNull() ? new QAction(text, this) : new QAction(icon, text, this); | ||
546 | actionCollection()->addAction(name, action); | 435 | actionCollection()->addAction(name, action); | ||
547 | if (shortcut) { | 436 | if (shortcut) { | ||
548 | action->setShortcut(QKeySequence(shortcut)); | 437 | action->setShortcut(QKeySequence(shortcut)); | ||
549 | QShortcut *s = new QShortcut(action->shortcut(), this); | 438 | action->setShortcutContext(Qt::ApplicationShortcut); | ||
550 | connect(s, SIGNAL(activated()), action, SLOT(trigger())); | 439 | //QShortcut *s = new QShortcut(action->shortcut(), this); | ||
440 | //connect(s, SIGNAL(activated()), action, SLOT(trigger())); | ||||
551 | } | 441 | } | ||
552 | return action; | 442 | return action; | ||
553 | } | 443 | } | ||
554 | 444 | | |||
555 | QAction * KexiMainWindow::addAction(const char *name, const QString& text, const char *shortcut) | 445 | QAction * KexiMainWindow::addAction(const char *name, const QString& text, const char *shortcut) | ||
556 | { | 446 | { | ||
557 | return addAction(name, QIcon(), text, shortcut); | 447 | return addAction(name, QIcon(), text, shortcut); | ||
558 | } | 448 | } | ||
559 | 449 | | |||
560 | void KexiMainWindow::setupActions() | 450 | void KexiMainWindow::setupActions() | ||
561 | { | 451 | { | ||
562 | KActionCollection *ac = actionCollection(); | 452 | KActionCollection *ac = actionCollection(); | ||
563 | 453 | | |||
564 | // PROJECT MENU | 454 | // PROJECT MENU | ||
565 | QAction *action; | 455 | QAction *action; | ||
566 | 456 | | |||
567 | ac->addAction("project_new", | 457 | ac->addAction("project_new", | ||
568 | action = new KexiMenuWidgetAction(KStandardAction::New, this)); | 458 | action = new KexiMenuWidgetAction(KStandardAction::New, this)); | ||
569 | addThreeDotsToActionText(action); | 459 | action->setText(xi18n("&New Project...")); | ||
570 | action->setShortcuts(KStandardShortcut::openNew()); | 460 | action->setShortcuts(KStandardShortcut::openNew()); | ||
571 | action->setToolTip(xi18n("Create a new project")); | 461 | action->setToolTip(xi18n("Create a new project")); | ||
572 | action->setWhatsThis( | 462 | action->setWhatsThis( | ||
573 | xi18n("Creates a new project. Currently opened project is not affected.")); | 463 | xi18n("Creates a new project. Currently opened project is not affected.")); | ||
574 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectNew())); | 464 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectNew())); | ||
575 | setupMainMenuActionShortcut(action); | 465 | setupMainMenuActionShortcut(action); | ||
576 | 466 | | |||
577 | ac->addAction("project_open", | 467 | ac->addAction("project_open", | ||
578 | action = new KexiMenuWidgetAction(KStandardAction::Open, this)); | 468 | action = new KexiMenuWidgetAction(KStandardAction::Open, this)); | ||
469 | action->setText(xi18n("&Open Project...")); | ||||
470 | action->setIcon(koIcon("project-open")); | ||||
579 | action->setToolTip(xi18n("Open an existing project")); | 471 | action->setToolTip(xi18n("Open an existing project")); | ||
580 | action->setWhatsThis( | 472 | action->setWhatsThis( | ||
581 | xi18n("Opens an existing project. Currently opened project is not affected.")); | 473 | xi18n("Opens an existing project. Currently opened project is not affected.")); | ||
582 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectOpen())); | 474 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectOpen())); | ||
583 | setupMainMenuActionShortcut(action); | 475 | setupMainMenuActionShortcut(action); | ||
584 | 476 | | |||
477 | ac->addAction("project_open_recent", | ||||
478 | action = KStandardAction::openRecent(this, SLOT(slotProjectOpen()), this)); | ||||
479 | action->setToolTip(xi18n("Open a project that was recently opened.")); | ||||
480 | action->setWhatsThis(xi18n("Opens a project that was recently opened.")); | ||||
481 | | ||||
585 | { | 482 | { | ||
586 | ac->addAction("project_welcome", | 483 | ac->addAction("project_welcome", | ||
587 | action = d->action_project_welcome = new KexiMenuWidgetAction( | 484 | action = d->action_project_welcome = new KexiMenuWidgetAction( | ||
588 | QIcon(), xi18n("Welcome"), this)); | 485 | QIcon(), xi18n("Welcome"), this)); | ||
589 | addThreeDotsToActionText(action); | 486 | addThreeDotsToActionText(action); | ||
590 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectWelcome())); | 487 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectWelcome())); | ||
591 | setupMainMenuActionShortcut(action); | 488 | setupMainMenuActionShortcut(action); | ||
592 | action->setToolTip(xi18n("Show Welcome page")); | 489 | action->setToolTip(xi18n("Show Welcome page")); | ||
Show All 31 Lines | 515 | #endif | |||
624 | action->setToolTip(xi18n("Import, export or send project")); | 521 | action->setToolTip(xi18n("Import, export or send project")); | ||
625 | action->setWhatsThis( | 522 | action->setWhatsThis( | ||
626 | xi18n("Imports, exports or sends project.")); | 523 | xi18n("Imports, exports or sends project.")); | ||
627 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectImportExportOrSend())); | 524 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectImportExportOrSend())); | ||
628 | setupMainMenuActionShortcut(action); | 525 | setupMainMenuActionShortcut(action); | ||
629 | 526 | | |||
630 | ac->addAction("project_close", | 527 | ac->addAction("project_close", | ||
631 | action = d->action_close = new KexiMenuWidgetAction( | 528 | action = d->action_close = new KexiMenuWidgetAction( | ||
632 | koIcon("window-close"), xi18nc("Close Project", "&Close"), this)); | 529 | koIcon("project-development-close"), xi18n("&Close Project"), this)); | ||
633 | action->setToolTip(xi18n("Close the current project")); | 530 | action->setToolTip(xi18n("Close the current project")); | ||
634 | action->setWhatsThis(xi18n("Closes the current project.")); | 531 | action->setWhatsThis(xi18n("Closes the current project.")); | ||
635 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectClose())); | 532 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectClose())); | ||
636 | setupMainMenuActionShortcut(action); | 533 | setupMainMenuActionShortcut(action); | ||
637 | 534 | | |||
638 | ac->addAction("quit", | 535 | ac->addAction("quit", | ||
639 | action = new KexiMenuWidgetAction(KStandardAction::Quit, this)); | 536 | action = new KexiMenuWidgetAction(KStandardAction::Quit, this)); | ||
640 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectQuit())); | 537 | connect(action, SIGNAL(triggered()), this, SLOT(slotProjectQuit())); | ||
641 | action->setWhatsThis(xi18nc("@info:whatsthis", "Quits <application>%1</application> application.", | 538 | action->setWhatsThis(xi18nc("@info:whatsthis", "Quits <application>%1</application> application.", | ||
642 | QApplication::applicationDisplayName())); | 539 | QApplication::applicationDisplayName())); | ||
643 | setupMainMenuActionShortcut(action); | 540 | setupMainMenuActionShortcut(action); | ||
644 | 541 | | |||
645 | #ifdef KEXI_SHOW_UNIMPLEMENTED | 542 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||
646 | d->action_project_relations = addAction("project_relations", KexiIcon("database-relations"), | 543 | d->action_project_relations = addAction("project_relations", KexiIcon("database-relations"), | ||
647 | futureI18n("&Relationships..."), "Ctrl+R"); | 544 | futureI18n("&Relationships...")); | ||
648 | d->action_project_relations->setToolTip(futureI18n("Project relationships")); | 545 | d->action_project_relations->setToolTip(futureI18n("Project relationships")); | ||
649 | d->action_project_relations->setWhatsThis(futureI18n("Shows project relationships.")); | 546 | d->action_project_relations->setWhatsThis(futureI18n("Shows project relationships.")); | ||
650 | connect(d->action_project_relations, SIGNAL(triggered()), | 547 | connect(d->action_project_relations, SIGNAL(triggered()), | ||
651 | this, SLOT(slotProjectRelations())); | 548 | this, SLOT(slotProjectRelations())); | ||
652 | 549 | | |||
653 | #else | 550 | #else | ||
654 | d->action_project_relations = d->dummy_action; | 551 | d->action_project_relations = d->dummy_action; | ||
655 | #endif | 552 | #endif | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 568 | //! @todo icon | |||
701 | connect(d->action_project_export_data_table, SIGNAL(triggered()), | 598 | connect(d->action_project_export_data_table, SIGNAL(triggered()), | ||
702 | this, SLOT(slotProjectExportDataTable())); | 599 | this, SLOT(slotProjectExportDataTable())); | ||
703 | 600 | | |||
704 | //! @todo new QAction(xi18n("From File..."), "document-open", 0, | 601 | //! @todo new QAction(xi18n("From File..."), "document-open", 0, | ||
705 | //! this, SLOT(slotImportFile()), actionCollection(), "project_import_file"); | 602 | //! this, SLOT(slotImportFile()), actionCollection(), "project_import_file"); | ||
706 | //! @todo new QAction(xi18n("From Server..."), "network-server-database", 0, | 603 | //! @todo new QAction(xi18n("From Server..."), "network-server-database", 0, | ||
707 | //! this, SLOT(slotImportServer()), actionCollection(), "project_import_server"); | 604 | //! this, SLOT(slotImportServer()), actionCollection(), "project_import_server"); | ||
708 | 605 | | |||
709 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | 606 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||
710 | ac->addAction("project_print", | 607 | ac->addAction("project_print", | ||
711 | d->action_project_print = KStandardAction::print(this, SLOT(slotProjectPrint()), this)); | 608 | d->action_project_print = KStandardAction::print(this, SLOT(slotProjectPrint()), this)); | ||
712 | d->action_project_print->setToolTip(futureI18n("Print data from the active table or query")); | 609 | d->action_project_print->setToolTip(futureI18n("Print data from the active table or query")); | ||
713 | d->action_project_print->setWhatsThis(futureI18n("Prints data from the active table or query.")); | 610 | d->action_project_print->setWhatsThis(futureI18n("Prints data from the active table or query.")); | ||
714 | 611 | | |||
715 | ac->addAction("project_print_preview", | 612 | ac->addAction("project_print_preview", | ||
716 | d->action_project_print_preview = KStandardAction::printPreview( | 613 | d->action_project_print_preview = KStandardAction::printPreview( | ||
717 | this, SLOT(slotProjectPrintPreview()), this)); | 614 | this, SLOT(slotProjectPrintPreview()), this)); | ||
718 | d->action_project_print_preview->setToolTip( | 615 | d->action_project_print_preview->setToolTip( | ||
719 | futureI18n("Show print preview for the active table or query")); | 616 | futureI18n("Show print preview for the active table or query")); | ||
720 | d->action_project_print_preview->setWhatsThis( | 617 | d->action_project_print_preview->setWhatsThis( | ||
721 | futureI18n("Shows print preview for the active table or query.")); | 618 | futureI18n("Shows print preview for the active table or query.")); | ||
722 | 619 | | |||
723 | d->action_project_print_setup = addAction("project_print_setup", | 620 | d->action_project_print_setup = addAction("project_print_setup", | ||
724 | koIcon("configure"), futureI18n("Print Set&up...")); //!< @todo document-page-setup could be a better icon | 621 | koIcon("configure"), futureI18n("Print Set&up...")); //!< @todo document-page-setup could be a better icon | ||
725 | d->action_project_print_setup->setToolTip( | 622 | d->action_project_print_setup->setToolTip( | ||
726 | futureI18n("Show print setup for the active table or query")); | 623 | futureI18n("Show print setup for the active table or query")); | ||
727 | d->action_project_print_setup->setWhatsThis( | 624 | d->action_project_print_setup->setWhatsThis( | ||
728 | futureI18n("Shows print setup for the active table or query.")); | 625 | futureI18n("Shows print setup for the active table or query.")); | ||
729 | connect(d->action_project_print_setup, SIGNAL(triggered()), | 626 | connect(d->action_project_print_setup, SIGNAL(triggered()), | ||
730 | this, SLOT(slotProjectPageSetup())); | 627 | this, SLOT(slotProjectPageSetup())); | ||
628 | #else | ||||
629 | d->action_project_print = d->dummy_action; | ||||
630 | d->action_project_print_preview = d->dummy_action; | ||||
631 | d->action_project_print_setup = d->dummy_action; | ||||
731 | #endif | 632 | #endif | ||
732 | 633 | | |||
733 | //EDIT MENU | 634 | //EDIT MENU | ||
734 | d->action_edit_cut = createSharedAction(KStandardAction::Cut); | 635 | d->action_edit_cut = createSharedAction(KStandardAction::Cut); | ||
735 | d->action_edit_copy = createSharedAction(KStandardAction::Copy); | 636 | d->action_edit_copy = createSharedAction(KStandardAction::Copy); | ||
736 | d->action_edit_paste = createSharedAction(KStandardAction::Paste); | 637 | d->action_edit_paste = createSharedAction(KStandardAction::Paste); | ||
737 | 638 | | |||
738 | if (d->userMode) | 639 | if (d->userMode) | ||
Show All 31 Lines | |||||
770 | d->action_edit_find->setToolTip(xi18n("Find text")); | 671 | d->action_edit_find->setToolTip(xi18n("Find text")); | ||
771 | d->action_edit_find->setWhatsThis(xi18n("Looks up the first occurrence of a piece of text.")); | 672 | d->action_edit_find->setWhatsThis(xi18n("Looks up the first occurrence of a piece of text.")); | ||
772 | ac->addAction("edit_findnext", | 673 | ac->addAction("edit_findnext", | ||
773 | d->action_edit_findnext = KStandardAction::findNext( | 674 | d->action_edit_findnext = KStandardAction::findNext( | ||
774 | this, SLOT(slotEditFindNext()), this)); | 675 | this, SLOT(slotEditFindNext()), this)); | ||
775 | ac->addAction("edit_findprevious", | 676 | ac->addAction("edit_findprevious", | ||
776 | d->action_edit_findprev = KStandardAction::findPrev( | 677 | d->action_edit_findprev = KStandardAction::findPrev( | ||
777 | this, SLOT(slotEditFindPrevious()), this)); | 678 | this, SLOT(slotEditFindPrevious()), this)); | ||
778 | d->action_edit_replace = 0; | 679 | ac->addAction("edit_replace", | ||
779 | //! @todo d->action_edit_replace = KStandardAction::replace( | 680 | d->action_edit_replace = KStandardAction::replace( | ||
780 | //! this, SLOT(slotEditReplace()), actionCollection(), "project_print_preview" ); | 681 | this, SLOT(slotEditReplace()), this)); | ||
781 | d->action_edit_replace_all = 0; | 682 | d->action_edit_replace_all = addAction("edit_replace_all", xi18n("Replace All")); | ||
782 | //! @todo d->action_edit_replace_all = new QAction( xi18n("Replace All"), "", 0, | | |||
783 | //! this, SLOT(slotEditReplaceAll()), actionCollection(), "edit_replaceall"); | | |||
784 | 683 | | |||
785 | d->action_edit_select_all = createSharedAction(KStandardAction::SelectAll); | 684 | d->action_edit_select_all = createSharedAction(KStandardAction::SelectAll); | ||
786 | 685 | | |||
787 | d->action_edit_delete = createSharedAction(xi18n("&Delete"), koIconName("edit-delete"), | 686 | d->action_edit_delete = createSharedAction(xi18n("&Delete"), koIconName("edit-delete"), | ||
788 | QKeySequence(), "edit_delete"); | 687 | QKeySequence(), "edit_delete"); | ||
789 | d->action_edit_delete->setToolTip(xi18n("Delete selected object")); | 688 | d->action_edit_delete->setToolTip(xi18n("Delete selected object")); | ||
790 | d->action_edit_delete->setWhatsThis(xi18n("Deletes currently selected object.")); | 689 | d->action_edit_delete->setWhatsThis(xi18n("Deletes currently selected object.")); | ||
791 | 690 | | |||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 753 | if (!d->userMode) { | |||
863 | d->actions_for_view_modes.insert( Kexi::TextViewMode, d->action_view_text_mode ); | 762 | d->actions_for_view_modes.insert( Kexi::TextViewMode, d->action_view_text_mode ); | ||
864 | connect(d->action_view_text_mode, SIGNAL(triggered()), | 763 | connect(d->action_view_text_mode, SIGNAL(triggered()), | ||
865 | this, SLOT(slotViewTextMode())); | 764 | this, SLOT(slotViewTextMode())); | ||
866 | } | 765 | } | ||
867 | else | 766 | else | ||
868 | d->action_view_text_mode = 0; | 767 | d->action_view_text_mode = 0; | ||
869 | */ | 768 | */ | ||
870 | if (d->isProjectNavigatorVisible) { | 769 | if (d->isProjectNavigatorVisible) { | ||
871 | d->action_show_nav = addAction("view_navigator", | 770 | ac->addAction("view_navigator", | ||
872 | xi18n("Show Project Navigator"), | 771 | d->action_show_nav = new KToggleAction(xi18n("Show Project Navigator"), this)); | ||
873 | "Alt+0"); | 772 | d->action_show_nav->setChecked(true); | ||
773 | d->action_show_nav->setShortcut(QKeySequence("Alt+0")); | ||||
874 | d->action_show_nav->setToolTip(xi18n("Show the Project Navigator pane")); | 774 | d->action_show_nav->setToolTip(xi18n("Show the Project Navigator pane")); | ||
875 | d->action_show_nav->setWhatsThis(xi18n("Shows the Project Navigator pane.")); | 775 | d->action_show_nav->setWhatsThis(xi18n("Shows the Project Navigator pane.")); | ||
876 | connect(d->action_show_nav, SIGNAL(triggered()), | 776 | connect(d->action_show_nav, SIGNAL(triggered()), | ||
877 | this, SLOT(slotShowNavigator())); | 777 | this, SLOT(slotToggleProjectNavigator())); | ||
878 | } else { | 778 | } else { | ||
879 | d->action_show_nav = 0; | 779 | d->action_show_nav = 0; | ||
880 | } | 780 | } | ||
881 | 781 | | |||
882 | if (d->isProjectNavigatorVisible) { | 782 | if (d->isProjectNavigatorVisible) { | ||
883 | // Shortcut taken from "Activate Projects pane" http://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html | 783 | // Shortcut taken from "Activate Projects pane" http://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html | ||
884 | d->action_activate_nav = addAction("activate_navigator", | 784 | d->action_activate_nav = addAction("activate_navigator", | ||
885 | xi18n("Activate Project Navigator"), | 785 | xi18n("Activate Project Navigator"), | ||
Show All 13 Lines | 798 | //! @todo activate_mainarea: pressing Esc in project nav or propeditor should move back to the main area | |||
899 | ); | 799 | ); | ||
900 | d->action_activate_mainarea->setToolTip(xi18n("Activate the main area")); | 800 | d->action_activate_mainarea->setToolTip(xi18n("Activate the main area")); | ||
901 | d->action_activate_mainarea->setWhatsThis(xi18n("Activates the main area.")); | 801 | d->action_activate_mainarea->setWhatsThis(xi18n("Activates the main area.")); | ||
902 | connect(d->action_activate_mainarea, SIGNAL(triggered()), | 802 | connect(d->action_activate_mainarea, SIGNAL(triggered()), | ||
903 | this, SLOT(slotActivateMainArea())); | 803 | this, SLOT(slotActivateMainArea())); | ||
904 | 804 | | |||
905 | //! @todo windows with "_3" prefix have conflicting auto shortcut set to Alt+3 -> remove that! | 805 | //! @todo windows with "_3" prefix have conflicting auto shortcut set to Alt+3 -> remove that! | ||
906 | if (!d->userMode) { | 806 | if (!d->userMode) { | ||
907 | d->action_show_propeditor = addAction("view_propeditor", | 807 | ac->addAction("view_propeditor", | ||
908 | xi18n("Show Property Editor"), "Alt+3"); | 808 | d->action_show_propeditor = new KToggleAction(xi18n("Show Property Pane"), this)); | ||
909 | d->action_show_propeditor->setToolTip(xi18n("Show the Property Editor pane")); | 809 | d->action_show_propeditor->setShortcut(QKeySequence("Alt+3")); | ||
910 | d->action_show_propeditor->setWhatsThis(xi18n("Shows the Property Editor pane.")); | 810 | d->action_show_propeditor->setToolTip(xi18n("Show the Property pane")); | ||
811 | d->action_show_propeditor->setWhatsThis(xi18n("Shows the Property pane.")); | ||||
911 | connect(d->action_show_propeditor, SIGNAL(triggered()), | 812 | connect(d->action_show_propeditor, SIGNAL(triggered()), | ||
912 | this, SLOT(slotShowPropertyEditor())); | 813 | this, SLOT(slotTogglePropertyEditor())); | ||
913 | } else { | 814 | } else { | ||
914 | d->action_show_propeditor = 0; | 815 | d->action_show_propeditor = 0; | ||
915 | } | 816 | } | ||
916 | 817 | | |||
917 | if (!d->userMode) { | 818 | if (!d->userMode) { | ||
918 | d->action_activate_propeditor = addAction("activate_propeditor", | 819 | d->action_activate_propeditor = addAction("activate_propeditor", | ||
919 | xi18n("Activate Property Editor"), "Alt+-"); | 820 | xi18n("Activate Property Pane"), "Alt+-"); | ||
920 | d->action_activate_propeditor->setToolTip(xi18n("Activate the Property Editor pane")); | 821 | d->action_activate_propeditor->setToolTip(xi18n("Activate the Property pane")); | ||
921 | d->action_activate_propeditor->setWhatsThis(xi18n("Activates the Property Editor pane. If it is hidden, shows it first.")); | 822 | d->action_activate_propeditor->setWhatsThis(xi18n("Activates the Property pane. If it is hidden, shows it first.")); | ||
922 | connect(d->action_activate_propeditor, SIGNAL(triggered()), | 823 | connect(d->action_activate_propeditor, SIGNAL(triggered()), | ||
923 | this, SLOT(slotActivatePropertyEditor())); | 824 | this, SLOT(slotActivatePropertyPane())); | ||
924 | } else { | 825 | } else { | ||
925 | d->action_activate_propeditor = 0; | 826 | d->action_activate_propeditor = 0; | ||
926 | } | 827 | } | ||
927 | 828 | | |||
928 | d->action_view_global_search = addAction("view_global_search", | 829 | d->action_tools_locate = addAction("tools_locate", | ||
929 | xi18n("Switch to Global Search"), "Ctrl+K"); | 830 | xi18n("Locate..."), "Ctrl+K"); | ||
930 | d->action_view_global_search->setToolTip(xi18n("Switch to Global Search box")); | 831 | d->action_tools_locate->setToolTip(xi18n("Switch to Global Locate box")); | ||
931 | d->action_view_global_search->setWhatsThis(xi18n("Switches to Global Search box.")); | 832 | d->action_tools_locate->setWhatsThis(xi18n("Switches to Global Locate box.")); | ||
932 | // (connection is added elsewhere) | 833 | // (connection is added elsewhere) | ||
933 | 834 | | |||
934 | //DATA MENU | 835 | //DATA MENU | ||
935 | d->action_data_save_row = createSharedAction(xi18n("&Save Record"), koIconName("dialog-ok"), | 836 | d->action_data_save_row = createSharedAction(xi18n("&Accept"), koIconName("dialog-ok"), | ||
936 | QKeySequence(Qt::SHIFT + Qt::Key_Return), "data_save_row"); | 837 | QKeySequence(Qt::SHIFT + Qt::Key_Return), "data_save_row"); | ||
937 | d->action_data_save_row->setToolTip(xi18n("Save changes made to the current record")); | 838 | d->action_data_save_row->setToolTip(xi18n("Accept changes made to the current record")); | ||
938 | d->action_data_save_row->setWhatsThis(xi18n("Saves changes made to the current record.")); | 839 | d->action_data_save_row->setWhatsThis(xi18n("Accepts changes made to the current record.")); | ||
939 | //temp. disable because of problems with volatile actions setActionVolatile( d->action_data_save_row, true ); | 840 | //temp. disable because of problems with volatile actions setActionVolatile( d->action_data_save_row, true ); | ||
940 | 841 | | |||
941 | d->action_data_cancel_row_changes = createSharedAction(xi18n("&Cancel Record Changes"), | 842 | d->action_data_cancel_row_changes = createSharedAction(xi18n("&Cancel"), | ||
942 | koIconName("dialog-cancel"), QKeySequence(Qt::Key_Escape), "data_cancel_row_changes"); | 843 | koIconName("dialog-cancel"), QKeySequence(Qt::Key_Escape), "data_cancel_row_changes"); | ||
943 | d->action_data_cancel_row_changes->setToolTip( | 844 | d->action_data_cancel_row_changes->setToolTip( | ||
944 | xi18n("Cancel changes made to the current record")); | 845 | xi18n("Cancel changes made to the current record")); | ||
945 | d->action_data_cancel_row_changes->setWhatsThis( | 846 | d->action_data_cancel_row_changes->setWhatsThis( | ||
946 | xi18n("Cancels changes made to the current record.")); | 847 | xi18n("Cancels changes made to the current record.")); | ||
947 | //temp. disable because of problems with volatile actions setActionVolatile( d->action_data_cancel_row_changes, true ); | 848 | //temp. disable because of problems with volatile actions setActionVolatile( d->action_data_cancel_row_changes, true ); | ||
948 | 849 | | |||
949 | d->action_data_execute = createSharedAction( | 850 | d->action_data_execute = createSharedAction( | ||
Show All 11 Lines | 860 | //! @todo action->setWhatsThis(xi18n("")); | |||
961 | // - record-navigation related actions | 862 | // - record-navigation related actions | ||
962 | createSharedAction(KexiRecordNavigator::Actions::moveToFirstRecord(), QKeySequence(), "data_go_to_first_record"); | 863 | createSharedAction(KexiRecordNavigator::Actions::moveToFirstRecord(), QKeySequence(), "data_go_to_first_record"); | ||
963 | createSharedAction(KexiRecordNavigator::Actions::moveToPreviousRecord(), QKeySequence(), "data_go_to_previous_record"); | 864 | createSharedAction(KexiRecordNavigator::Actions::moveToPreviousRecord(), QKeySequence(), "data_go_to_previous_record"); | ||
964 | createSharedAction(KexiRecordNavigator::Actions::moveToNextRecord(), QKeySequence(), "data_go_to_next_record"); | 865 | createSharedAction(KexiRecordNavigator::Actions::moveToNextRecord(), QKeySequence(), "data_go_to_next_record"); | ||
965 | createSharedAction(KexiRecordNavigator::Actions::moveToLastRecord(), QKeySequence(), "data_go_to_last_record"); | 866 | createSharedAction(KexiRecordNavigator::Actions::moveToLastRecord(), QKeySequence(), "data_go_to_last_record"); | ||
966 | createSharedAction(KexiRecordNavigator::Actions::moveToNewRecord(), QKeySequence(), "data_go_to_new_record"); | 867 | createSharedAction(KexiRecordNavigator::Actions::moveToNewRecord(), QKeySequence(), "data_go_to_new_record"); | ||
967 | 868 | | |||
968 | //FORMAT MENU | 869 | //FORMAT MENU | ||
870 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
969 | d->action_format_font = createSharedAction(xi18n("&Font..."), koIconName("fonts-package"), | 871 | d->action_format_font = createSharedAction(xi18n("&Font..."), koIconName("fonts-package"), | ||
970 | QKeySequence(), "format_font"); | 872 | QKeySequence(), "format_font"); | ||
971 | d->action_format_font->setToolTip(xi18n("Change font for selected object")); | 873 | d->action_format_font->setToolTip(xi18n("Change font for selected object")); | ||
972 | d->action_format_font->setWhatsThis(xi18n("Changes font for selected object.")); | 874 | d->action_format_font->setWhatsThis(xi18n("Changes font for selected object.")); | ||
875 | #else | ||||
876 | d->action_format_font = d->dummy_action; | ||||
877 | #endif | ||||
973 | 878 | | |||
974 | //TOOLS MENU | 879 | //TOOLS MENU | ||
975 | 880 | | |||
976 | // WINDOW MENU | 881 | //WINDOW MENU | ||
977 | // additional 'Window' menu items | 882 | // additional 'Window' menu items | ||
978 | d->action_window_next = addAction("window_next", xi18n("&Next Window"), "Alt+Right"); | 883 | d->action_window_next = addAction("window_next", xi18n("&Next Window"), "Alt+Right"); | ||
979 | d->action_window_next->setToolTip(xi18n("Next window")); | 884 | d->action_window_next->setToolTip(xi18n("Next window")); | ||
980 | d->action_window_next->setWhatsThis(xi18n("Switches to the next window.")); | 885 | d->action_window_next->setWhatsThis(xi18n("Switches to the next window.")); | ||
981 | connect(d->action_window_next, SIGNAL(triggered()), | 886 | connect(d->action_window_next, SIGNAL(triggered()), this, SLOT(activateNextWindow())); | ||
982 | this, SLOT(activateNextWindow())); | | |||
983 | 887 | | |||
984 | d->action_window_previous = addAction("window_previous", xi18n("&Previous Window"), "Alt+Left"); | 888 | d->action_window_previous = addAction("window_previous", xi18n("&Previous Window"), "Alt+Left"); | ||
985 | d->action_window_previous->setToolTip(xi18n("Previous window")); | 889 | d->action_window_previous->setToolTip(xi18n("Previous window")); | ||
986 | d->action_window_previous->setWhatsThis(xi18n("Switches to the previous window.")); | 890 | d->action_window_previous->setWhatsThis(xi18n("Switches to the previous window.")); | ||
987 | connect(d->action_window_previous, SIGNAL(triggered()), | 891 | connect(d->action_window_previous, SIGNAL(triggered()), this, SLOT(activatePreviousWindow())); | ||
988 | this, SLOT(activatePreviousWindow())); | | |||
989 | 892 | | |||
990 | d->action_tab_next = addAction("tab_next", xi18n("&Next Tab"), "Ctrl+Tab"); | 893 | d->action_close_tab = addAction("close_tab", koIcon("tab-close"), xi18n("&Close Tab"), "Ctrl+W"); | ||
991 | d->action_tab_next->setToolTip(xi18n("Next tab")); | 894 | d->action_close_tab->setToolTip(xi18n("Close the current tab")); | ||
992 | d->action_tab_next->setWhatsThis(xi18n("Switches to the next tab.")); | 895 | d->action_close_tab->setWhatsThis(xi18n("Closes the current tab.")); | ||
896 | connect(d->action_close_tab, SIGNAL(triggered()), this, SLOT(closeCurrentWindow())); | ||||
897 | | ||||
898 | d->action_close_all_tabs = addAction("close_all_tabs", QIcon(), xi18n("Cl&ose All Tabs")); | ||||
899 | d->action_close_all_tabs->setToolTip(xi18n("Close all tabs")); | ||||
900 | d->action_close_all_tabs->setWhatsThis(xi18n("Closes all tabs.")); | ||||
901 | connect(d->action_close_all_tabs, SIGNAL(triggered()), this, SLOT(closeAllWindows())); | ||||
902 | | ||||
903 | d->action_tab_next = addAction("tab_next", koIcon("go-next"), | ||||
904 | KStandardShortcut::label(KStandardShortcut::TabNext)); | ||||
905 | d->action_tab_next->setWhatsThis(KStandardShortcut::whatsThis(KStandardShortcut::TabNext)); | ||||
906 | d->action_tab_next->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::TabNext)); | ||||
993 | connect(d->action_tab_next, &QAction::triggered, this, &KexiMainWindow::activateNextTab); | 907 | connect(d->action_tab_next, &QAction::triggered, this, &KexiMainWindow::activateNextTab); | ||
994 | 908 | | |||
995 | d->action_tab_previous = addAction("tab_previous", xi18n("&Previous Tab"), "Ctrl+Shift+Tab"); | 909 | d->action_tab_previous = addAction("tab_previous", koIcon("go-previous"), | ||
996 | d->action_tab_previous->setToolTip(xi18n("Previous tab")); | 910 | KStandardShortcut::label(KStandardShortcut::TabPrev)); | ||
997 | d->action_tab_previous->setWhatsThis(xi18n("Switches to the previous tab.")); | 911 | d->action_tab_previous->setWhatsThis(KStandardShortcut::whatsThis(KStandardShortcut::TabPrev)); | ||
912 | d->action_tab_previous->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::TabPrev)); | ||||
998 | connect(d->action_tab_previous, &QAction::triggered, this, &KexiMainWindow::activatePreviousTab); | 913 | connect(d->action_tab_previous, &QAction::triggered, this, &KexiMainWindow::activatePreviousTab); | ||
999 | 914 | | |||
1000 | d->action_window_fullscreen = KStandardAction::fullScreen(this, SLOT(toggleFullScreen(bool)), this, ac); | 915 | d->action_window_fullscreen = KStandardAction::fullScreen(this, SLOT(toggleFullScreen(bool)), this, ac); | ||
1001 | ac->addAction("full_screen", d->action_window_fullscreen); | 916 | ac->addAction("full_screen", d->action_window_fullscreen); | ||
1002 | QList<QKeySequence> shortcuts; | | |||
1003 | shortcuts << d->action_window_fullscreen->shortcut() << QKeySequence("F11"); | | |||
1004 | d->action_window_fullscreen->setShortcuts(shortcuts); | | |||
1005 | QShortcut *s = new QShortcut(d->action_window_fullscreen->shortcut(), this); | | |||
1006 | connect(s, SIGNAL(activated()), d->action_window_fullscreen, SLOT(trigger())); | | |||
1007 | if (d->action_window_fullscreen->shortcuts().count() > 1) { | | |||
1008 | QShortcut *sa = new QShortcut(d->action_window_fullscreen->shortcuts().value(1), this); | | |||
1009 | connect(sa, SIGNAL(activated()), d->action_window_fullscreen, SLOT(trigger())); | | |||
1010 | } | | |||
1011 | 917 | | |||
1012 | //SETTINGS MENU | 918 | //SETTINGS MENU | ||
1013 | //! @todo put 'configure keys' into settings view | 919 | //! @todo put 'configure keys' into settings view | ||
1014 | 920 | | |||
1015 | #ifdef KEXI_SHOW_UNIMPLEMENTED | 921 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||
1016 | //! @todo toolbars configuration will be handled in a special way | 922 | //! @todo toolbars configuration will be handled in a special way | ||
1017 | #endif | 923 | #endif | ||
1018 | 924 | | |||
Show All 10 Lines | |||||
1029 | #endif | 935 | #endif | ||
1030 | 936 | | |||
1031 | #ifdef KEXI_SHOW_UNIMPLEMENTED | 937 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||
1032 | //! @todo implement settings window in a specific way | 938 | //! @todo implement settings window in a specific way | ||
1033 | ac->addAction("settings", | 939 | ac->addAction("settings", | ||
1034 | action = d->action_settings = new KexiMenuWidgetAction( | 940 | action = d->action_settings = new KexiMenuWidgetAction( | ||
1035 | KStandardAction::Preferences, this)); | 941 | KStandardAction::Preferences, this)); | ||
1036 | action->setObjectName("settings"); | 942 | action->setObjectName("settings"); | ||
1037 | action->setText(futureI18n("Settings...")); | 943 | //action->setText(futureI18n("Settings...")); | ||
1038 | action->setToolTip(futureI18n("Show KEXI settings")); | 944 | action->setToolTip(futureI18n("Show KEXI settings")); | ||
1039 | action->setWhatsThis(futureI18n("Shows KEXI settings.")); | 945 | action->setWhatsThis(futureI18n("Shows KEXI settings.")); | ||
1040 | connect(action, SIGNAL(triggered()), this, SLOT(slotSettings())); | 946 | connect(action, SIGNAL(triggered()), this, SLOT(slotSettings())); | ||
1041 | setupMainMenuActionShortcut(action); | 947 | setupMainMenuActionShortcut(action); | ||
1042 | #else | 948 | #else | ||
1043 | d->action_settings = d->dummy_action; | 949 | d->action_settings = d->dummy_action; | ||
1044 | #endif | 950 | #endif | ||
1045 | 951 | | |||
1046 | //! @todo reenable 'tip of the day' later | 952 | //! @todo reenable 'tip of the day' later | ||
1047 | #if 0 | 953 | #if 0 | ||
1048 | KStandardAction::tipOfDay(this, SLOT(slotTipOfTheDayAction()), actionCollection()) | 954 | KStandardAction::tipOfDay(this, SLOT(slotTipOfTheDayAction()), actionCollection()) | ||
1049 | ->setWhatsThis(xi18n("This shows useful tips on the use of this application.")); | 955 | ->setWhatsThis(xi18n("This shows useful tips on the use of this application.")); | ||
1050 | #endif | 956 | #endif | ||
1051 | 957 | | |||
1052 | // GLOBAL | | |||
1053 | d->action_show_help_menu = addAction("help_show_menu", xi18nc("Help Menu", "Help"), "Alt+H"); | | |||
1054 | d->action_show_help_menu->setToolTip(xi18n("Show Help menu")); | | |||
1055 | d->action_show_help_menu->setWhatsThis(xi18n("Shows Help menu.")); | | |||
1056 | // (connection is added elsewhere) | | |||
1057 | | ||||
1058 | // ----- declare action categories, so form's "assign action to button" | 958 | // ----- declare action categories, so form's "assign action to button" | ||
1059 | // (and macros in the future) will be able to recognize category | 959 | // (and macros in the future) will be able to recognize category | ||
1060 | // of actions and filter them ----------------------------------- | 960 | // of actions and filter them ----------------------------------- | ||
1061 | //! @todo shouldn't we move this to core? | 961 | //! @todo shouldn't we move this to core? | ||
1062 | Kexi::ActionCategories *acat = Kexi::actionCategories(); | 962 | Kexi::ActionCategories *acat = Kexi::actionCategories(); | ||
1063 | acat->addAction("data_execute", Kexi::PartItemActionCategory); | 963 | acat->addAction("data_execute", Kexi::PartItemActionCategory); | ||
1064 | 964 | | |||
1065 | //! @todo unused for now | 965 | //! @todo unused for now | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 1064 | #endif | |||
1184 | acat->addAction("activate_navigator", Kexi::GlobalActionCategory); | 1084 | acat->addAction("activate_navigator", Kexi::GlobalActionCategory); | ||
1185 | 1085 | | |||
1186 | acat->addAction("view_propeditor", Kexi::GlobalActionCategory); | 1086 | acat->addAction("view_propeditor", Kexi::GlobalActionCategory); | ||
1187 | 1087 | | |||
1188 | acat->addAction("activate_mainarea", Kexi::GlobalActionCategory); | 1088 | acat->addAction("activate_mainarea", Kexi::GlobalActionCategory); | ||
1189 | 1089 | | |||
1190 | acat->addAction("activate_propeditor", Kexi::GlobalActionCategory); | 1090 | acat->addAction("activate_propeditor", Kexi::GlobalActionCategory); | ||
1191 | 1091 | | |||
1192 | acat->addAction("window_close", Kexi::GlobalActionCategory | Kexi::WindowActionCategory); | 1092 | acat->addAction("close_tab", Kexi::GlobalActionCategory | Kexi::WindowActionCategory); | ||
1193 | acat->setAllObjectTypesSupported("window_close", true); | 1093 | acat->setAllObjectTypesSupported("close_tab", true); | ||
1094 | | ||||
1095 | acat->addAction("close_all_tabs", Kexi::GlobalActionCategory | Kexi::WindowActionCategory); | ||||
1096 | acat->setAllObjectTypesSupported("close_all_tabs", true); | ||||
1194 | 1097 | | |||
1195 | acat->addAction("window_next", Kexi::GlobalActionCategory); | 1098 | acat->addAction("tab_next", Kexi::GlobalActionCategory); | ||
1196 | 1099 | | |||
1197 | acat->addAction("window_previous", Kexi::GlobalActionCategory); | 1100 | acat->addAction("tab_previous", Kexi::GlobalActionCategory); | ||
1198 | 1101 | | |||
1199 | acat->addAction("full_screen", Kexi::GlobalActionCategory); | 1102 | acat->addAction("full_screen", Kexi::GlobalActionCategory); | ||
1200 | 1103 | | |||
1201 | //skipped - design view only | 1104 | //skipped - design view only | ||
1202 | acat->addAction("format_font", Kexi::NoActionCategory); | 1105 | acat->addAction("format_font", Kexi::NoActionCategory); | ||
1203 | acat->addAction("project_save", Kexi::NoActionCategory); | 1106 | acat->addAction("project_save", Kexi::NoActionCategory); | ||
1204 | acat->addAction("edit_insert_empty_row", Kexi::NoActionCategory); | 1107 | acat->addAction("edit_insert_empty_row", Kexi::NoActionCategory); | ||
1205 | //! @todo support this in KexiPart::TableObjectType, KexiPart::QueryObjectType later | 1108 | //! @todo support this in KexiPart::TableObjectType, KexiPart::QueryObjectType later | ||
Show All 19 Lines | |||||
1225 | acat->addAction("tablepart_create", Kexi::NoActionCategory); | 1128 | acat->addAction("tablepart_create", Kexi::NoActionCategory); | ||
1226 | acat->addAction("querypart_create", Kexi::NoActionCategory); | 1129 | acat->addAction("querypart_create", Kexi::NoActionCategory); | ||
1227 | acat->addAction("formpart_create", Kexi::NoActionCategory); | 1130 | acat->addAction("formpart_create", Kexi::NoActionCategory); | ||
1228 | acat->addAction("reportpart_create", Kexi::NoActionCategory); | 1131 | acat->addAction("reportpart_create", Kexi::NoActionCategory); | ||
1229 | acat->addAction("macropart_create", Kexi::NoActionCategory); | 1132 | acat->addAction("macropart_create", Kexi::NoActionCategory); | ||
1230 | acat->addAction("scriptpart_create", Kexi::NoActionCategory); | 1133 | acat->addAction("scriptpart_create", Kexi::NoActionCategory); | ||
1231 | } | 1134 | } | ||
1232 | 1135 | | |||
1136 | void KexiMainWindow::setupMainMenu() | ||||
1137 | { | ||||
1138 | KActionCollection *ac = actionCollection(); | ||||
1139 | QMenuBar *menu = menuBar(); | ||||
1140 | { | ||||
1141 | QMenu *fileMenu = menu->addMenu(xi18n("&File")); | ||||
1142 | if (!d->userMode) { | ||||
1143 | d->addAction(fileMenu, "project_new"); | ||||
1144 | fileMenu->addSeparator(); | ||||
1145 | d->addAction(fileMenu, "project_open"); | ||||
1146 | d->addAction(fileMenu, "project_open_recent"); | ||||
1147 | fileMenu->addSeparator(); | ||||
1148 | } | ||||
1149 | fileMenu->addAction(d->action_save); | ||||
1150 | if (!d->userMode) { | ||||
1151 | fileMenu->addAction(d->action_save_as); | ||||
1152 | } | ||||
1153 | fileMenu->addSeparator(); | ||||
1154 | if (!d->userMode) { | ||||
1155 | fileMenu->addAction(d->action_tools_import_project); | ||||
1156 | fileMenu->addSeparator(); | ||||
1157 | } | ||||
1158 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1159 | fileMenu->addAction(d->action_project_print); | ||||
1160 | fileMenu->addAction(d->action_project_print_preview); | ||||
1161 | fileMenu->addAction(d->action_project_print_setup); | ||||
1162 | fileMenu->addSeparator(); | ||||
1163 | #endif | ||||
1164 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1165 | fileMenu->addAction(d->action_project_properties); | ||||
1166 | fileMenu->addSeparator(); | ||||
1167 | #endif | ||||
1168 | fileMenu->addAction(d->action_close_tab); | ||||
1169 | fileMenu->addAction(d->action_close_all_tabs); | ||||
1170 | if (!d->userMode) { | ||||
1171 | fileMenu->addAction(d->action_close); | ||||
1172 | } | ||||
1173 | fileMenu->addSeparator(); | ||||
1174 | d->addAction(fileMenu, "quit"); | ||||
1175 | } | ||||
1176 | { | ||||
1177 | QMenu *editMenu = menu->addMenu(xi18n("&Edit")); | ||||
1178 | editMenu->addAction(d->action_edit_undo); | ||||
1179 | editMenu->addAction(d->action_edit_redo); | ||||
1180 | editMenu->addSeparator(); | ||||
1181 | editMenu->addAction(d->action_edit_cut); | ||||
1182 | editMenu->addAction(d->action_edit_copy); | ||||
1183 | editMenu->addAction(d->action_edit_copy_special_data_table); | ||||
1184 | editMenu->addAction(d->action_edit_paste); | ||||
1185 | if (!d->userMode) { | ||||
1186 | editMenu->addAction(d->action_edit_paste_special_data_table); | ||||
1187 | } | ||||
1188 | editMenu->addSeparator(); | ||||
1189 | editMenu->addAction(d->action_edit_select_all); | ||||
1190 | editMenu->addSeparator(); | ||||
1191 | { | ||||
1192 | QMenu *findReplaceMenu = editMenu->addMenu(xi18n("&Find/Replace")); | ||||
1193 | findReplaceMenu->addAction(d->action_edit_find); | ||||
1194 | findReplaceMenu->addAction(d->action_edit_findnext); | ||||
1195 | findReplaceMenu->addAction(d->action_edit_findprev); | ||||
1196 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1197 | findReplaceMenu->addSeparator(); | ||||
1198 | findReplaceMenu->addAction(d->action_edit_replace); | ||||
1199 | findReplaceMenu->addAction(d->action_edit_replace_all); | ||||
1200 | #endif | ||||
1201 | } | ||||
1202 | editMenu->addSeparator(); | ||||
1203 | editMenu->addAction(d->action_edit_delete); | ||||
1204 | // in local toolbar already: editMenu->addAction(d->action_data_save_row); | ||||
1205 | // in local toolbar already: editMenu->addAction(d->action_data_cancel_row_changes); | ||||
1206 | //TODO move to local menu: editMenu->addAction(d->action_edit_edititem); | ||||
1207 | //TODO move to local menu: editMenu->addAction(d->action_edit_insert_empty_row); | ||||
1208 | //TODO move to local menu: editMenu->addAction(d->action_data_execute); | ||||
1209 | //editMenu->addSeparator(); | ||||
1210 | //TODO move to local menu: editMenu->addAction(d->action_edit_delete); | ||||
1211 | //TODO move to local menu: editMenu->addAction(d->action_edit_delete_row); | ||||
1212 | //in local menu already editMenu->addAction(d->action_edit_clear_table); | ||||
1213 | } | ||||
1214 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1215 | { | ||||
1216 | QMenu *formatMenu = menu->addMenu(xi18n("F&ormat")); | ||||
1217 | formatMenu->addAction(d->action_format_font); | ||||
1218 | } | ||||
1219 | #endif | ||||
1220 | { | ||||
1221 | QMenu *dataMenu = menu->addMenu(xi18n("&Data")); | ||||
1222 | if (!d->userMode) { | ||||
1223 | dataMenu->addAction(d->action_project_import_data_table); | ||||
1224 | dataMenu->addAction(d->action_tools_data_import); | ||||
1225 | dataMenu->addSeparator(); | ||||
1226 | } | ||||
1227 | dataMenu->addAction(d->action_project_export_data_table); | ||||
1228 | } | ||||
1229 | { | ||||
1230 | QMenu *toolsMenu = menu->addMenu(xi18n("&Tools")); | ||||
1231 | toolsMenu->addAction(d->action_tools_locate); | ||||
1232 | toolsMenu->addSeparator(); | ||||
1233 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1234 | toolsMenu->addAction(d->action_project_relations); | ||||
1235 | #endif | ||||
1236 | toolsMenu->addAction(d->action_tools_compact_database); | ||||
1237 | } | ||||
1238 | { | ||||
1239 | QMenu *settingsMenu = menu->addMenu(xi18n("&Settings")); | ||||
1240 | settingsMenu->addAction(d->action_window_fullscreen); | ||||
1241 | settingsMenu->addSeparator(); | ||||
1242 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||||
1243 | settingsMenu->addAction(d->action_settings); | ||||
1244 | #endif | ||||
1245 | } | ||||
1246 | { | ||||
1247 | QMenu *windowMenu = menu->addMenu(xi18n("&Window")); | ||||
1248 | windowMenu->addAction(d->action_tab_next); | ||||
1249 | windowMenu->addAction(d->action_tab_previous); | ||||
1250 | windowMenu->addSeparator(); | ||||
1251 | windowMenu->addAction(d->action_show_nav); | ||||
1252 | windowMenu->addAction(d->action_show_propeditor); | ||||
1253 | } | ||||
1254 | { | ||||
1255 | // add help menu actions... (KexiTabbedToolBar depends on them) | ||||
1256 | KHelpMenu *helpMenu = new KHelpMenu(this, KAboutData::applicationData(), | ||||
1257 | true/*showWhatsThis*/); | ||||
1258 | QAction* help_report_bug_action = helpMenu->action(KHelpMenu::menuReportBug); | ||||
1259 | ac->addAction(help_report_bug_action->objectName(), help_report_bug_action); | ||||
1260 | QObject::disconnect(help_report_bug_action, 0, 0, 0); | ||||
1261 | QObject::connect(help_report_bug_action, &QAction::triggered, this, &KexiMainWindow::slotReportBug); | ||||
1262 | help_report_bug_action->setText(xi18nc("Report a bug or wish for KEXI application", "Report a &Bug or Wish...")); | ||||
1263 | help_report_bug_action->setIcon(koIcon("tools-report-bug")); // good icon for toolbar | ||||
1264 | help_report_bug_action->setWhatsThis(xi18n("Files a bug or wish for KEXI application.")); | ||||
1265 | QAction* help_whats_this_action = helpMenu->action(KHelpMenu::menuWhatsThis); | ||||
1266 | ac->addAction(help_whats_this_action->objectName(), help_whats_this_action); | ||||
1267 | help_whats_this_action->setWhatsThis(xi18n("Activates a \"What's This?\" tool.")); | ||||
1268 | QAction* help_contents_action = helpMenu->action(KHelpMenu::menuHelpContents); | ||||
1269 | ac->addAction(help_contents_action->objectName(), help_contents_action); | ||||
1270 | help_contents_action->setText(xi18n("Help")); | ||||
1271 | help_contents_action->setWhatsThis(xi18n("Shows KEXI Handbook.")); | ||||
1272 | QAction* help_about_app_action = helpMenu->action(KHelpMenu::menuAboutApp); | ||||
1273 | ac->addAction(help_about_app_action->objectName(), help_about_app_action); | ||||
1274 | help_about_app_action->setWhatsThis(xi18n("Shows information about KEXI application.")); | ||||
1275 | QAction* help_about_kde_action = helpMenu->action(KHelpMenu::menuAboutKDE); | ||||
1276 | ac->addAction(help_about_kde_action->objectName(), help_about_kde_action); | ||||
1277 | help_about_kde_action->setWhatsThis(xi18n("Shows information about KDE.")); | ||||
1278 | menu->addMenu(helpMenu->menu()); | ||||
1279 | } | ||||
1280 | } | ||||
1281 | | ||||
1233 | void KexiMainWindow::invalidateActions() | 1282 | void KexiMainWindow::invalidateActions() | ||
1234 | { | 1283 | { | ||
1235 | invalidateProjectWideActions(); | 1284 | invalidateProjectWideActions(); | ||
1236 | invalidateSharedActions(); | 1285 | invalidateSharedActions(); | ||
1237 | } | 1286 | } | ||
1238 | 1287 | | |||
1239 | void KexiMainWindow::invalidateSharedActions(QObject *o) | 1288 | void KexiMainWindow::invalidateSharedActions(QObject *o) | ||
1240 | { | 1289 | { | ||
Show All 25 Lines | 1312 | { | |||
1266 | const bool readOnly = d->prj && d->prj->dbConnection() && d->prj->dbConnection()->options()->isReadOnly(); | 1315 | const bool readOnly = d->prj && d->prj->dbConnection() && d->prj->dbConnection()->options()->isReadOnly(); | ||
1267 | 1316 | | |||
1268 | //PROJECT MENU | 1317 | //PROJECT MENU | ||
1269 | d->action_save->setEnabled(has_window && window_dirty && !readOnly); | 1318 | d->action_save->setEnabled(has_window && window_dirty && !readOnly); | ||
1270 | d->action_save_as->setEnabled(has_window && !readOnly); | 1319 | d->action_save_as->setEnabled(has_window && !readOnly); | ||
1271 | d->action_project_properties->setEnabled(d->prj); | 1320 | d->action_project_properties->setEnabled(d->prj); | ||
1272 | d->action_close->setEnabled(d->prj); | 1321 | d->action_close->setEnabled(d->prj); | ||
1273 | d->action_project_relations->setEnabled(d->prj); | 1322 | d->action_project_relations->setEnabled(d->prj); | ||
1323 | if (d->objectViewWidget) { | ||||
1324 | d->action_close_tab->setEnabled(has_window); | ||||
1325 | d->action_close_all_tabs->setEnabled(has_window); | ||||
1326 | } | ||||
1274 | 1327 | | |||
1275 | //DATA MENU | 1328 | //DATA MENU | ||
1276 | if (d->action_project_import_data_table) | 1329 | if (d->action_project_import_data_table) | ||
1277 | d->action_project_import_data_table->setEnabled(d->prj && !readOnly); | 1330 | d->action_project_import_data_table->setEnabled(d->prj && !readOnly); | ||
1278 | if (d->action_tools_data_import) | 1331 | if (d->action_tools_data_import) | ||
1279 | d->action_tools_data_import->setEnabled(d->prj && !readOnly); | 1332 | d->action_tools_data_import->setEnabled(d->prj && !readOnly); | ||
1280 | d->action_project_export_data_table->setEnabled( | 1333 | d->action_project_export_data_table->setEnabled( | ||
1281 | currentWindow() && currentWindow()->part()->info()->isDataExportSupported()); | 1334 | currentWindow() && currentWindow()->part()->info()->isDataExportSupported()); | ||
1282 | if (d->action_edit_paste_special_data_table) | 1335 | if (d->action_edit_paste_special_data_table) | ||
1283 | d->action_edit_paste_special_data_table->setEnabled(d->prj && !readOnly); | 1336 | d->action_edit_paste_special_data_table->setEnabled(d->prj && !readOnly); | ||
1284 | 1337 | | |||
1285 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | 1338 | #ifdef KEXI_SHOW_UNIMPLEMENTED | ||
1286 | const bool printingActionsEnabled = | 1339 | const bool printingActionsEnabled = | ||
1287 | currentWindow() && currentWindow()->part()->info()->isPrintingSupported() | 1340 | currentWindow() && currentWindow()->part()->info()->isPrintingSupported() | ||
1288 | && !currentWindow()->neverSaved(); | 1341 | && !currentWindow()->neverSaved(); | ||
1289 | d->action_project_print->setEnabled(printingActionsEnabled); | 1342 | d->action_project_print->setEnabled(printingActionsEnabled); | ||
1290 | d->action_project_print_preview->setEnabled(printingActionsEnabled); | 1343 | d->action_project_print_preview->setEnabled(printingActionsEnabled); | ||
1291 | d->action_project_print_setup->setEnabled(printingActionsEnabled); | 1344 | d->action_project_print_setup->setEnabled(printingActionsEnabled); | ||
1292 | #endif | 1345 | #endif | ||
1293 | 1346 | | |||
1294 | //EDIT MENU | 1347 | //EDIT MENU | ||
1295 | //! @todo "copy special" is currently enabled only for data view mode; | 1348 | //! @todo "copy special" is currently enabled only for data view mode; | ||
1296 | //! what about allowing it to enable in design view for "kexi/table" ? | 1349 | //! what about allowing it to enable in design view for "kexi/table" ? | ||
1297 | if (currentWindow() && currentWindow()->currentViewMode() == Kexi::DataViewMode) { | 1350 | if (currentWindow() && currentWindow()->currentViewMode() == Kexi::DataViewMode) { | ||
1298 | KexiPart::Info *activePartInfo = currentWindow()->part()->info(); | 1351 | KexiPart::Info *activePartInfo = currentWindow()->part()->info(); | ||
1299 | d->action_edit_copy_special_data_table->setEnabled( | 1352 | d->action_edit_copy_special_data_table->setEnabled( | ||
1300 | activePartInfo ? activePartInfo->isDataExportSupported() : false); | 1353 | activePartInfo ? activePartInfo->isDataExportSupported() : false); | ||
1301 | } else { | 1354 | } else { | ||
1302 | d->action_edit_copy_special_data_table->setEnabled(false); | 1355 | d->action_edit_copy_special_data_table->setEnabled(false); | ||
1303 | } | 1356 | } | ||
1304 | d->action_edit_find->setEnabled(d->prj); | 1357 | d->action_edit_find->setEnabled(d->prj); | ||
1305 | 1358 | | |||
1306 | //VIEW MENU | 1359 | //VIEW MENU | ||
1307 | if (d->action_show_nav) | 1360 | if (d->action_show_nav) | ||
1308 | d->action_show_nav->setEnabled(d->prj); | 1361 | d->action_show_nav->setEnabled(d->prj); | ||
1309 | d->action_activate_mainarea->setEnabled(d->prj); | 1362 | d->action_activate_mainarea->setEnabled(d->prj); | ||
1310 | if (d->action_show_propeditor) | | |||
1311 | d->action_show_propeditor->setEnabled(d->prj); | | |||
1312 | #ifdef KEXI_SHOW_CONTEXT_HELP | | |||
1313 | d->action_show_helper->setEnabled(d->prj); | | |||
1314 | #endif | | |||
1315 | 1363 | | |||
1316 | //CREATE MENU | 1364 | //CREATE MENU | ||
1317 | if (d->tabbedToolBar && d->tabbedToolBar->createWidgetToolBar()) | 1365 | if (d->tabbedToolBar && d->tabbedToolBar->createWidgetToolBar()) | ||
1318 | d->tabbedToolBar->createWidgetToolBar()->setEnabled(d->prj); | 1366 | d->tabbedToolBar->createWidgetToolBar()->setEnabled(d->prj); | ||
1319 | 1367 | | |||
1320 | // DATA MENU | 1368 | // DATA MENU | ||
1321 | 1369 | | |||
1370 | // WINDOW MENU | ||||
1371 | if (d->objectViewWidget) { | ||||
1372 | d->action_tab_next->setEnabled(d->objectViewWidget->tabWidget()->count() > 1); | ||||
1373 | d->action_tab_previous->setEnabled(d->objectViewWidget->tabWidget()->count() > 1); | ||||
1374 | } | ||||
1375 | | ||||
1322 | //TOOLS MENU | 1376 | //TOOLS MENU | ||
1323 | // "compact db" supported if there's no db or the current db supports compacting and is opened r/w: | 1377 | // "compact db" supported if there's no db or the current db supports compacting and is opened r/w: | ||
1324 | d->action_tools_compact_database->setEnabled( | 1378 | d->action_tools_compact_database->setEnabled( | ||
1325 | //! @todo Support compacting of non-opened projects | 1379 | //! @todo Support compacting of non-opened projects | ||
1326 | /*!d->prj | 1380 | /*!d->prj | ||
1327 | ||*/ (!readOnly && d->prj && d->prj->dbConnection() | 1381 | ||*/ (!readOnly && d->prj && d->prj->dbConnection() | ||
1328 | && (d->prj->dbConnection()->driver()->features() & KDbDriver::CompactingDatabaseSupported)) | 1382 | && (d->prj->dbConnection()->driver()->features() & KDbDriver::CompactingDatabaseSupported)) | ||
1329 | ); | 1383 | ); | ||
1330 | 1384 | | |||
1331 | //DOCKS | 1385 | //DOCKS | ||
1332 | if (d->navigator) { | 1386 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
1333 | d->navigator->setEnabled(d->prj); | 1387 | d->objectViewWidget->projectNavigator()->setEnabled(d->prj); | ||
1388 | } | ||||
1389 | if (d->objectViewWidget && d->objectViewWidget->propertyPane()) { | ||||
1390 | d->objectViewWidget->propertyPane()->setEnabled(d->prj); | ||||
1334 | } | 1391 | } | ||
1335 | if (d->propEditor) | | |||
1336 | d->propEditorTabWidget->setEnabled(d->prj); | | |||
1337 | } | 1392 | } | ||
1338 | 1393 | | |||
1339 | tristate KexiMainWindow::startup() | 1394 | tristate KexiMainWindow::startup() | ||
1340 | { | 1395 | { | ||
1341 | tristate result = true; | 1396 | tristate result = true; | ||
1342 | switch (KexiStartupHandler::global()->action()) { | 1397 | switch (KexiStartupHandler::global()->action()) { | ||
1343 | case KexiStartupHandler::CreateBlankProject: | 1398 | case KexiStartupHandler::CreateBlankProject: | ||
1344 | d->updatePropEditorVisibility(Kexi::NoViewMode); | 1399 | d->updatePropEditorVisibility(Kexi::NoViewMode); | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 1454 | if (incompatibleWithKexi) { | |||
1419 | } | 1474 | } | ||
1420 | return cancelled; | 1475 | return cancelled; | ||
1421 | } | 1476 | } | ||
1422 | return false; | 1477 | return false; | ||
1423 | } | 1478 | } | ||
1424 | 1479 | | |||
1425 | // success | 1480 | // success | ||
1426 | d->prj = prj.take(); | 1481 | d->prj = prj.take(); | ||
1427 | setupProjectNavigator(); | 1482 | d->modeSelector->setCurrentMode(Kexi::EditGlobalMode); | ||
1428 | d->prj->data()->setLastOpened(QDateTime::currentDateTime()); | 1483 | d->prj->data()->setLastOpened(QDateTime::currentDateTime()); | ||
1429 | Kexi::recentProjects()->addProjectData(*d->prj->data()); | 1484 | Kexi::recentProjects()->addProjectData(*d->prj->data()); | ||
1430 | updateReadOnlyState(); | 1485 | updateReadOnlyState(); | ||
1431 | invalidateActions(); | 1486 | invalidateActions(); | ||
1432 | setMessagesEnabled(false); | 1487 | setMessagesEnabled(false); | ||
1433 | 1488 | | |||
1434 | QTimer::singleShot(1, this, SLOT(slotAutoOpenObjectsLater())); | 1489 | QTimer::singleShot(1, this, SLOT(slotAutoOpenObjectsLater())); | ||
1435 | if (d->tabbedToolBar) { | 1490 | if (d->tabbedToolBar) { | ||
1436 | d->tabbedToolBar->showTab("create");// not needed since create toolbar already shows toolbar! move when kexi starts | 1491 | d->tabbedToolBar->showTab("create");// not needed since create toolbar already shows toolbar! move when kexi starts | ||
1437 | d->tabbedToolBar->showTab("data"); | | |||
1438 | d->tabbedToolBar->showTab("external"); | | |||
1439 | d->tabbedToolBar->showTab("tools"); | | |||
1440 | d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is split | 1492 | d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is split | ||
1441 | d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is split | 1493 | d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is split | ||
1442 | 1494 | | |||
1443 | // make sure any tab is activated | 1495 | // make sure any tab is activated | ||
1444 | d->tabbedToolBar->setCurrentTab(0); | 1496 | d->tabbedToolBar->setCurrentTab(0); | ||
1445 | } | 1497 | } | ||
1446 | return true; | 1498 | return true; | ||
1447 | } | 1499 | } | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 1565 | #else | |||
1514 | return false; | 1566 | return false; | ||
1515 | #endif | 1567 | #endif | ||
1516 | } | 1568 | } | ||
1517 | 1569 | | |||
1518 | void KexiMainWindow::updateReadOnlyState() | 1570 | void KexiMainWindow::updateReadOnlyState() | ||
1519 | { | 1571 | { | ||
1520 | const bool readOnly = d->prj && d->prj->dbConnection() && d->prj->dbConnection()->options()->isReadOnly(); | 1572 | const bool readOnly = d->prj && d->prj->dbConnection() && d->prj->dbConnection()->options()->isReadOnly(); | ||
1521 | //! @todo KEXI3 show read-only flag in the GUI because we have no statusbar | 1573 | //! @todo KEXI3 show read-only flag in the GUI because we have no statusbar | ||
1522 | if (d->navigator) { | 1574 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
1523 | d->navigator->setReadOnly(readOnly); | 1575 | d->objectViewWidget->projectNavigator()->setReadOnly(readOnly); | ||
1524 | } | 1576 | } | ||
1525 | 1577 | | |||
1526 | // update "insert ....." actions for every part | 1578 | // update "insert ....." actions for every part | ||
1527 | KexiPart::PartInfoList *plist = Kexi::partManager().infoList(); | 1579 | KexiPart::PartInfoList *plist = Kexi::partManager().infoList(); | ||
1528 | if (plist) { | 1580 | if (plist) { | ||
1529 | foreach(KexiPart::Info *info, *plist) { | 1581 | foreach(KexiPart::Info *info, *plist) { | ||
1530 | QAction *a = info->newObjectAction(); | 1582 | QAction *a = info->newObjectAction(); | ||
1531 | if (a) | 1583 | if (a) | ||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 1796 | #endif | |||
1751 | } | 1803 | } | ||
1752 | 1804 | | |||
1753 | // now we will close for sure | 1805 | // now we will close for sure | ||
1754 | emit beforeProjectClosing(); | 1806 | emit beforeProjectClosing(); | ||
1755 | 1807 | | |||
1756 | if (!d->prj->closeConnection()) | 1808 | if (!d->prj->closeConnection()) | ||
1757 | return false; | 1809 | return false; | ||
1758 | 1810 | | |||
1759 | if (d->navigator) { | 1811 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
1760 | d->navWasVisibleBeforeProjectClosing = d->navDockWidget->isVisible(); | 1812 | d->navWasVisibleBeforeProjectClosing = d->objectViewWidget->projectNavigator()->isVisible(); | ||
1761 | d->navDockWidget->hide(); | 1813 | d->setProjectNavigatorVisible(false); | ||
1762 | d->navigator->setProject(0); | 1814 | d->objectViewWidget->projectNavigator()->setProject(0); | ||
1763 | slotProjectNavigatorVisibilityChanged(true); // hide side tab | 1815 | //slotProjectNavigatorVisibilityChanged(true); // hide side tab | ||
1764 | } | 1816 | } | ||
1765 | 1817 | | |||
1766 | if (d->propEditorDockWidget) | 1818 | if (d->objectViewWidget && d->objectViewWidget->propertyPane()) { | ||
1767 | d->propEditorDockWidget->hide(); | 1819 | d->objectViewWidget->propertyPane()->hide(); | ||
1768 | 1820 | d->action_show_propeditor->setChecked(false); | |||
1821 | } | ||||
1769 | d->clearWindows(); //sanity! | 1822 | d->clearWindows(); //sanity! | ||
1770 | delete d->prj; | 1823 | delete d->prj; | ||
1771 | d->prj = 0; | 1824 | d->prj = 0; | ||
1772 | 1825 | | |||
1773 | updateReadOnlyState(); | 1826 | updateReadOnlyState(); | ||
1774 | invalidateActions(); | 1827 | invalidateActions(); | ||
1775 | updateAppCaption(); | 1828 | updateAppCaption(); | ||
1829 | if (d->userMode) { | ||||
1830 | d->modeSelector->setCurrentMode(Kexi::WelcomeGlobalMode); | ||||
1831 | } | ||||
1776 | 1832 | | |||
1777 | emit projectClosed(); | 1833 | emit projectClosed(); | ||
1778 | return true; | 1834 | return true; | ||
1779 | } | 1835 | } | ||
1780 | 1836 | | |||
1781 | void KexiMainWindow::setupContextHelp() | 1837 | void KexiMainWindow::setupContextHelp() | ||
1782 | { | 1838 | { | ||
1783 | #ifdef KEXI_SHOW_CONTEXT_HELP | 1839 | #ifdef KEXI_SHOW_CONTEXT_HELP | ||
1784 | d->ctxHelp = new KexiContextHelp(d->mainWidget, this); | 1840 | d->ctxHelp = new KexiContextHelp(d->mainWidget, this); | ||
1785 | //! @todo | 1841 | //! @todo | ||
1786 | /* | 1842 | /* | ||
1787 | d->ctxHelp->setContextHelp(xi18n("Welcome"),xi18n("The <B>KEXI team</B> wishes you a lot of productive work, " | 1843 | d->ctxHelp->setContextHelp(xi18n("Welcome"),xi18n("The <B>KEXI team</B> wishes you a lot of productive work, " | ||
1788 | "with this product. <BR><HR><BR>If you have found a <B>bug</B> or have a <B>feature</B> request, please don't " | 1844 | "with this product. <BR><HR><BR>If you have found a <B>bug</B> or have a <B>feature</B> request, please don't " | ||
1789 | "hesitate to report it at our <A href=\"http://www.kexi-project.org/cgi-bin/bug.pl\"> issue " | 1845 | "hesitate to report it at our <A href=\"http://www.kexi-project.org/cgi-bin/bug.pl\"> issue " | ||
1790 | "tracking system </A>.<BR><HR><BR>If you would like to <B>join</B> our effort, the <B>development</B> documentation " | 1846 | "tracking system </A>.<BR><HR><BR>If you would like to <B>join</B> our effort, the <B>development</B> documentation " | ||
1791 | "at <A href=\"http://www.kexi-project.org\">www.kexi-project.org</A> is a good starting point."),0); | 1847 | "at <A href=\"http://www.kexi-project.org\">www.kexi-project.org</A> is a good starting point."),0); | ||
1792 | */ | 1848 | */ | ||
1793 | addToolWindow(d->ctxHelp, KDockWidget::DockBottom | KDockWidget::DockLeft, getMainDockWidget(), 20); | 1849 | addToolWindow(d->ctxHelp, KDockWidget::DockBottom | KDockWidget::DockLeft, getMainDockWidget(), 20); | ||
1794 | #endif | 1850 | #endif | ||
1795 | } | 1851 | } | ||
1796 | 1852 | | |||
1797 | void KexiMainWindow::setupMainWidget() | 1853 | void KexiMainWindow::setupMainWidget() | ||
1798 | { | 1854 | { | ||
1799 | QVBoxLayout *vlyr = new QVBoxLayout(this); | 1855 | QWidget *centralWidget = new QWidget; | ||
1856 | setCentralWidget(centralWidget); | ||||
1857 | | ||||
1858 | QVBoxLayout *vlyr = new QVBoxLayout(centralWidget); | ||||
1800 | vlyr->setContentsMargins(0, 0, 0, 0); | 1859 | vlyr->setContentsMargins(0, 0, 0, 0); | ||
1801 | vlyr->setSpacing(0); | 1860 | vlyr->setSpacing(0); | ||
1802 | 1861 | | |||
1803 | if (d->isMainMenuVisible) { | 1862 | if (d->isMainMenuVisible) { | ||
1804 | QWidget *tabbedToolBarContainer = new QWidget(this); | 1863 | QWidget *tabbedToolBarContainer = new QWidget(this); | ||
1805 | vlyr->addWidget(tabbedToolBarContainer); | 1864 | vlyr->addWidget(tabbedToolBarContainer); | ||
1806 | QVBoxLayout *tabbedToolBarContainerLyr = new QVBoxLayout(tabbedToolBarContainer); | 1865 | QVBoxLayout *tabbedToolBarContainerLyr = new QVBoxLayout(tabbedToolBarContainer); | ||
1807 | tabbedToolBarContainerLyr->setSpacing(0); | 1866 | tabbedToolBarContainerLyr->setSpacing(0); | ||
1808 | tabbedToolBarContainerLyr->setContentsMargins( | 1867 | tabbedToolBarContainerLyr->setContentsMargins( | ||
1809 | KexiUtils::marginHint() / 2, KexiUtils::marginHint() / 2, | 1868 | KexiUtils::marginHint() / 2, KexiUtils::marginHint() / 2, | ||
1810 | KexiUtils::marginHint() / 2, KexiUtils::marginHint() / 2); | 1869 | KexiUtils::marginHint() / 2, KexiUtils::marginHint() / 2); | ||
1811 | 1870 | | |||
1812 | d->tabbedToolBar = new KexiTabbedToolBar(tabbedToolBarContainer); | 1871 | d->tabbedToolBar = new KexiTabbedToolBar(tabbedToolBarContainer); | ||
1813 | Q_ASSERT(d->action_view_global_search); | 1872 | Q_ASSERT(d->action_tools_locate); | ||
1814 | connect(d->action_view_global_search, SIGNAL(triggered()), | 1873 | connect(d->action_tools_locate, SIGNAL(triggered()), | ||
1815 | d->tabbedToolBar, SLOT(activateSearchLineEdit())); | 1874 | d->tabbedToolBar, SLOT(activateSearchLineEdit())); | ||
1816 | tabbedToolBarContainerLyr->addWidget(d->tabbedToolBar); | 1875 | tabbedToolBarContainerLyr->addWidget(d->tabbedToolBar); | ||
1817 | d->tabbedToolBar->hideTab("form"); //temporarily until createToolbar is split | 1876 | d->tabbedToolBar->hideTab("form"); //temporarily until createToolbar is split | ||
1818 | d->tabbedToolBar->hideTab("report"); //temporarily until createToolbar is split | 1877 | d->tabbedToolBar->hideTab("report"); //temporarily until createToolbar is split | ||
1819 | } | 1878 | } | ||
1820 | else { | 1879 | else { | ||
1821 | d->tabbedToolBar = 0; | 1880 | d->tabbedToolBar = 0; | ||
1822 | } | 1881 | } | ||
1823 | 1882 | | |||
1824 | QWidget *mainWidgetContainer = new QWidget(); | 1883 | QWidget *mainWidgetContainer = new QWidget(); | ||
1825 | vlyr->addWidget(mainWidgetContainer, 1); | 1884 | vlyr->addWidget(mainWidgetContainer, 1); | ||
1826 | QHBoxLayout *mainWidgetContainerLyr = new QHBoxLayout(mainWidgetContainer); | 1885 | QHBoxLayout *mainWidgetContainerLyr = new QHBoxLayout(mainWidgetContainer); | ||
1827 | mainWidgetContainerLyr->setContentsMargins(0, 0, 0, 0); | 1886 | mainWidgetContainerLyr->setContentsMargins(0, 0, 0, 0); | ||
1828 | mainWidgetContainerLyr->setSpacing(0); | 1887 | mainWidgetContainerLyr->setSpacing(0); | ||
1829 | 1888 | | |||
1830 | 1889 | d->modeSelector = new KexiGlobalViewModeSelector; | |||
1831 | KMultiTabBar *mtbar = new KMultiTabBar(KMultiTabBar::Left); | 1890 | connect(d->modeSelector, &KexiGlobalViewModeSelector::currentModeChanged, | ||
1832 | mtbar->setStyle(KMultiTabBar::VSNET); | 1891 | this, &KexiMainWindow::slotCurrentModeChanged); | ||
1833 | mainWidgetContainerLyr->addWidget(mtbar); | 1892 | mainWidgetContainerLyr->addWidget(d->modeSelector); | ||
1834 | d->multiTabBars.insert(mtbar->position(), mtbar); | 1893 | if (d->userMode) { | ||
1835 | 1894 | d->modeSelector->hide(); | |||
1836 | d->mainWidget = new KexiMainWidget(); | | |||
1837 | d->mainWidget->setParent(this); | | |||
1838 | | ||||
1839 | d->mainWidget->tabWidget()->setTabsClosable(true); | | |||
1840 | connect(d->mainWidget->tabWidget(), SIGNAL(tabCloseRequested(int)), | | |||
1841 | this, SLOT(closeWindowForTab(int))); | | |||
1842 | mainWidgetContainerLyr->addWidget(d->mainWidget, 1); | | |||
1843 | | ||||
1844 | mtbar = new KMultiTabBar(KMultiTabBar::Right); | | |||
1845 | mtbar->setStyle(KMultiTabBar::VSNET); | | |||
1846 | mainWidgetContainerLyr->addWidget(mtbar); | | |||
1847 | d->multiTabBars.insert(mtbar->position(), mtbar); | | |||
1848 | } | | |||
1849 | | ||||
1850 | void KexiMainWindow::slotSetProjectNavigatorVisible(bool set) | | |||
1851 | { | | |||
1852 | if (d->navDockWidget) | | |||
1853 | d->navDockWidget->setVisible(set); | | |||
1854 | } | | |||
1855 | | ||||
1856 | void KexiMainWindow::slotSetPropertyEditorVisible(bool set) | | |||
1857 | { | | |||
1858 | if (d->propEditorDockWidget) | | |||
1859 | d->propEditorDockWidget->setVisible(set); | | |||
1860 | } | 1895 | } | ||
1861 | 1896 | | |||
1862 | void KexiMainWindow::slotProjectNavigatorVisibilityChanged(bool visible) | 1897 | d->globalViewStack = new QStackedWidget; | ||
1863 | { | 1898 | mainWidgetContainerLyr->addWidget(d->globalViewStack, 1); | ||
1864 | d->setTabBarVisible(KMultiTabBar::Left, PROJECT_NAVIGATOR_TABBAR_ID, | | |||
1865 | d->navDockWidget, !visible); | | |||
1866 | } | 1899 | } | ||
1867 | 1900 | | |||
1868 | void KexiMainWindow::slotPropertyEditorVisibilityChanged(bool visible) | 1901 | //void KexiMainWindow::slotSetProjectNavigatorVisible(bool set) | ||
1869 | { | 1902 | //{ | ||
1870 | if (!d->enable_slotPropertyEditorVisibilityChanged) | 1903 | // if (d->navDockWidget) | ||
1871 | return; | 1904 | // d->navDockWidget->setVisible(set); | ||
1872 | d->setPropertyEditorTabBarVisible(!visible); | 1905 | //} | ||
1873 | if (!visible) | 1906 | | ||
1874 | d->propertyEditorCollapsed = true; | 1907 | //void KexiMainWindow::slotSetPropertyEditorVisible(bool set) | ||
1875 | } | 1908 | //{ | ||
1909 | // if (d->propEditorDockWidget) | ||||
1910 | // d->propEditorDockWidget->setVisible(set); | ||||
1911 | //} | ||||
1912 | | ||||
1913 | //void KexiMainWindow::slotProjectNavigatorVisibilityChanged(bool visible) | ||||
1914 | //{ | ||||
1915 | // d->setTabBarVisible(KMultiTabBar::Left, PROJECT_NAVIGATOR_TABBAR_ID, | ||||
1916 | // d->navDockWidget, !visible); | ||||
1917 | //} | ||||
1918 | | ||||
1919 | //void KexiMainWindow::slotPropertyEditorVisibilityChanged(bool visible) | ||||
1920 | //{ | ||||
1921 | // if (!d->enable_slotPropertyEditorVisibilityChanged) | ||||
1922 | // return; | ||||
1923 | // d->setPropertyEditorTabBarVisible(!visible); | ||||
1924 | // if (!visible) | ||||
1925 | // d->propertyEditorCollapsed = true; | ||||
1926 | //} | ||||
1876 | 1927 | | |||
1928 | /* | ||||
1877 | void KexiMainWindow::slotMultiTabBarTabClicked(int id) | 1929 | void KexiMainWindow::slotMultiTabBarTabClicked(int id) | ||
1878 | { | 1930 | { | ||
1879 | if (id == PROJECT_NAVIGATOR_TABBAR_ID) { | 1931 | if (id == PROJECT_NAVIGATOR_TABBAR_ID) { | ||
1880 | slotProjectNavigatorVisibilityChanged(true); | 1932 | slotProjectNavigatorVisibilityChanged(true); | ||
1881 | d->navDockWidget->show(); | 1933 | d->navDockWidget->show(); | ||
1882 | } | 1934 | } | ||
1883 | else if (id == PROPERTY_EDITOR_TABBAR_ID) { | 1935 | else if (id == PROPERTY_EDITOR_TABBAR_ID) { | ||
1884 | slotPropertyEditorVisibilityChanged(true); | 1936 | slotPropertyEditorVisibilityChanged(true); | ||
1885 | d->propEditorDockWidget->show(); | 1937 | d->propEditorDockWidget->show(); | ||
1886 | d->propertyEditorCollapsed = false; | 1938 | d->propertyEditorCollapsed = false; | ||
1887 | } | 1939 | } | ||
1888 | } | 1940 | } | ||
1889 | 1941 | | |||
1890 | static Qt::DockWidgetArea applyRightToLeftToDockArea(Qt::DockWidgetArea area) | 1942 | static Qt::DockWidgetArea applyRightToLeftToDockArea(Qt::DockWidgetArea area) | ||
1891 | { | 1943 | { | ||
1892 | if (QApplication::layoutDirection() == Qt::RightToLeft) { | 1944 | if (QApplication::layoutDirection() == Qt::RightToLeft) { | ||
1893 | if (area == Qt::LeftDockWidgetArea) { | 1945 | if (area == Qt::LeftDockWidgetArea) { | ||
1894 | return Qt::RightDockWidgetArea; | 1946 | return Qt::RightDockWidgetArea; | ||
1895 | } | 1947 | } | ||
1896 | else if (area == Qt::RightDockWidgetArea) { | 1948 | else if (area == Qt::RightDockWidgetArea) { | ||
1897 | return Qt::LeftDockWidgetArea; | 1949 | return Qt::LeftDockWidgetArea; | ||
1898 | } | 1950 | } | ||
1899 | } | 1951 | } | ||
1900 | return area; | 1952 | return area; | ||
1901 | } | 1953 | }*/ | ||
1902 | 1954 | | |||
1903 | void KexiMainWindow::setupProjectNavigator() | 1955 | void KexiMainWindow::setupObjectView() | ||
1904 | { | 1956 | { | ||
1905 | if (!d->isProjectNavigatorVisible) | 1957 | if (d->objectViewWidget) { | ||
1906 | return; | 1958 | return; | ||
1959 | } | ||||
1960 | KexiObjectViewWidget::Flags flags; | ||||
1961 | if (d->isProjectNavigatorVisible) { | ||||
1962 | flags |= KexiObjectViewWidget::ProjectNavigatorEnabled; | ||||
1963 | } | ||||
1964 | if (!d->userMode) { | ||||
1965 | flags |= KexiObjectViewWidget::PropertyPaneEnabled; | ||||
1966 | } | ||||
1967 | d->objectViewWidget = new KexiObjectViewWidget(flags); | ||||
1968 | connect(d->objectViewWidget, &KexiObjectViewWidget::activeWindowChanged, | ||||
1969 | this, &KexiMainWindow::activeWindowChanged); | ||||
1970 | connect(d->objectViewWidget, &KexiObjectViewWidget::closeWindowRequested, | ||||
1971 | this, &KexiMainWindow::closeWindowForTab); | ||||
1972 | connect(d->objectViewWidget, &KexiObjectViewWidget::closeAllWindowsRequested, | ||||
1973 | this, &KexiMainWindow::closeAllWindows); | ||||
1974 | connect(d->objectViewWidget, &KexiObjectViewWidget::projectNavigatorAnimationFinished, | ||||
1975 | this, &KexiMainWindow::slotProjectNavigatorVisibilityChanged); | ||||
1976 | slotProjectNavigatorVisibilityChanged(d->objectViewWidget->projectNavigator()); | ||||
1907 | 1977 | | |||
1908 | if (d->navigator) { | 1978 | // Restore settings | ||
1909 | d->navDockWidget->show(); | 1979 | //! @todo FIX LAYOUT PROBLEMS | ||
1980 | KConfigGroup propertyEditorGroup(d->config->group("PropertyEditor")); | ||||
1981 | QFont f(KexiStyle::propertyPane().font()); | ||||
1982 | const qreal pointSizeF = propertyEditorGroup.readEntry("FontPointSize", -1.0f); // points are more accurate | ||||
1983 | if (pointSizeF > 0.0) { | ||||
1984 | f.setPointSizeF(pointSizeF); | ||||
1985 | } else { | ||||
1986 | const int pixelSize = propertyEditorGroup.readEntry("FontSize", -1); // compatibility with Kexi 2.x | ||||
1987 | if (pixelSize > 0) { | ||||
1988 | f.setPixelSize(pixelSize); | ||||
1910 | } | 1989 | } | ||
1911 | else { | 1990 | } | ||
1912 | KexiDockableWidget* navDockableWidget = new KexiDockableWidget; | 1991 | if (d->objectViewWidget->propertyPane()) { | ||
1913 | d->navigator = new KexiProjectNavigator(navDockableWidget); | 1992 | d->objectViewWidget->propertyPane()->setFont(f); | ||
1914 | kexiTester() << KexiTestObject(d->navigator, "KexiProjectNavigator"); | | |||
1915 | | ||||
1916 | navDockableWidget->setWidget(d->navigator); | | |||
1917 | | ||||
1918 | d->navDockWidget = new KexiDockWidget(d->navigator->windowTitle(), d->mainWidget); | | |||
1919 | d->navDockWidget->setObjectName("ProjectNavigatorDockWidget"); | | |||
1920 | d->mainWidget->addDockWidget( | | |||
1921 | applyRightToLeftToDockArea(Qt::LeftDockWidgetArea), d->navDockWidget, | | |||
1922 | Qt::Vertical); | | |||
1923 | navDockableWidget->setParent(d->navDockWidget); | | |||
1924 | d->navDockWidget->setWidget(navDockableWidget); | | |||
1925 | 1993 | | |||
1926 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | 1994 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | ||
1927 | const QSize projectNavigatorSize = mainWindowGroup.readEntry<QSize>("ProjectNavigatorSize", QSize()); | 1995 | const QSize projectNavigatorSize = mainWindowGroup.readEntry<QSize>("ProjectNavigatorSize", QSize()); | ||
1928 | if (!projectNavigatorSize.isNull()) { | 1996 | const QSize propertyEditorSize = mainWindowGroup.readEntry<QSize>("PropertyEditorSize", QSize()); | ||
1929 | navDockableWidget->setSizeHint(projectNavigatorSize); | 1997 | d->objectViewWidget->setSidebarWidths(projectNavigatorSize.isValid() ? projectNavigatorSize.width() : -1, | ||
1998 | propertyEditorSize.isValid() ? propertyEditorSize.width() : -1); | ||||
1930 | } | 1999 | } | ||
1931 | 2000 | | |||
1932 | connect(d->navDockWidget, SIGNAL(visibilityChanged(bool)), | 2001 | d->globalViewStack->addWidget(d->objectViewWidget); | ||
1933 | this, SLOT(slotProjectNavigatorVisibilityChanged(bool))); | 2002 | KexiProjectNavigator* navigator = d->objectViewWidget->projectNavigator(); | ||
2003 | if (navigator) { | ||||
2004 | //connect(d->navDockWidget, SIGNAL(visibilityChanged(bool)), | ||||
2005 | // this, SLOT(slotProjectNavigatorVisibilityChanged(bool))); | ||||
1934 | 2006 | | |||
1935 | //Nav2 Signals | 2007 | //Nav2 Signals | ||
1936 | connect(d->navigator, SIGNAL(openItem(KexiPart::Item*,Kexi::ViewMode)), | 2008 | connect(navigator, SIGNAL(openItem(KexiPart::Item*,Kexi::ViewMode)), | ||
1937 | this, SLOT(openObject(KexiPart::Item*,Kexi::ViewMode))); | 2009 | this, SLOT(openObject(KexiPart::Item*,Kexi::ViewMode))); | ||
1938 | connect(d->navigator, SIGNAL(openOrActivateItem(KexiPart::Item*,Kexi::ViewMode)), | 2010 | connect(navigator, SIGNAL(openOrActivateItem(KexiPart::Item*,Kexi::ViewMode)), | ||
1939 | this, SLOT(openObjectFromNavigator(KexiPart::Item*,Kexi::ViewMode))); | 2011 | this, SLOT(openObjectFromNavigator(KexiPart::Item*,Kexi::ViewMode))); | ||
1940 | connect(d->navigator, SIGNAL(newItem(KexiPart::Info*)), | 2012 | connect(navigator, SIGNAL(newItem(KexiPart::Info*)), | ||
1941 | this, SLOT(newObject(KexiPart::Info*))); | 2013 | this, SLOT(newObject(KexiPart::Info*))); | ||
1942 | connect(d->navigator, SIGNAL(removeItem(KexiPart::Item*)), | 2014 | connect(navigator, SIGNAL(removeItem(KexiPart::Item*)), | ||
1943 | this, SLOT(removeObject(KexiPart::Item*))); | 2015 | this, SLOT(removeObject(KexiPart::Item*))); | ||
1944 | connect(d->navigator->model(), SIGNAL(renameItem(KexiPart::Item*,QString,bool*)), | 2016 | connect(navigator->model(), SIGNAL(renameItem(KexiPart::Item*,QString,bool*)), | ||
1945 | this, SLOT(renameObject(KexiPart::Item*,QString,bool*))); | 2017 | this, SLOT(renameObject(KexiPart::Item*,QString,bool*))); | ||
1946 | connect(d->navigator->model(), SIGNAL(changeItemCaption(KexiPart::Item*,QString,bool*)), | 2018 | connect(navigator->model(), SIGNAL(changeItemCaption(KexiPart::Item*,QString,bool*)), | ||
1947 | this, SLOT(setObjectCaption(KexiPart::Item*,QString,bool*))); | 2019 | this, SLOT(setObjectCaption(KexiPart::Item*,QString,bool*))); | ||
1948 | connect(d->navigator, SIGNAL(executeItem(KexiPart::Item*)), | 2020 | connect(navigator, SIGNAL(executeItem(KexiPart::Item*)), | ||
1949 | this, SLOT(executeItem(KexiPart::Item*))); | 2021 | this, SLOT(executeItem(KexiPart::Item*))); | ||
1950 | connect(d->navigator, SIGNAL(exportItemToClipboardAsDataTable(KexiPart::Item*)), | 2022 | connect(navigator, SIGNAL(exportItemToClipboardAsDataTable(KexiPart::Item*)), | ||
1951 | this, SLOT(copyItemToClipboardAsDataTable(KexiPart::Item*))); | 2023 | this, SLOT(copyItemToClipboardAsDataTable(KexiPart::Item*))); | ||
1952 | connect(d->navigator, SIGNAL(exportItemToFileAsDataTable(KexiPart::Item*)), | 2024 | connect(navigator, SIGNAL(exportItemToFileAsDataTable(KexiPart::Item*)), | ||
1953 | this, SLOT(exportItemAsDataTable(KexiPart::Item*))); | 2025 | this, SLOT(exportItemAsDataTable(KexiPart::Item*))); | ||
1954 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | 2026 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | ||
1955 | connect(d->navigator, SIGNAL(printItem(KexiPart::Item*)), | 2027 | connect(navigator, SIGNAL(printItem(KexiPart::Item*)), | ||
1956 | this, SLOT(printItem(KexiPart::Item*))); | 2028 | this, SLOT(printItem(KexiPart::Item*))); | ||
1957 | connect(d->navigator, SIGNAL(pageSetupForItem(KexiPart::Item*)), | 2029 | connect(navigator, SIGNAL(pageSetupForItem(KexiPart::Item*)), | ||
1958 | this, SLOT(showPageSetupForItem(KexiPart::Item*))); | 2030 | this, SLOT(showPageSetupForItem(KexiPart::Item*))); | ||
1959 | #endif | 2031 | #endif | ||
1960 | connect(d->navigator, SIGNAL(selectionChanged(KexiPart::Item*)), | 2032 | connect(navigator, SIGNAL(selectionChanged(KexiPart::Item*)), | ||
1961 | this, SLOT(slotPartItemSelectedInNavigator(KexiPart::Item*))); | 2033 | this, SLOT(slotPartItemSelectedInNavigator(KexiPart::Item*))); | ||
1962 | } | 2034 | } | ||
1963 | if (d->prj->isConnected()) { | | |||
1964 | QString partManagerErrorMessages; | | |||
1965 | | ||||
1966 | if (!partManagerErrorMessages.isEmpty()) { | | |||
1967 | showWarningContinueMessage(partManagerErrorMessages, QString(), | | |||
1968 | "ShowWarningsRelatedToPluginsLoading"); | | |||
1969 | } | | |||
1970 | d->navigator->setProject(d->prj, QString()/*all classes*/, &partManagerErrorMessages); | | |||
1971 | 2035 | | |||
1972 | } | 2036 | if (navigator) { | ||
1973 | connect(d->prj, SIGNAL(newItemStored(KexiPart::Item*)), d->navigator->model(), SLOT(slotAddItem(KexiPart::Item*))); | 2037 | connect(d->prj, SIGNAL(newItemStored(KexiPart::Item*)), | ||
1974 | connect(d->prj, SIGNAL(itemRemoved(KexiPart::Item)), d->navigator->model(), SLOT(slotRemoveItem(KexiPart::Item))); | 2038 | navigator->model(), SLOT(slotAddItem(KexiPart::Item*))); | ||
1975 | 2039 | connect(d->prj, SIGNAL(itemRemoved(KexiPart::Item)), | |||
1976 | d->navigator->setFocus(); | 2040 | navigator->model(), SLOT(slotRemoveItem(KexiPart::Item))); | ||
2041 | navigator->setFocus(); | ||||
1977 | 2042 | | |||
1978 | if (d->forceShowProjectNavigatorOnCreation) { | 2043 | /*if (d->forceShowProjectNavigatorOnCreation) { | ||
1979 | slotShowNavigator(); | 2044 | slotShowNavigator(); | ||
1980 | d->forceShowProjectNavigatorOnCreation = false; | 2045 | d->forceShowProjectNavigatorOnCreation = false; | ||
1981 | } else if (d->forceHideProjectNavigatorOnCreation) { | 2046 | } else if (d->forceHideProjectNavigatorOnCreation) { | ||
1982 | d->forceHideProjectNavigatorOnCreation = false; | 2047 | d->forceHideProjectNavigatorOnCreation = false; | ||
2048 | }*/ | ||||
1983 | } | 2049 | } | ||
1984 | 2050 | | |||
1985 | invalidateActions(); | 2051 | invalidateActions(); | ||
1986 | } | 2052 | } | ||
1987 | 2053 | | |||
1988 | void KexiMainWindow::slotLastActions() | 2054 | void KexiMainWindow::updateObjectView() | ||
1989 | { | 2055 | { | ||
1990 | } | 2056 | setupObjectView(); | ||
1991 | | ||||
1992 | void KexiMainWindow::setupPropertyEditor() | | |||
1993 | { | | |||
1994 | if (!d->propEditor) { | | |||
1995 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | | |||
1996 | //! @todo FIX LAYOUT PROBLEMS | | |||
1997 | d->propEditorDockWidget = new KexiDockWidget(xi18n("Property Editor"), d->mainWidget); | | |||
1998 | d->propEditorDockWidget->setObjectName("PropertyEditorDockWidget"); | | |||
1999 | d->mainWidget->addDockWidget( | | |||
2000 | applyRightToLeftToDockArea(Qt::RightDockWidgetArea), d->propEditorDockWidget, | | |||
2001 | Qt::Vertical | | |||
2002 | ); | | |||
2003 | connect(d->propEditorDockWidget, SIGNAL(visibilityChanged(bool)), | | |||
2004 | this, SLOT(slotPropertyEditorVisibilityChanged(bool))); | | |||
2005 | | ||||
2006 | d->propEditorDockableWidget = new KexiDockableWidget(d->propEditorDockWidget); | | |||
2007 | d->propEditorDockWidget->setWidget(d->propEditorDockableWidget); | | |||
2008 | const QSize propertyEditorSize = mainWindowGroup.readEntry<QSize>("PropertyEditorSize", QSize()); | | |||
2009 | if (!propertyEditorSize.isNull()) { | | |||
2010 | d->propEditorDockableWidget->setSizeHint(propertyEditorSize); | | |||
2011 | } | | |||
2012 | | ||||
2013 | QWidget *propEditorDockWidgetContents = new QWidget(d->propEditorDockableWidget); | | |||
2014 | d->propEditorDockableWidget->setWidget(propEditorDockWidgetContents); | | |||
2015 | QVBoxLayout *propEditorDockWidgetContentsLyr = new QVBoxLayout(propEditorDockWidgetContents); | | |||
2016 | propEditorDockWidgetContentsLyr->setContentsMargins(0, 0, 0, 0); | | |||
2017 | | ||||
2018 | d->propEditorTabWidget = new QTabWidget(propEditorDockWidgetContents); | | |||
2019 | d->propEditorTabWidget->setDocumentMode(true); | | |||
2020 | propEditorDockWidgetContentsLyr->addWidget(d->propEditorTabWidget); | | |||
2021 | d->propEditor = new KexiPropertyEditorView(d->propEditorTabWidget); | | |||
2022 | d->propEditorTabWidget->setWindowTitle(d->propEditor->windowTitle()); | | |||
2023 | d->propEditorTabWidget->addTab(d->propEditor, xi18n("Properties")); | | |||
2024 | //! @todo REMOVE? d->propEditor->installEventFilter(this); | | |||
2025 | 2057 | | |||
2026 | KConfigGroup propertyEditorGroup(d->config->group("PropertyEditor")); | 2058 | if (d->prj && d->prj->isConnected()) { | ||
2027 | QFont f(KexiUtils::smallestReadableFont()); | 2059 | KexiProjectNavigator* navigator = d->objectViewWidget->projectNavigator(); | ||
2028 | const qreal pointSizeF = propertyEditorGroup.readEntry("FontPointSize", -1.0f); // points are more accurate | 2060 | if (navigator && !navigator->model()->project()) { | ||
2029 | if (pointSizeF > 0.0) { | 2061 | QString partManagerErrorMessages; | ||
2030 | f.setPointSizeF(pointSizeF); | 2062 | navigator->setProject(d->prj, QString()/*all classes*/, &partManagerErrorMessages); | ||
2063 | if (partManagerErrorMessages.isEmpty()) { | ||||
2064 | d->setProjectNavigatorVisible(true); | ||||
2031 | } else { | 2065 | } else { | ||
2032 | const int pixelSize = propertyEditorGroup.readEntry("FontSize", -1); // compatibility with KEXI 2.x | 2066 | showWarningContinueMessage(partManagerErrorMessages, QString(), | ||
2033 | if (pixelSize > 0) { | 2067 | "ShowWarningsRelatedToPluginsLoading"); | ||
2034 | f.setPixelSize(pixelSize); | 2068 | } | ||
2035 | } | 2069 | } | ||
2036 | } | 2070 | } | ||
2037 | d->propEditorTabWidget->setFont(f); | | |||
2038 | | ||||
2039 | d->enable_slotPropertyEditorVisibilityChanged = false; | | |||
2040 | d->propEditorDockWidget->setVisible(false); | | |||
2041 | d->enable_slotPropertyEditorVisibilityChanged = true; | | |||
2042 | } | 2071 | } | ||
2072 | | ||||
2073 | void KexiMainWindow::slotLastActions() | ||||
2074 | { | ||||
2043 | } | 2075 | } | ||
2044 | 2076 | | |||
2045 | void KexiMainWindow::slotPartLoaded(KexiPart::Part* p) | 2077 | void KexiMainWindow::slotPartLoaded(KexiPart::Part* p) | ||
2046 | { | 2078 | { | ||
2047 | if (!p) | 2079 | if (!p) | ||
2048 | return; | 2080 | return; | ||
2049 | p->createGUIClients(); | 2081 | p->createGUIClients(); | ||
2050 | } | 2082 | } | ||
Show All 36 Lines | 2118 | if (! ~res) { | |||
2087 | Kexi::deleteGlobalObjects(); | 2119 | Kexi::deleteGlobalObjects(); | ||
2088 | qApp->quit(); | 2120 | qApp->quit(); | ||
2089 | } | 2121 | } | ||
2090 | return ! ~res; | 2122 | return ! ~res; | ||
2091 | } | 2123 | } | ||
2092 | 2124 | | |||
2093 | void KexiMainWindow::closeEvent(QCloseEvent *ev) | 2125 | void KexiMainWindow::closeEvent(QCloseEvent *ev) | ||
2094 | { | 2126 | { | ||
2095 | d->mainWidget->closeEvent(ev); | 2127 | if (queryClose()) { | ||
2128 | ev->accept(); | ||||
2129 | } else { | ||||
2130 | ev->ignore(); | ||||
2131 | } | ||||
2132 | } | ||||
2133 | | ||||
2134 | void KexiMainWindow::resizeEvent(QResizeEvent *e) | ||||
2135 | { | ||||
2136 | QMainWindow::resizeEvent(e); | ||||
2137 | //qDebug() << "===" << e->size() << size() << isVisible(); | ||||
2096 | } | 2138 | } | ||
2097 | 2139 | | |||
2098 | static const QSize KEXI_MIN_WINDOW_SIZE(1024, 768); | 2140 | static const QSize KEXI_MIN_WINDOW_SIZE(1024, 768); | ||
2099 | 2141 | | |||
2100 | void | 2142 | void | ||
2101 | KexiMainWindow::restoreSettings() | 2143 | KexiMainWindow::restoreSettings() | ||
2102 | { | 2144 | { | ||
2103 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | 2145 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | ||
Show All 9 Lines | 2152 | else { | |||
2113 | if (desk.width() <= KEXI_MIN_WINDOW_SIZE.width() | 2155 | if (desk.width() <= KEXI_MIN_WINDOW_SIZE.width() | ||
2114 | || desk.height() <= KEXI_MIN_WINDOW_SIZE.height()) | 2156 | || desk.height() <= KEXI_MIN_WINDOW_SIZE.height()) | ||
2115 | { | 2157 | { | ||
2116 | setWindowState(windowState() | Qt::WindowMaximized); | 2158 | setWindowState(windowState() | Qt::WindowMaximized); | ||
2117 | } else { | 2159 | } else { | ||
2118 | resize(KEXI_MIN_WINDOW_SIZE); | 2160 | resize(KEXI_MIN_WINDOW_SIZE); | ||
2119 | } | 2161 | } | ||
2120 | } | 2162 | } | ||
2121 | // Saved settings | | |||
2122 | } | 2163 | } | ||
2123 | 2164 | | |||
2124 | void | 2165 | void | ||
2125 | KexiMainWindow::storeSettings() | 2166 | KexiMainWindow::storeSettings() | ||
2126 | { | 2167 | { | ||
2127 | //qDebug(); | 2168 | //qDebug(); | ||
2128 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | 2169 | KConfigGroup mainWindowGroup(d->config->group("MainWindow")); | ||
2129 | 2170 | | |||
2130 | if (isMaximized()) { | 2171 | if (isMaximized()) { | ||
2131 | mainWindowGroup.writeEntry("Maximized", true); | 2172 | mainWindowGroup.writeEntry("Maximized", true); | ||
2132 | mainWindowGroup.deleteEntry("Geometry"); | 2173 | mainWindowGroup.deleteEntry("Geometry"); | ||
2133 | } else { | 2174 | } else { | ||
2134 | mainWindowGroup.deleteEntry("Maximized"); | 2175 | mainWindowGroup.deleteEntry("Maximized"); | ||
2135 | mainWindowGroup.writeEntry("Geometry", geometry()); | 2176 | mainWindowGroup.writeEntry("Geometry", geometry()); | ||
2136 | } | 2177 | } | ||
2137 | 2178 | | |||
2138 | if (d->navigator) | 2179 | if (d->objectViewWidget) { | ||
2139 | mainWindowGroup.writeEntry("ProjectNavigatorSize", d->navigator->parentWidget()->size()); | 2180 | int projectNavigatorWidth; | ||
2140 | 2181 | int propertyEditorWidth; | |||
2141 | if (d->propEditorDockableWidget) | 2182 | d->objectViewWidget->getSidebarWidths(&projectNavigatorWidth, &propertyEditorWidth); | ||
2142 | mainWindowGroup.writeEntry("PropertyEditorSize", d->propEditorDockableWidget->size()); | 2183 | if (projectNavigatorWidth > 0) { | ||
2143 | 2184 | mainWindowGroup.writeEntry("ProjectNavigatorSize", QSize(projectNavigatorWidth, 1)); | |||
2185 | } | ||||
2186 | if (propertyEditorWidth > 0) { | ||||
2187 | mainWindowGroup.writeEntry("PropertyEditorSize", QSize(propertyEditorWidth, 1)); | ||||
2188 | } | ||||
2189 | } | ||||
2144 | d->config->sync(); | 2190 | d->config->sync(); | ||
2145 | } | 2191 | } | ||
2146 | 2192 | | |||
2147 | void | 2193 | void | ||
2148 | KexiMainWindow::registerChild(KexiWindow *window) | 2194 | KexiMainWindow::registerChild(KexiWindow *window) | ||
2149 | { | 2195 | { | ||
2150 | //qDebug(); | 2196 | //qDebug(); | ||
2151 | connect(window, SIGNAL(dirtyChanged(KexiWindow*)), this, SLOT(slotDirtyFlagChanged(KexiWindow*))); | 2197 | connect(window, SIGNAL(dirtyChanged(KexiWindow*)), this, SLOT(slotDirtyFlagChanged(KexiWindow*))); | ||
Show All 14 Lines | 2208 | updateCustomPropertyPanelTabs( | |||
2166 | currentWindow() ? currentWindow()->currentViewMode() : Kexi::NoViewMode | 2212 | currentWindow() ? currentWindow()->currentViewMode() : Kexi::NoViewMode | ||
2167 | ); | 2213 | ); | ||
2168 | } | 2214 | } | ||
2169 | 2215 | | |||
2170 | void KexiMainWindow::updateCustomPropertyPanelTabs( | 2216 | void KexiMainWindow::updateCustomPropertyPanelTabs( | ||
2171 | KexiPart::Part *prevWindowPart, Kexi::ViewMode prevViewMode, | 2217 | KexiPart::Part *prevWindowPart, Kexi::ViewMode prevViewMode, | ||
2172 | KexiPart::Part *curWindowPart, Kexi::ViewMode curViewMode) | 2218 | KexiPart::Part *curWindowPart, Kexi::ViewMode curViewMode) | ||
2173 | { | 2219 | { | ||
2174 | if (!d->propEditorTabWidget) | 2220 | if (!d->objectViewWidget || !d->objectViewWidget->propertyPane()) | ||
2175 | return; | 2221 | return; | ||
2176 | 2222 | | |||
2177 | if ( !curWindowPart | 2223 | if ( !curWindowPart | ||
2178 | || (/*prevWindowPart &&*/ curWindowPart | 2224 | || (/*prevWindowPart &&*/ curWindowPart | ||
2179 | && (prevWindowPart != curWindowPart || prevViewMode != curViewMode) | 2225 | && (prevWindowPart != curWindowPart || prevViewMode != curViewMode) | ||
2180 | ) | 2226 | ) | ||
2181 | ) | 2227 | ) | ||
2182 | { | 2228 | { | ||
2229 | #warning TODO KexiMainWindow::updateCustomPropertyPanelTabs() | ||||
2230 | #if 0 | ||||
2183 | if (d->partForPreviouslySetupPropertyPanelTabs) { | 2231 | if (d->partForPreviouslySetupPropertyPanelTabs) { | ||
2184 | //remember current page number for this part | 2232 | //remember current page number for this part | ||
2185 | if (( prevViewMode == Kexi::DesignViewMode | 2233 | if (( prevViewMode == Kexi::DesignViewMode | ||
2186 | && static_cast<KexiPart::Part*>(d->partForPreviouslySetupPropertyPanelTabs) != curWindowPart) //part changed | 2234 | && static_cast<KexiPart::Part*>(d->partForPreviouslySetupPropertyPanelTabs) != curWindowPart) //part changed | ||
2187 | || curViewMode != Kexi::DesignViewMode) | 2235 | || curViewMode != Kexi::DesignViewMode) | ||
2188 | { //..or switching to other view mode | 2236 | { //..or switching to other view mode | ||
2189 | d->recentlySelectedPropertyPanelPages.insert( | 2237 | d->recentlySelectedPropertyPanelPages.insert( | ||
2190 | d->partForPreviouslySetupPropertyPanelTabs, | 2238 | d->partForPreviouslySetupPropertyPanelTabs, | ||
2191 | d->propEditorTabWidget->currentIndex()); | 2239 | d->objectViewWidget->propertyPane()->currentIndex()); | ||
2192 | } | 2240 | } | ||
2193 | } | 2241 | } | ||
2194 | 2242 | | |||
2195 | //delete old custom tabs (other than 'property' tab) | 2243 | //delete old custom tabs (other than 'property' tab) | ||
2196 | const int count = d->propEditorTabWidget->count(); | 2244 | const int count = d->objectViewWidget->propertyEditorTabWidget()->count(); | ||
2197 | for (int i = 1; i < count; i++) | 2245 | for (int i = 1; i < count; i++) | ||
2198 | d->propEditorTabWidget->removeTab(1); | 2246 | d->objectViewWidget->propertyEditorTabWidget()->removeTab(1); | ||
2247 | #endif | ||||
2199 | } | 2248 | } | ||
2200 | 2249 | | |||
2201 | //don't change anything if part is not switched nor view mode changed | 2250 | //don't change anything if part is not switched nor view mode changed | ||
2202 | if ((!prevWindowPart && !curWindowPart) | 2251 | if ((!prevWindowPart && !curWindowPart) | ||
2203 | || (prevWindowPart == curWindowPart && prevViewMode == curViewMode) | 2252 | || (prevWindowPart == curWindowPart && prevViewMode == curViewMode) | ||
2204 | || (curWindowPart && curViewMode != Kexi::DesignViewMode)) | 2253 | || (curWindowPart && curViewMode != Kexi::DesignViewMode)) | ||
2205 | { | 2254 | { | ||
2206 | //new part for 'previously setup tabs' | 2255 | //new part for 'previously setup tabs' | ||
2207 | d->partForPreviouslySetupPropertyPanelTabs = curWindowPart; | 2256 | d->partForPreviouslySetupPropertyPanelTabs = curWindowPart; | ||
2208 | return; | 2257 | return; | ||
2209 | } | 2258 | } | ||
2210 | 2259 | | |||
2211 | if (curWindowPart) { | 2260 | if (curWindowPart) { | ||
2212 | //recreate custom tabs | 2261 | //recreate custom tabs | ||
2213 | curWindowPart->setupCustomPropertyPanelTabs(d->propEditorTabWidget); | 2262 | d->objectViewWidget->propertyPane()->removeAllSections(); | ||
2263 | curWindowPart->setupPropertyPane(d->objectViewWidget->propertyPane()); | ||||
2214 | 2264 | | |||
2265 | #warning TODO KexiMainWindow::updateCustomPropertyPanelTabs() | ||||
2266 | #if 0 | ||||
2215 | //restore current page number for this part | 2267 | //restore current page number for this part | ||
2216 | if (d->recentlySelectedPropertyPanelPages.contains(curWindowPart)) { | 2268 | if (d->recentlySelectedPropertyPanelPages.contains(curWindowPart)) { | ||
2217 | d->propEditorTabWidget->setCurrentIndex( | 2269 | d->objectViewWidget->propertyEditorTabWidget()->setCurrentIndex( | ||
2218 | d->recentlySelectedPropertyPanelPages[ curWindowPart ] | 2270 | d->recentlySelectedPropertyPanelPages[ curWindowPart ] | ||
2219 | ); | 2271 | ); | ||
2220 | } | 2272 | } | ||
2273 | #endif | ||||
2221 | } | 2274 | } | ||
2222 | 2275 | //#endif | |||
2223 | //new part for 'previously setup tabs' | 2276 | //new part for 'previously setup tabs' | ||
2224 | d->partForPreviouslySetupPropertyPanelTabs = curWindowPart; | 2277 | d->partForPreviouslySetupPropertyPanelTabs = curWindowPart; | ||
2225 | } | 2278 | } | ||
2226 | 2279 | | |||
2227 | void KexiMainWindow::activeWindowChanged(KexiWindow *window, KexiWindow *prevWindow) | 2280 | void KexiMainWindow::activeWindowChanged(KexiWindow *window, KexiWindow *prevWindow) | ||
2228 | { | 2281 | { | ||
2229 | //qDebug() << "to=" << (window ? window->windowTitle() : "<none>"); | 2282 | //qDebug() << "to=" << (window ? window->windowTitle() : "<none>"); | ||
2230 | bool windowChanged = prevWindow != window; | 2283 | bool windowChanged = prevWindow != window; | ||
Show All 9 Lines | |||||
2240 | 2293 | | |||
2241 | // inform the current view of the new dialog about property switching | 2294 | // inform the current view of the new dialog about property switching | ||
2242 | // (this will also call KexiMainWindow::propertySetSwitched() to update the current property editor's set | 2295 | // (this will also call KexiMainWindow::propertySetSwitched() to update the current property editor's set | ||
2243 | if (windowChanged && currentWindow()) | 2296 | if (windowChanged && currentWindow()) | ||
2244 | currentWindow()->selectedView()->propertySetSwitched(); | 2297 | currentWindow()->selectedView()->propertySetSwitched(); | ||
2245 | 2298 | | |||
2246 | if (windowChanged) { | 2299 | if (windowChanged) { | ||
2247 | if (currentWindow() && currentWindow()->currentViewMode() != 0 && window) { | 2300 | if (currentWindow() && currentWindow()->currentViewMode() != 0 && window) { | ||
2301 | setCurrentMode(viewModeToGlobal(currentWindow()->currentViewMode())); | ||||
2302 | | ||||
2248 | //on opening new dialog it can be 0; we don't want this | 2303 | //on opening new dialog it can be 0; we don't want this | ||
2249 | d->updatePropEditorVisibility(currentWindow()->currentViewMode()); | 2304 | d->updatePropEditorVisibility(currentWindow()->currentViewMode()); | ||
2250 | 2305 | | |||
2251 | restoreDesignTabIfNeeded(window->partItem()->pluginId(), window->currentViewMode(), | 2306 | restoreDesignTabIfNeeded(window->partItem()->pluginId(), window->currentViewMode(), | ||
2252 | prevWindow ? prevWindow->partItem()->identifier() : 0); | 2307 | prevWindow ? prevWindow->partItem()->identifier() : 0); | ||
2253 | activateDesignTabIfNeeded(window->partItem()->pluginId(), | 2308 | activateDesignTabIfNeeded(window->partItem()->pluginId(), | ||
2254 | window->currentViewMode()); | 2309 | window->currentViewMode()); | ||
2255 | } | 2310 | } | ||
Show All 17 Lines | |||||
2273 | } | 2328 | } | ||
2274 | 2329 | | |||
2275 | bool | 2330 | bool | ||
2276 | KexiMainWindow::activateWindow(KexiWindow& window) | 2331 | KexiMainWindow::activateWindow(KexiWindow& window) | ||
2277 | { | 2332 | { | ||
2278 | //qDebug(); | 2333 | //qDebug(); | ||
2279 | 2334 | | |||
2280 | d->focus_before_popup = &window; | 2335 | d->focus_before_popup = &window; | ||
2281 | d->mainWidget->tabWidget()->setCurrentWidget(window.parentWidget()/*container*/); | 2336 | d->objectViewWidget->tabWidget()->setCurrentWidget(window.parentWidget()/*container*/); | ||
2282 | window.activate(); | 2337 | window.activate(); | ||
2283 | return true; | 2338 | return true; | ||
2284 | } | 2339 | } | ||
2285 | 2340 | | |||
2286 | void KexiMainWindow::activateNextWindow() | 2341 | void KexiMainWindow::activateNextWindow() | ||
2287 | { | 2342 | { | ||
2288 | // Case 1: go to next assistant page | 2343 | // Case 1: go to next assistant page | ||
2289 | KexiAssistantPage *page = d->visibleMainMenuWidgetPage(); | 2344 | KexiAssistantPage *page = d->visibleMainMenuWidgetPage(); | ||
Show All 14 Lines | 2357 | if (page) { | |||
2304 | return; | 2359 | return; | ||
2305 | } | 2360 | } | ||
2306 | // Case 2: go to previous tab | 2361 | // Case 2: go to previous tab | ||
2307 | activatePreviousTab(); | 2362 | activatePreviousTab(); | ||
2308 | } | 2363 | } | ||
2309 | 2364 | | |||
2310 | void KexiMainWindow::activateNextTab() | 2365 | void KexiMainWindow::activateNextTab() | ||
2311 | { | 2366 | { | ||
2312 | //! @todo | 2367 | int index = d->objectViewWidget->tabWidget()->currentIndex() + 1; | ||
2368 | if (index >= d->objectViewWidget->tabWidget()->count()) { | ||||
2369 | index = 0; | ||||
2370 | } | ||||
2371 | d->objectViewWidget->tabWidget()->setCurrentIndex(index); | ||||
2313 | } | 2372 | } | ||
2314 | 2373 | | |||
2315 | void KexiMainWindow::activatePreviousTab() | 2374 | void KexiMainWindow::activatePreviousTab() | ||
2316 | { | 2375 | { | ||
2317 | //! @todo | 2376 | int index = d->objectViewWidget->tabWidget()->currentIndex() - 1; | ||
2377 | if (index < 0) { | ||||
2378 | index = d->objectViewWidget->tabWidget()->count() - 1; | ||||
2379 | } | ||||
2380 | d->objectViewWidget->tabWidget()->setCurrentIndex(index); | ||||
2318 | } | 2381 | } | ||
2319 | 2382 | | |||
2320 | void | 2383 | void | ||
2321 | KexiMainWindow::slotSettings() | 2384 | KexiMainWindow::slotSettings() | ||
2322 | { | 2385 | { | ||
2323 | if (d->tabbedToolBar) { | 2386 | if (d->tabbedToolBar) { | ||
2324 | d->tabbedToolBar->showMainMenu("settings"); | 2387 | d->tabbedToolBar->showMainMenu("settings"); | ||
2325 | // dummy | 2388 | // dummy | ||
Show All 21 Lines | 2409 | { | |||
2347 | createNewProject(); | 2410 | createNewProject(); | ||
2348 | } | 2411 | } | ||
2349 | 2412 | | |||
2350 | KexiProject* KexiMainWindow::createKexiProjectObject(const KexiProjectData &data) | 2413 | KexiProject* KexiMainWindow::createKexiProjectObject(const KexiProjectData &data) | ||
2351 | { | 2414 | { | ||
2352 | KexiProject *prj = new KexiProject(data, this); | 2415 | KexiProject *prj = new KexiProject(data, this); | ||
2353 | connect(prj, SIGNAL(itemRenamed(KexiPart::Item,QString)), this, SLOT(slotObjectRenamed(KexiPart::Item,QString))); | 2416 | connect(prj, SIGNAL(itemRenamed(KexiPart::Item,QString)), this, SLOT(slotObjectRenamed(KexiPart::Item,QString))); | ||
2354 | 2417 | | |||
2355 | if (d->navigator){ | 2418 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()){ | ||
2356 | connect(prj, SIGNAL(itemRemoved(KexiPart::Item)), d->navigator->model(), SLOT(slotRemoveItem(KexiPart::Item))); | 2419 | connect(prj, SIGNAL(itemRemoved(KexiPart::Item)), | ||
2420 | d->objectViewWidget->projectNavigator()->model(), | ||||
2421 | SLOT(slotRemoveItem(KexiPart::Item))); | ||||
2357 | } | 2422 | } | ||
2358 | return prj; | 2423 | return prj; | ||
2359 | } | 2424 | } | ||
2360 | 2425 | | |||
2361 | void KexiMainWindow::createNewProject() | 2426 | void KexiMainWindow::createNewProject() | ||
2362 | { | 2427 | { | ||
2363 | if (!d->tabbedToolBar) | 2428 | if (!d->tabbedToolBar) | ||
2364 | return; | 2429 | return; | ||
Show All 23 Lines | 2452 | if (d->tabbedToolBar) { | |||
2388 | d->tabbedToolBar->hideMainMenu(); | 2453 | d->tabbedToolBar->hideMainMenu(); | ||
2389 | } | 2454 | } | ||
2390 | return res; | 2455 | return res; | ||
2391 | } | 2456 | } | ||
2392 | if (d->tabbedToolBar) { | 2457 | if (d->tabbedToolBar) { | ||
2393 | d->tabbedToolBar->hideMainMenu(); | 2458 | d->tabbedToolBar->hideMainMenu(); | ||
2394 | } | 2459 | } | ||
2395 | d->prj = prj.take(); | 2460 | d->prj = prj.take(); | ||
2396 | setupProjectNavigator(); | | |||
2397 | d->prj->data()->setLastOpened(QDateTime::currentDateTime()); | 2461 | d->prj->data()->setLastOpened(QDateTime::currentDateTime()); | ||
2398 | Kexi::recentProjects()->addProjectData(*d->prj->data()); | 2462 | Kexi::recentProjects()->addProjectData(*d->prj->data()); | ||
2463 | d->modeSelector->setCurrentMode(Kexi::EditGlobalMode); | ||||
2399 | 2464 | | |||
2400 | invalidateActions(); | 2465 | invalidateActions(); | ||
2401 | updateAppCaption(); | 2466 | updateAppCaption(); | ||
2402 | return true; | 2467 | return true; | ||
2403 | } | 2468 | } | ||
2404 | 2469 | | |||
2405 | void KexiMainWindow::slotProjectOpen() | 2470 | void KexiMainWindow::slotProjectOpen() | ||
2406 | { | 2471 | { | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 2525 | //! @todo caption arg? | |||
2462 | deleteAfterOpen = true; | 2527 | deleteAfterOpen = true; | ||
2463 | } | 2528 | } | ||
2464 | } else { | 2529 | } else { | ||
2465 | if (aFileName.isEmpty()) { | 2530 | if (aFileName.isEmpty()) { | ||
2466 | qWarning() << "aFileName.isEmpty()"; | 2531 | qWarning() << "aFileName.isEmpty()"; | ||
2467 | return false; | 2532 | return false; | ||
2468 | } | 2533 | } | ||
2469 | //file-based project | 2534 | //file-based project | ||
2470 | qDebug() << "Project File: " << aFileName; | 2535 | //qDebug() << "Project File:" << aFileName; | ||
2471 | KDbConnectionData fileConnData; | 2536 | KDbConnectionData fileConnData; | ||
2472 | fileConnData.setDatabaseName(aFileName); | 2537 | fileConnData.setDatabaseName(aFileName); | ||
2473 | QString detectedDriverId; | 2538 | QString detectedDriverId; | ||
2474 | int detectOptions = 0; | 2539 | int detectOptions = 0; | ||
2475 | if (readOnly) { | 2540 | if (readOnly) { | ||
2476 | detectOptions |= KexiStartupHandler::OpenReadOnly; | 2541 | detectOptions |= KexiStartupHandler::OpenReadOnly; | ||
2477 | } | 2542 | } | ||
2478 | KexiStartupData::Import importActionData; | 2543 | KexiStartupData::Import importActionData; | ||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 2724 | { | |||
2660 | closeProject(); | 2725 | closeProject(); | ||
2661 | } | 2726 | } | ||
2662 | 2727 | | |||
2663 | void KexiMainWindow::slotProjectRelations() | 2728 | void KexiMainWindow::slotProjectRelations() | ||
2664 | { | 2729 | { | ||
2665 | if (!d->prj) | 2730 | if (!d->prj) | ||
2666 | return; | 2731 | return; | ||
2667 | KexiWindow *w = KexiInternalPart::createKexiWindowInstance("org.kexi-project.relations", this); | 2732 | KexiWindow *w = KexiInternalPart::createKexiWindowInstance("org.kexi-project.relations", this); | ||
2733 | if (w) { | ||||
2668 | activateWindow(*w); | 2734 | activateWindow(*w); | ||
2669 | } | 2735 | } | ||
2736 | } | ||||
2670 | 2737 | | |||
2671 | void KexiMainWindow::slotImportFile() | 2738 | void KexiMainWindow::slotImportFile() | ||
2672 | { | 2739 | { | ||
2673 | KEXI_UNFINISHED("Import: " + xi18n("From File...")); | 2740 | KEXI_UNFINISHED("Import: " + xi18n("From File...")); | ||
2674 | } | 2741 | } | ||
2675 | 2742 | | |||
2676 | void KexiMainWindow::slotImportServer() | 2743 | void KexiMainWindow::slotImportServer() | ||
2677 | { | 2744 | { | ||
2678 | KEXI_UNFINISHED("Import: " + xi18n("From Server...")); | 2745 | KEXI_UNFINISHED("Import: " + xi18n("From Server...")); | ||
2679 | } | 2746 | } | ||
2680 | 2747 | | |||
2681 | void | 2748 | void | ||
2682 | KexiMainWindow::slotProjectQuit() | 2749 | KexiMainWindow::slotProjectQuit() | ||
2683 | { | 2750 | { | ||
2684 | if (~ closeProject()) | 2751 | if (~ closeProject()) | ||
2685 | return; | 2752 | return; | ||
2686 | close(); | 2753 | close(); | ||
2687 | } | 2754 | } | ||
2688 | 2755 | | |||
2689 | void KexiMainWindow::slotActivateNavigator() | 2756 | void KexiMainWindow::slotActivateNavigator() | ||
2690 | { | 2757 | { | ||
2691 | if (!d->navigator) { | 2758 | if (!d->objectViewWidget || !d->objectViewWidget->projectNavigator()) { | ||
2692 | return; | 2759 | return; | ||
2693 | } | 2760 | } | ||
2694 | d->navigator->setFocus(); | 2761 | d->objectViewWidget->projectNavigator()->setFocus(); | ||
2695 | } | 2762 | } | ||
2696 | 2763 | | |||
2697 | void KexiMainWindow::slotActivateMainArea() | 2764 | void KexiMainWindow::slotActivateMainArea() | ||
2698 | { | 2765 | { | ||
2699 | if (currentWindow()) | 2766 | if (currentWindow()) | ||
2700 | currentWindow()->setFocus(); | 2767 | currentWindow()->setFocus(); | ||
2701 | } | 2768 | } | ||
2702 | 2769 | | |||
2703 | void KexiMainWindow::slotActivatePropertyEditor() | 2770 | void KexiMainWindow::slotActivatePropertyPane() | ||
2704 | { | 2771 | { | ||
2705 | if (!d->propEditor) { | 2772 | if (!d->objectViewWidget || !d->objectViewWidget->propertyPane()) { | ||
2706 | return; | 2773 | return; | ||
2707 | } | 2774 | } | ||
2708 | 2775 | | |||
2709 | if (d->propEditorTabWidget->currentWidget()) | 2776 | d->objectViewWidget->propertyPane()->setFocus(); | ||
2710 | d->propEditorTabWidget->currentWidget()->setFocus(); | 2777 | // if (d->objectViewWidget->propertyPane()->currentWidget()) { | ||
2778 | // d->objectViewWidget->propertyPane()->currentWidget()->setFocus(); | ||||
2779 | // } | ||||
2711 | } | 2780 | } | ||
2712 | 2781 | | |||
2713 | void KexiMainWindow::slotShowNavigator() | 2782 | void KexiMainWindow::slotToggleProjectNavigator() | ||
2714 | { | 2783 | { | ||
2715 | if (d->navDockWidget) | 2784 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
2716 | d->navDockWidget->setVisible(!d->navDockWidget->isVisible()); | 2785 | d->setProjectNavigatorVisible(!d->objectViewWidget->projectNavigator()->isVisible(), Private::ShowAnimated); | ||
2786 | } | ||||
2717 | } | 2787 | } | ||
2718 | 2788 | | |||
2719 | void KexiMainWindow::slotShowPropertyEditor() | 2789 | void KexiMainWindow::slotTogglePropertyEditor() | ||
2720 | { | 2790 | { | ||
2721 | if (d->propEditorDockWidget) | 2791 | if (d->objectViewWidget && d->objectViewWidget->propertyPane()) { | ||
2722 | d->propEditorDockWidget->setVisible(!d->propEditorDockWidget->isVisible()); | 2792 | d->objectViewWidget->setPropertyPaneVisible(!d->objectViewWidget->propertyPane()->isVisible()); | ||
2793 | } | ||||
2723 | } | 2794 | } | ||
2724 | 2795 | | |||
2725 | tristate KexiMainWindow::switchToViewMode(KexiWindow& window, Kexi::ViewMode viewMode) | 2796 | tristate KexiMainWindow::switchToViewMode(KexiWindow& window, Kexi::ViewMode viewMode) | ||
2726 | { | 2797 | { | ||
2727 | const Kexi::ViewMode prevViewMode = currentWindow()->currentViewMode(); | 2798 | const Kexi::ViewMode prevViewMode = currentWindow()->currentViewMode(); | ||
2728 | if (prevViewMode == viewMode) | 2799 | if (prevViewMode == viewMode) | ||
2729 | return true; | 2800 | return true; | ||
2730 | if (!activateWindow(window)) | 2801 | if (!activateWindow(window)) | ||
2731 | return false; | 2802 | return false; | ||
2732 | if (!currentWindow()) { | 2803 | if (!currentWindow()) { | ||
2733 | return false; | 2804 | return false; | ||
2734 | } | 2805 | } | ||
2735 | if (&window != currentWindow()) | 2806 | if (&window != currentWindow()) | ||
2736 | return false; | 2807 | return false; | ||
2737 | if (!currentWindow()->supportsViewMode(viewMode)) { | 2808 | if (!currentWindow()->supportsViewMode(viewMode)) { | ||
2738 | showErrorMessage(xi18nc("@info", | 2809 | showErrorMessage(xi18nc("@info", | ||
2739 | "Selected view is not supported for <resource>%1</resource> object.", | 2810 | "Selected view is not supported for <resource>%1</resource> object.", | ||
2740 | currentWindow()->partItem()->name()), | 2811 | currentWindow()->partItem()->name()), | ||
2741 | xi18nc("@info", | 2812 | xi18nc("@info", | ||
2742 | "Selected view (%1) is not supported by this object type (%2).", | 2813 | "Selected view (%1) is not supported by this object type (%2).", | ||
2743 | Kexi::nameForViewMode(viewMode), | 2814 | Kexi::nameForViewMode(viewMode), | ||
2744 | currentWindow()->part()->info()->name())); | 2815 | currentWindow()->part()->info()->name())); | ||
2745 | return false; | 2816 | return false; | ||
2746 | } | 2817 | } | ||
2818 | setCurrentMode(viewModeToGlobal(viewMode)); | ||||
2819 | | ||||
2747 | updateCustomPropertyPanelTabs(currentWindow()->part(), prevViewMode, | 2820 | updateCustomPropertyPanelTabs(currentWindow()->part(), prevViewMode, | ||
2748 | currentWindow()->part(), viewMode); | 2821 | currentWindow()->part(), viewMode); | ||
2749 | tristate res = currentWindow()->switchToViewMode(viewMode); | 2822 | tristate res = currentWindow()->switchToViewMode(viewMode); | ||
2750 | if (!res) { | 2823 | if (!res) { | ||
2751 | updateCustomPropertyPanelTabs(0, Kexi::NoViewMode); //revert | 2824 | updateCustomPropertyPanelTabs(0, Kexi::NoViewMode); //revert | ||
2752 | showErrorMessage(xi18n("Switching to other view failed (%1).", | 2825 | showErrorMessage(xi18n("Switching to other view failed (%1).", | ||
2753 | Kexi::nameForViewMode(viewMode)), currentWindow()); | 2826 | Kexi::nameForViewMode(viewMode)), currentWindow()); | ||
2754 | return false; | 2827 | return false; | ||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Line(s) | |||||
2970 | tristate KexiMainWindow::closeWindowForTab(int tabIndex) | 3043 | tristate KexiMainWindow::closeWindowForTab(int tabIndex) | ||
2971 | { | 3044 | { | ||
2972 | KexiWindow* window = windowForTab(tabIndex); | 3045 | KexiWindow* window = windowForTab(tabIndex); | ||
2973 | if (!window) | 3046 | if (!window) | ||
2974 | return false; | 3047 | return false; | ||
2975 | return closeWindow(window); | 3048 | return closeWindow(window); | ||
2976 | } | 3049 | } | ||
2977 | 3050 | | |||
3051 | tristate KexiMainWindow::closeAllWindows() | ||||
3052 | { | ||||
3053 | if (!d->objectViewWidget || !d->objectViewWidget->tabWidget()) | ||||
3054 | return true; | ||||
3055 | QList<KexiWindow*> windowList; | ||||
3056 | for (int i = 0; i < d->objectViewWidget->tabWidget()->count(); ++i) { | ||||
3057 | KexiWindow *window = windowForTab(i); | ||||
3058 | if (window) { | ||||
3059 | windowList.append(window); | ||||
3060 | } | ||||
3061 | } | ||||
3062 | tristate alternateResult = true; | ||||
3063 | for (KexiWindow *window : windowList) { | ||||
3064 | const tristate result = closeWindow(window); | ||||
3065 | if (~result) { | ||||
3066 | return result; | ||||
3067 | } | ||||
3068 | if (result == false) { | ||||
3069 | alternateResult = false; | ||||
3070 | } | ||||
3071 | } | ||||
3072 | return alternateResult; | ||||
3073 | } | ||||
3074 | | ||||
2978 | tristate KexiMainWindow::closeWindow(KexiWindow *window, bool layoutTaskBar, bool doNotSaveChanges) | 3075 | tristate KexiMainWindow::closeWindow(KexiWindow *window, bool layoutTaskBar, bool doNotSaveChanges) | ||
2979 | { | 3076 | { | ||
2980 | //! @todo KEXI3 KexiMainWindow::closeWindow() | 3077 | //! @todo KEXI3 KexiMainWindow::closeWindow() | ||
2981 | ///@note Q_UNUSED layoutTaskBar | 3078 | ///@note Q_UNUSED layoutTaskBar | ||
2982 | Q_UNUSED(layoutTaskBar); | 3079 | Q_UNUSED(layoutTaskBar); | ||
2983 | 3080 | | |||
2984 | if (!window) | 3081 | if (!window) | ||
2985 | return true; | 3082 | return true; | ||
2986 | if (d->insideCloseWindow) | 3083 | if (d->insideCloseWindow) | ||
2987 | return true; | 3084 | return true; | ||
2988 | 3085 | | |||
2989 | const int previousItemId = window->partItem()->identifier(); | 3086 | const int previousItemId = window->partItem()->identifier(); | ||
2990 | 3087 | | |||
2991 | #ifndef KEXI_NO_PENDING_DIALOGS | 3088 | #ifndef KEXI_NO_PENDING_DIALOGS | ||
2992 | d->addItemToPendingWindows(window->partItem(), Private::WindowClosingJob); | 3089 | d->addItemToPendingWindows(window->partItem(), Private::WindowClosingJob); | ||
2993 | #endif | 3090 | #endif | ||
2994 | 3091 | | |||
2995 | d->insideCloseWindow = true; | 3092 | d->insideCloseWindow = true; | ||
2996 | 3093 | | |||
2997 | if (window == currentWindow() && !window->isAttached()) { | 3094 | if (window == currentWindow() && !window->isAttached()) { | ||
2998 | if (d->propEditor) { | 3095 | if (d->propertyEditor()) { | ||
2999 | // ah, closing detached window - better switch off property buffer right now... | 3096 | // ah, closing detached window - better switch off property buffer right now... | ||
3000 | d->propertySet = 0; | 3097 | d->propertySet = 0; | ||
3001 | d->propEditor->editor()->changeSet(0); | 3098 | d->propertyEditor()->changeSet(0); | ||
3002 | } | 3099 | } | ||
3003 | } | 3100 | } | ||
3004 | 3101 | | |||
3005 | bool remove_on_closing = window->partItem() ? window->partItem()->neverSaved() : false; | 3102 | bool remove_on_closing = window->partItem() ? window->partItem()->neverSaved() : false; | ||
3006 | if (window->isDirty() && !d->forceWindowClosing && !doNotSaveChanges) { | 3103 | if (window->isDirty() && !d->forceWindowClosing && !doNotSaveChanges) { | ||
3007 | //more accurate tool tips and what's this | 3104 | //more accurate tool tips and what's this | ||
3008 | KGuiItem saveChanges(KStandardGuiItem::save()); | 3105 | KGuiItem saveChanges(KStandardGuiItem::save()); | ||
3009 | saveChanges.setToolTip(xi18n("Save changes")); | 3106 | saveChanges.setToolTip(xi18n("Save changes")); | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 3169 | #endif | |||
3073 | //msg? | 3170 | //msg? | ||
3074 | //! @todo ask if we'd continue and return true/false | 3171 | //! @todo ask if we'd continue and return true/false | ||
3075 | d->insideCloseWindow = false; | 3172 | d->insideCloseWindow = false; | ||
3076 | d->windowsToClose.clear(); //give up with 'close all' | 3173 | d->windowsToClose.clear(); //give up with 'close all' | ||
3077 | return false; | 3174 | return false; | ||
3078 | } | 3175 | } | ||
3079 | } else { | 3176 | } else { | ||
3080 | //not dirty now | 3177 | //not dirty now | ||
3081 | if (d->navigator) { | 3178 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
3082 | d->navigator->updateItemName(*window->partItem(), false); | 3179 | d->objectViewWidget->projectNavigator()->updateItemName(*window->partItem(), false); | ||
3083 | } | 3180 | } | ||
3084 | } | 3181 | } | ||
3085 | 3182 | | |||
3086 | hideDesignTab(previousItemId, QString()); | 3183 | hideDesignTab(previousItemId, QString()); | ||
3087 | 3184 | | |||
3088 | d->removeWindow(window_id); | 3185 | d->removeWindow(window_id); | ||
3089 | d->setWindowContainerExistsFor(window->partItem()->identifier(), false); | 3186 | d->setWindowContainerExistsFor(window->partItem()->identifier(), false); | ||
3090 | QWidget *windowContainer = window->parentWidget(); | 3187 | QWidget *windowContainer = window->parentWidget(); | ||
3091 | d->mainWidget->tabWidget()->removeTab( | 3188 | d->objectViewWidget->tabWidget()->removeTab( | ||
3092 | d->mainWidget->tabWidget()->indexOf(windowContainer)); | 3189 | d->objectViewWidget->tabWidget()->indexOf(windowContainer)); | ||
3093 | 3190 | | |||
3094 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | 3191 | #ifdef KEXI_QUICK_PRINTING_SUPPORT | ||
3095 | //also remove from 'print setup dialogs' cache, if needed | 3192 | //also remove from 'print setup dialogs' cache, if needed | ||
3096 | int printedObjectID = 0; | 3193 | int printedObjectID = 0; | ||
3097 | if (d->pageSetupWindowItemID2dataItemID_map.contains(window_id)) | 3194 | if (d->pageSetupWindowItemID2dataItemID_map.contains(window_id)) | ||
3098 | printedObjectID = d->pageSetupWindowItemID2dataItemID_map[ window_id ]; | 3195 | printedObjectID = d->pageSetupWindowItemID2dataItemID_map[ window_id ]; | ||
3099 | d->pageSetupWindows.remove(printedObjectID); | 3196 | d->pageSetupWindows.remove(printedObjectID); | ||
3100 | #endif | 3197 | #endif | ||
3101 | 3198 | | |||
3102 | delete windowContainer; | 3199 | delete windowContainer; | ||
3103 | 3200 | | |||
3104 | //focus navigator if nothing else available | 3201 | //focus navigator if nothing else available | ||
3105 | if (d->openedWindowsCount() == 0) { | 3202 | if (d->openedWindowsCount() == 0) { | ||
3106 | if (d->navigator) { | 3203 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
3107 | d->navigator->setFocus(); | 3204 | d->objectViewWidget->projectNavigator()->setFocus(); | ||
3108 | } | 3205 | } | ||
3109 | d->updatePropEditorVisibility(Kexi::NoViewMode); | 3206 | d->updatePropEditorVisibility(Kexi::NoViewMode); | ||
3110 | } | 3207 | } | ||
3111 | 3208 | | |||
3112 | invalidateActions(); | 3209 | invalidateActions(); | ||
3113 | d->insideCloseWindow = false; | 3210 | d->insideCloseWindow = false; | ||
3114 | if (!d->windowsToClose.isEmpty()) {//continue 'close all' | 3211 | if (!d->windowsToClose.isEmpty()) {//continue 'close all' | ||
3115 | KexiWindow* w = d->windowsToClose.takeAt(0); | 3212 | KexiWindow* w = d->windowsToClose.takeAt(0); | ||
3116 | closeWindow(w, true); | 3213 | closeWindow(w, true); | ||
3117 | } | 3214 | } | ||
3118 | 3215 | | |||
3119 | #ifndef KEXI_NO_PENDING_DIALOGS | 3216 | #ifndef KEXI_NO_PENDING_DIALOGS | ||
3120 | d->removePendingWindow(window_id); | 3217 | d->removePendingWindow(window_id); | ||
3121 | 3218 | | |||
3122 | //perform pending global action that was suspended: | 3219 | //perform pending global action that was suspended: | ||
3123 | if (!d->pendingWindowsExist()) { | 3220 | if (!d->pendingWindowsExist()) { | ||
3124 | d->executeActionWhenPendingJobsAreFinished(); | 3221 | d->executeActionWhenPendingJobsAreFinished(); | ||
3125 | } | 3222 | } | ||
3126 | #endif | 3223 | #endif | ||
3127 | d->mainWidget->slotCurrentTabIndexChanged(d->mainWidget->tabWidget()->currentIndex()); | 3224 | //d->objectViewWidget->slotCurrentTabIndexChanged(d->objectViewWidget->tabWidget()->currentIndex()); | ||
3128 | showDesignTabIfNeeded(0); | 3225 | showDesignTabIfNeeded(0); | ||
3129 | 3226 | | |||
3130 | if (currentWindow()) { | 3227 | if (currentWindow()) { | ||
3131 | restoreDesignTabIfNeeded(currentWindow()->partItem()->pluginId(), | 3228 | restoreDesignTabIfNeeded(currentWindow()->partItem()->pluginId(), | ||
3132 | currentWindow()->currentViewMode(), | 3229 | currentWindow()->currentViewMode(), | ||
3133 | 0); | 3230 | 0); | ||
3134 | } | 3231 | } | ||
3135 | d->tabsToActivateOnShow.remove(previousItemId); | 3232 | d->tabsToActivateOnShow.remove(previousItemId); | ||
3136 | return true; | 3233 | return true; | ||
3137 | } | 3234 | } | ||
3138 | 3235 | | |||
3139 | QWidget* KexiMainWindow::findWindow(QWidget *w) | 3236 | QWidget* KexiMainWindow::findWindow(QWidget *w) | ||
3140 | { | 3237 | { | ||
3141 | while (w && !acceptsSharedActions(w)) { | 3238 | while (w && !acceptsSharedActions(w)) { | ||
3142 | if (w == d->propEditorDockWidget) | 3239 | if (w == d->objectViewWidget->propertyPane()) { | ||
3143 | return currentWindow(); | 3240 | return currentWindow(); | ||
3241 | } | ||||
3144 | w = w->parentWidget(); | 3242 | w = w->parentWidget(); | ||
3145 | } | 3243 | } | ||
3146 | return w; | 3244 | return w; | ||
3147 | } | 3245 | } | ||
3148 | 3246 | | |||
3149 | KexiWindow* KexiMainWindow::openedWindowFor(int identifier) | 3247 | KexiWindow* KexiMainWindow::openedWindowFor(int identifier) | ||
3150 | { | 3248 | { | ||
3151 | return d->openedWindowFor(identifier); | 3249 | return d->openedWindowFor(identifier); | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 3337 | #ifndef KEXI_NO_PENDING_DIALOGS | |||
3245 | } | 3343 | } | ||
3246 | #else | 3344 | #else | ||
3247 | KexiWindow *window = openedWindowFor(item); | 3345 | KexiWindow *window = openedWindowFor(item); | ||
3248 | #endif | 3346 | #endif | ||
3249 | int previousItemId = currentWindow() ? currentWindow()->partItem()->identifier() : 0; | 3347 | int previousItemId = currentWindow() ? currentWindow()->partItem()->identifier() : 0; | ||
3250 | *openingCancelled = false; | 3348 | *openingCancelled = false; | ||
3251 | 3349 | | |||
3252 | bool alreadyOpened = false; | 3350 | bool alreadyOpened = false; | ||
3253 | KexiWindowContainer *windowContainer = 0; | 3351 | QWidget *windowContainer = 0; | ||
3254 | 3352 | | |||
3255 | if (window) { | 3353 | if (window) { | ||
3256 | if (viewMode != window->currentViewMode()) { | 3354 | if (viewMode != window->currentViewMode()) { | ||
3257 | if (true != switchToViewMode(*window, viewMode)) | 3355 | if (true != switchToViewMode(*window, viewMode)) | ||
3258 | return 0; | 3356 | return 0; | ||
3259 | } else | 3357 | } else | ||
3260 | activateWindow(*window); | 3358 | activateWindow(*window); | ||
3261 | alreadyOpened = true; | 3359 | alreadyOpened = true; | ||
3262 | } else { | 3360 | } else { | ||
3263 | if (d->windowContainerExistsFor(item->identifier())) { | 3361 | if (d->windowContainerExistsFor(item->identifier())) { | ||
3264 | // window not yet present but window container exists: return 0 and wait | 3362 | // window not yet present but window container exists: return 0 and wait | ||
3265 | return 0; | 3363 | return 0; | ||
3266 | } | 3364 | } | ||
3267 | KexiPart::Part *part = Kexi::partManager().partForPluginId(item->pluginId()); | 3365 | KexiPart::Part *part = Kexi::partManager().partForPluginId(item->pluginId()); | ||
3268 | d->updatePropEditorVisibility(viewMode, part ? part->info() : 0); | 3366 | d->updatePropEditorVisibility(viewMode, part ? part->info() : 0); | ||
3269 | //update tabs before opening | 3367 | //update tabs before opening | ||
3270 | updateCustomPropertyPanelTabs(currentWindow() ? currentWindow()->part() : 0, | 3368 | updateCustomPropertyPanelTabs(currentWindow() ? currentWindow()->part() : 0, | ||
3271 | currentWindow() ? currentWindow()->currentViewMode() : Kexi::NoViewMode, | 3369 | currentWindow() ? currentWindow()->currentViewMode() : Kexi::NoViewMode, | ||
3272 | part, viewMode); | 3370 | part, viewMode); | ||
3273 | 3371 | | |||
3372 | const int tabIndex = d->objectViewWidget->tabWidget()->addEmptyContainerTab( | ||||
3373 | part ? part->info()->icon() : koIcon("object"), | ||||
3374 | KexiWindow::windowTitleForItem(*item)); | ||||
3274 | // open new tab earlier | 3375 | // open new tab earlier | ||
3275 | windowContainer = new KexiWindowContainer(d->mainWidget->tabWidget()); | | |||
3276 | d->setWindowContainerExistsFor(item->identifier(), true); | 3376 | d->setWindowContainerExistsFor(item->identifier(), true); | ||
3277 | const int tabIndex = d->mainWidget->tabWidget()->addTab( | 3377 | d->objectViewWidget->tabWidget()->setTabToolTip(tabIndex, KexiPart::fullCaptionForItem(item, part)); | ||
3278 | windowContainer, | | |||
3279 | QIcon::fromTheme(part ? part->info()->iconName() : QString()), | | |||
3280 | KexiWindow::windowTitleForItem(*item)); | | |||
3281 | d->mainWidget->tabWidget()->setTabToolTip(tabIndex, KexiPart::fullCaptionForItem(item, part)); | | |||
3282 | QString whatsThisText; | 3378 | QString whatsThisText; | ||
3283 | if (part) { | 3379 | if (part) { | ||
3284 | whatsThisText = xi18nc("@info", | 3380 | whatsThisText = xi18nc("@info", | ||
3285 | "Tab for <resource>%1</resource> (%2).", | 3381 | "Tab for <resource>%1</resource> (%2).", | ||
3286 | item->captionOrName(), part->info()->name()); | 3382 | item->captionOrName(), part->info()->name()); | ||
3287 | } | 3383 | } | ||
3288 | else { | 3384 | else { | ||
3289 | whatsThisText = xi18nc("@info", | 3385 | whatsThisText = xi18nc("@info", | ||
3290 | "Tab for <resource>%1</resource>.", item->captionOrName()); | 3386 | "Tab for <resource>%1</resource>.", item->captionOrName()); | ||
3291 | } | 3387 | } | ||
3292 | d->mainWidget->tabWidget()->setTabWhatsThis(tabIndex, whatsThisText); | 3388 | d->objectViewWidget->tabWidget()->setTabWhatsThis(tabIndex, whatsThisText); | ||
3293 | d->mainWidget->tabWidget()->setCurrentWidget(windowContainer); | 3389 | d->objectViewWidget->tabWidget()->setCurrentIndex(tabIndex); | ||
3294 | 3390 | | |||
3295 | #ifndef KEXI_NO_PENDING_DIALOGS | 3391 | #ifndef KEXI_NO_PENDING_DIALOGS | ||
3296 | d->addItemToPendingWindows(item, Private::WindowOpeningJob); | 3392 | d->addItemToPendingWindows(item, Private::WindowOpeningJob); | ||
3297 | #endif | 3393 | #endif | ||
3394 | windowContainer = d->objectViewWidget->tabWidget()->widget(tabIndex); | ||||
3298 | window = d->prj->openObject(windowContainer, item, viewMode, staticObjectArgs); | 3395 | window = d->prj->openObject(windowContainer, item, viewMode, staticObjectArgs); | ||
3299 | if (window) { | 3396 | if (window) { | ||
3300 | windowContainer->setWindow(window); | 3397 | d->objectViewWidget->tabWidget()->setWindowForTab(tabIndex, window); | ||
3301 | // update text and icon | 3398 | // update text and icon | ||
3302 | d->mainWidget->tabWidget()->setTabText( | 3399 | d->objectViewWidget->tabWidget()->setTabText(tabIndex, window->windowTitle()); | ||
3303 | d->mainWidget->tabWidget()->indexOf(windowContainer), | 3400 | d->objectViewWidget->tabWidget()->setTabIcon(tabIndex, window->windowIcon()); | ||
3304 | window->windowTitle()); | | |||
3305 | d->mainWidget->tabWidget()->setTabIcon( | | |||
3306 | d->mainWidget->tabWidget()->indexOf(windowContainer), | | |||
3307 | window->windowIcon()); | | |||
3308 | } | 3401 | } | ||
3309 | } | 3402 | } | ||
3310 | 3403 | | |||
3311 | if (!window || !activateWindow(*window)) { | 3404 | if (!window || !activateWindow(*window)) { | ||
3312 | #ifndef KEXI_NO_PENDING_DIALOGS | 3405 | #ifndef KEXI_NO_PENDING_DIALOGS | ||
3313 | d->removePendingWindow(item->identifier()); | 3406 | d->removePendingWindow(item->identifier()); | ||
3314 | #endif | 3407 | #endif | ||
3315 | d->setWindowContainerExistsFor(item->identifier(), false); | 3408 | d->setWindowContainerExistsFor(item->identifier(), false); | ||
3316 | d->mainWidget->tabWidget()->removeTab( | 3409 | d->objectViewWidget->tabWidget()->removeTab( | ||
3317 | d->mainWidget->tabWidget()->indexOf(windowContainer)); | 3410 | d->objectViewWidget->tabWidget()->indexOf(windowContainer)); | ||
3318 | delete windowContainer; | 3411 | delete windowContainer; | ||
3319 | updateCustomPropertyPanelTabs(0, Kexi::NoViewMode); //revert | 3412 | updateCustomPropertyPanelTabs(0, Kexi::NoViewMode); //revert | ||
3320 | //! @todo add error msg... | 3413 | //! @todo add error msg... | ||
3321 | return 0; | 3414 | return 0; | ||
3322 | } | 3415 | } | ||
3323 | 3416 | | |||
3324 | if (viewMode != window->currentViewMode()) | 3417 | if (viewMode != window->currentViewMode()) | ||
3325 | invalidateSharedActions(); | 3418 | invalidateSharedActions(); | ||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 3516 | { | |||
3435 | 3528 | | |||
3436 | KexiPart::Item *it = d->prj->createPartItem(info); | 3529 | KexiPart::Item *it = d->prj->createPartItem(info); | ||
3437 | if (!it) { | 3530 | if (!it) { | ||
3438 | //! @todo error | 3531 | //! @todo error | ||
3439 | return false; | 3532 | return false; | ||
3440 | } | 3533 | } | ||
3441 | 3534 | | |||
3442 | if (!it->neverSaved()) { //only add stored objects to the browser | 3535 | if (!it->neverSaved()) { //only add stored objects to the browser | ||
3443 | d->navigator->model()->slotAddItem(it); | 3536 | d->objectViewWidget->projectNavigator()->model()->slotAddItem(it); | ||
3444 | } | 3537 | } | ||
3445 | return openObject(it, Kexi::DesignViewMode, openingCancelled); | 3538 | return openObject(it, Kexi::DesignViewMode, openingCancelled); | ||
3446 | } | 3539 | } | ||
3447 | 3540 | | |||
3448 | tristate KexiMainWindow::removeObject(KexiPart::Item *item, bool dontAsk) | 3541 | tristate KexiMainWindow::removeObject(KexiPart::Item *item, bool dontAsk) | ||
3449 | { | 3542 | { | ||
3450 | if (d->userMode) | 3543 | if (d->userMode) | ||
3451 | return cancelled; | 3544 | return cancelled; | ||
▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Line(s) | 3697 | #endif | |||
3608 | //change item | 3701 | //change item | ||
3609 | window->updateCaption(); | 3702 | window->updateCaption(); | ||
3610 | if (static_cast<KexiWindow*>(currentWindow()) == window)//optionally, update app. caption | 3703 | if (static_cast<KexiWindow*>(currentWindow()) == window)//optionally, update app. caption | ||
3611 | updateAppCaption(); | 3704 | updateAppCaption(); | ||
3612 | } | 3705 | } | ||
3613 | 3706 | | |||
3614 | void KexiMainWindow::acceptPropertySetEditing() | 3707 | void KexiMainWindow::acceptPropertySetEditing() | ||
3615 | { | 3708 | { | ||
3616 | if (d->propEditor) | 3709 | if (d->propertyEditor()) { | ||
3617 | d->propEditor->editor()->acceptInput(); | 3710 | d->propertyEditor()->acceptInput(); | ||
3711 | } | ||||
3618 | } | 3712 | } | ||
3619 | 3713 | | |||
3620 | void KexiMainWindow::propertySetSwitched(KexiWindow *window, bool force, | 3714 | void KexiMainWindow::propertySetSwitched(KexiWindow *window, bool force, | ||
3621 | bool preservePrevSelection, bool sortedProperties, const QByteArray& propertyToSelect) | 3715 | bool preservePrevSelection, bool sortedProperties, const QByteArray& propertyToSelect) | ||
3622 | { | 3716 | { | ||
3623 | KexiWindow* _currentWindow = currentWindow(); | 3717 | KexiWindow* _currentWindow = currentWindow(); | ||
3624 | //qDebug() << "currentWindow(): " | 3718 | //qDebug() << "currentWindow(): " | ||
3625 | // << (_currentWindow ? _currentWindow->windowTitle() : QString("NULL")) | 3719 | // << (_currentWindow ? _currentWindow->windowTitle() : QString("NULL")) | ||
3626 | // << " window: " << (window ? window->windowTitle() : QString("NULL")); | 3720 | // << "window:" << (window ? window->windowTitle() : QString("NULL")); | ||
3627 | if (_currentWindow && _currentWindow != window) { | 3721 | if (_currentWindow && _currentWindow != window) { | ||
3628 | d->propertySet = 0; //we'll need to move to another prop. set | 3722 | d->propertySet = 0; //we'll need to move to another prop. set | ||
3629 | return; | 3723 | return; | ||
3630 | } | 3724 | } | ||
3631 | if (d->propEditor) { | 3725 | if (d->propertyEditor()) { | ||
3632 | KPropertySet *newSet = _currentWindow ? _currentWindow->propertySet() : 0; | 3726 | KPropertySet *newSet = _currentWindow ? _currentWindow->propertySet() : 0; | ||
3633 | if (!newSet || (force || static_cast<KPropertySet*>(d->propertySet) != newSet)) { | 3727 | if (!newSet || (force || static_cast<KPropertySet*>(d->propertySet) != newSet)) { | ||
3634 | d->propertySet = newSet; | 3728 | d->propertySet = newSet; | ||
3635 | if (preservePrevSelection || force) { | 3729 | if (preservePrevSelection || force) { | ||
3636 | KPropertyEditorView::SetOptions options; | 3730 | KPropertyEditorView::SetOptions options; | ||
3637 | if (preservePrevSelection) { | 3731 | if (preservePrevSelection) { | ||
3638 | options |= KPropertyEditorView::SetOption::PreservePreviousSelection; | 3732 | options |= KPropertyEditorView::SetOption::PreservePreviousSelection; | ||
3639 | } | 3733 | } | ||
3640 | if (sortedProperties) { | 3734 | if (sortedProperties) { | ||
3641 | options |= KPropertyEditorView::SetOption::AlphabeticalOrder; | 3735 | options |= KPropertyEditorView::SetOption::AlphabeticalOrder; | ||
3642 | } | 3736 | } | ||
3643 | 3737 | | |||
3644 | if (propertyToSelect.isEmpty()) { | 3738 | d->objectViewWidget->propertyPane()->changePropertySet( | ||
3645 | d->propEditor->editor()->changeSet(d->propertySet, options); | 3739 | d->propertySet, propertyToSelect, options, | ||
3646 | } | 3740 | (_currentWindow && _currentWindow->selectedView()) | ||
3647 | else { | 3741 | ? _currentWindow->selectedView()->textToDisplayForNullSet() | ||
3648 | d->propEditor->editor()->changeSet(d->propertySet, propertyToSelect, options); | 3742 | : QString()); | ||
3649 | } | | |||
3650 | } | 3743 | } | ||
3651 | } | 3744 | } | ||
3652 | } | 3745 | } | ||
3653 | } | 3746 | } | ||
3654 | 3747 | | |||
3655 | void KexiMainWindow::slotDirtyFlagChanged(KexiWindow* window) | 3748 | void KexiMainWindow::slotDirtyFlagChanged(KexiWindow* window) | ||
3656 | { | 3749 | { | ||
3657 | KexiPart::Item *item = window->partItem(); | 3750 | KexiPart::Item *item = window->partItem(); | ||
3658 | //update text in navigator and app. caption | 3751 | //update text in navigator and app. caption | ||
3659 | if (!d->userMode) { | 3752 | if (!d->userMode) { | ||
3660 | d->navigator->updateItemName(*item, window->isDirty()); | 3753 | d->objectViewWidget->projectNavigator()->updateItemName(*item, window->isDirty()); | ||
3661 | } | 3754 | } | ||
3662 | 3755 | | |||
3663 | invalidateActions(); | 3756 | invalidateActions(); | ||
3664 | updateAppCaption(); | 3757 | updateAppCaption(); | ||
3665 | d->mainWidget->tabWidget()->setTabText( | 3758 | d->objectViewWidget->tabWidget()->setTabText( | ||
3666 | d->mainWidget->tabWidget()->indexOf(window->parentWidget()), | 3759 | d->objectViewWidget->tabWidget()->indexOf(window->parentWidget()), | ||
3667 | window->windowTitle()); | 3760 | window->windowTitle()); | ||
3668 | } | 3761 | } | ||
3669 | 3762 | | |||
3670 | void KexiMainWindow::slotTipOfTheDay() | 3763 | void KexiMainWindow::slotTipOfTheDay() | ||
3671 | { | 3764 | { | ||
3672 | //! @todo | 3765 | //! @todo | ||
3673 | } | 3766 | } | ||
3674 | 3767 | | |||
▲ Show 20 Lines • Show All 421 Lines • ▼ Show 20 Line(s) | 4188 | d->pageSetupWindowItemID2dataItemID_map.insert( | |||
4096 | printingWindow->partItem()->identifier(), item->identifier()); | 4189 | printingWindow->partItem()->identifier(), item->identifier()); | ||
4097 | 4190 | | |||
4098 | return true; | 4191 | return true; | ||
4099 | } | 4192 | } | ||
4100 | #endif | 4193 | #endif | ||
4101 | 4194 | | |||
4102 | void KexiMainWindow::slotEditCopySpecialDataTable() | 4195 | void KexiMainWindow::slotEditCopySpecialDataTable() | ||
4103 | { | 4196 | { | ||
4104 | KexiPart::Item* item = d->navigator->selectedPartItem(); | 4197 | KexiPart::Item* item = d->objectViewWidget->projectNavigator()->selectedPartItem(); | ||
4105 | if (item) | 4198 | if (item) | ||
4106 | copyItemToClipboardAsDataTable(item); | 4199 | copyItemToClipboardAsDataTable(item); | ||
4107 | } | 4200 | } | ||
4108 | 4201 | | |||
4109 | tristate KexiMainWindow::copyItemToClipboardAsDataTable(KexiPart::Item* item) | 4202 | tristate KexiMainWindow::copyItemToClipboardAsDataTable(KexiPart::Item* item) | ||
4110 | { | 4203 | { | ||
4111 | if (!item) | 4204 | if (!item) | ||
4112 | return false; | 4205 | return false; | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | |||||
4217 | 4310 | | |||
4218 | void KexiMainWindow::highlightObject(const QString& pluginId, const QString& name) | 4311 | void KexiMainWindow::highlightObject(const QString& pluginId, const QString& name) | ||
4219 | { | 4312 | { | ||
4220 | if (!d->prj) | 4313 | if (!d->prj) | ||
4221 | return; | 4314 | return; | ||
4222 | KexiPart::Item *item = d->prj->itemForPluginId(pluginId, name); | 4315 | KexiPart::Item *item = d->prj->itemForPluginId(pluginId, name); | ||
4223 | if (!item) | 4316 | if (!item) | ||
4224 | return; | 4317 | return; | ||
4225 | if (d->navigator) { | 4318 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||
4226 | slotSetProjectNavigatorVisible(true); | 4319 | d->setProjectNavigatorVisible(true, Private::ShowAnimated); | ||
4227 | d->navigator->selectItem(*item); | 4320 | d->objectViewWidget->projectNavigator()->selectItem(*item); | ||
4228 | } | 4321 | } | ||
4229 | } | 4322 | } | ||
4230 | 4323 | | |||
4231 | void KexiMainWindow::slotPartItemSelectedInNavigator(KexiPart::Item* item) | 4324 | void KexiMainWindow::slotPartItemSelectedInNavigator(KexiPart::Item* item) | ||
4232 | { | 4325 | { | ||
4233 | Q_UNUSED(item); | 4326 | Q_UNUSED(item); | ||
4234 | } | 4327 | } | ||
4235 | 4328 | | |||
Show All 15 Lines | |||||
4251 | } | 4344 | } | ||
4252 | 4345 | | |||
4253 | void KexiMainWindow::addToolBarAction(const QString& toolBarName, QAction *action) | 4346 | void KexiMainWindow::addToolBarAction(const QString& toolBarName, QAction *action) | ||
4254 | { | 4347 | { | ||
4255 | if (d->tabbedToolBar) | 4348 | if (d->tabbedToolBar) | ||
4256 | d->tabbedToolBar->addAction(toolBarName, action); | 4349 | d->tabbedToolBar->addAction(toolBarName, action); | ||
4257 | } | 4350 | } | ||
4258 | 4351 | | |||
4259 | void KexiMainWindow::updatePropertyEditorInfoLabel(const QString& textToDisplayForNullSet) | 4352 | void KexiMainWindow::updatePropertyEditorInfoLabel() | ||
4353 | { | ||||
4354 | if (d->objectViewWidget && d->objectViewWidget->propertyPane()) { | ||||
4355 | d->objectViewWidget->propertyPane()->updateInfoLabelForPropertySet( | ||||
4356 | (currentWindow() && currentWindow()->selectedView()) | ||||
4357 | ? currentWindow()->selectedView()->textToDisplayForNullSet() | ||||
4358 | : QString()); | ||||
4359 | } | ||||
4360 | } | ||||
4361 | | ||||
4362 | void KexiMainWindow::beginPropertyPaneUpdate() | ||||
4260 | { | 4363 | { | ||
4261 | d->propEditor->updateInfoLabelForPropertySet(d->propertySet, textToDisplayForNullSet); | 4364 | if (d->propertyPaneAnimation) { | ||
4365 | d->propertyPaneAnimation->hide(); | ||||
4366 | d->propertyPaneAnimation->deleteLater(); | ||||
4367 | } | ||||
4368 | d->propertyPaneAnimation = new KexiFadeWidgetEffect(d->objectViewWidget->propertyPane()); | ||||
4369 | } | ||||
4370 | | ||||
4371 | void KexiMainWindow::endPropertyPaneUpdate() | ||||
4372 | { | ||||
4373 | if (d->propertyPaneAnimation) { | ||||
4374 | d->objectViewWidget->propertyPane()->repaint(); | ||||
4375 | d->propertyPaneAnimation->start(150); | ||||
4376 | } | ||||
4262 | } | 4377 | } | ||
4263 | 4378 | | |||
4264 | void KexiMainWindow::addSearchableModel(KexiSearchableModel *model) | 4379 | void KexiMainWindow::addSearchableModel(KexiSearchableModel *model) | ||
4265 | { | 4380 | { | ||
4266 | if (d->tabbedToolBar) { | 4381 | if (d->tabbedToolBar) { | ||
4267 | d->tabbedToolBar->addSearchableModel(model); | 4382 | d->tabbedToolBar->addSearchableModel(model); | ||
4268 | } | 4383 | } | ||
4269 | } | 4384 | } | ||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 4528 | { | |||
4428 | const Qt::WindowStates s = windowState() & Qt::WindowMaximized; | 4543 | const Qt::WindowStates s = windowState() & Qt::WindowMaximized; | ||
4429 | if (isFullScreen) { | 4544 | if (isFullScreen) { | ||
4430 | setWindowState(windowState() | Qt::WindowFullScreen | s); | 4545 | setWindowState(windowState() | Qt::WindowFullScreen | s); | ||
4431 | } else { | 4546 | } else { | ||
4432 | setWindowState((windowState() & ~Qt::WindowFullScreen)); | 4547 | setWindowState((windowState() & ~Qt::WindowFullScreen)); | ||
4433 | showMaximized(); | 4548 | showMaximized(); | ||
4434 | } | 4549 | } | ||
4435 | } | 4550 | } | ||
4551 | | ||||
4552 | Kexi::GlobalViewMode KexiMainWindow::currentMode() const | ||||
4553 | { | ||||
4554 | return d->modeSelector->currentMode(); | ||||
4555 | } | ||||
4556 | | ||||
4557 | void KexiMainWindow::setCurrentMode(Kexi::GlobalViewMode mode) | ||||
4558 | { | ||||
4559 | d->modeSelector->setCurrentMode(mode); | ||||
4560 | } | ||||
4561 | | ||||
4562 | void KexiMainWindow::slotCurrentModeChanged(Kexi::GlobalViewMode previousMode) | ||||
4563 | { | ||||
4564 | const Kexi::ViewMode viewMode = currentWindow() | ||||
4565 | ? currentWindow()->currentViewMode() : Kexi::NoViewMode; | ||||
4566 | switch (d->modeSelector->currentMode()) { | ||||
4567 | case Kexi::WelcomeGlobalMode: | ||||
4568 | break; | ||||
4569 | case Kexi::ProjectGlobalMode: | ||||
4570 | break; | ||||
4571 | case Kexi::EditGlobalMode: | ||||
4572 | updateObjectView(); | ||||
4573 | d->globalViewStack->setCurrentWidget(d->objectViewWidget); | ||||
4574 | if (viewMode == Kexi::DesignViewMode || viewMode == Kexi::TextViewMode) { | ||||
4575 | if (true != switchToViewMode(*currentWindow(), Kexi::DataViewMode)) { | ||||
4576 | setCurrentMode(previousMode); | ||||
4577 | } | ||||
4578 | } | ||||
4579 | break; | ||||
4580 | case Kexi::DesignGlobalMode: | ||||
4581 | updateObjectView(); | ||||
4582 | d->globalViewStack->setCurrentWidget(d->objectViewWidget); | ||||
4583 | if (viewMode == Kexi::DataViewMode) { | ||||
4584 | Kexi::ViewMode newViewMode; | ||||
4585 | if (currentWindow()->supportsViewMode(Kexi::TextViewMode) | ||||
4586 | && d->modeSelector->keyboardModifiers() == Qt::CTRL) | ||||
4587 | { | ||||
4588 | newViewMode = Kexi::TextViewMode; | ||||
4589 | } else { | ||||
4590 | newViewMode = Kexi::DesignViewMode; | ||||
4591 | } | ||||
4592 | if (true != switchToViewMode(*currentWindow(), newViewMode)) { | ||||
4593 | setCurrentMode(previousMode); | ||||
4594 | } | ||||
4595 | } | ||||
4596 | break; | ||||
4597 | case Kexi::HelpGlobalMode: | ||||
4598 | break; | ||||
4599 | case Kexi::NoGlobalMode: | ||||
4600 | break; | ||||
4601 | } | ||||
4602 | } | ||||
4603 | | ||||
4604 | void KexiMainWindow::slotProjectNavigatorVisibilityChanged(bool visible) | ||||
4605 | { | ||||
4606 | if (d->objectViewWidget && d->objectViewWidget->projectNavigator()) { | ||||
4607 | d->modeSelector->setArrowColor(visible | ||||
4608 | ? d->objectViewWidget->projectNavigator()->palette().color(QPalette::Window) | ||||
4609 | : d->objectViewWidget->tabWidget()->palette().color(QPalette::Window)); | ||||
4610 | } | ||||
4611 | } |