Changeset View
Standalone View
shell/shell.cpp
Show All 32 Lines | |||||
33 | #include <KMessageBox> | 33 | #include <KMessageBox> | ||
34 | #include <QMimeType> | 34 | #include <QMimeType> | ||
35 | #include <QMimeDatabase> | 35 | #include <QMimeDatabase> | ||
36 | #include <KStandardAction> | 36 | #include <KStandardAction> | ||
37 | #include <KToolBar> | 37 | #include <KToolBar> | ||
38 | #include <KRecentFilesAction> | 38 | #include <KRecentFilesAction> | ||
39 | #include <KServiceTypeTrader> | 39 | #include <KServiceTypeTrader> | ||
40 | #include <KToggleFullScreenAction> | 40 | #include <KToggleFullScreenAction> | ||
41 | #include <KToggleToolBarAction> | ||||
41 | #include <KActionCollection> | 42 | #include <KActionCollection> | ||
42 | #include <KWindowSystem> | 43 | #include <KWindowSystem> | ||
43 | #include <QTabWidget> | 44 | #include <QTabWidget> | ||
44 | #include <KXMLGUIFactory> | 45 | #include <KXMLGUIFactory> | ||
45 | #include <QDragMoveEvent> | 46 | #include <QDragMoveEvent> | ||
46 | #include <QTabBar> | 47 | #include <QTabBar> | ||
47 | #include <KConfigGroup> | 48 | #include <KConfigGroup> | ||
48 | #include <KUrlMimeData> | 49 | #include <KUrlMimeData> | ||
▲ Show 20 Lines • Show All 308 Lines • ▼ Show 20 Line(s) | 337 | { | |||
357 | m_nextTabAction->setEnabled( false ); | 358 | m_nextTabAction->setEnabled( false ); | ||
358 | connect( m_nextTabAction, &QAction::triggered, this, &Shell::activateNextTab ); | 359 | connect( m_nextTabAction, &QAction::triggered, this, &Shell::activateNextTab ); | ||
359 | 360 | | |||
360 | m_prevTabAction = actionCollection()->addAction(QStringLiteral("tab-previous")); | 361 | m_prevTabAction = actionCollection()->addAction(QStringLiteral("tab-previous")); | ||
361 | m_prevTabAction->setText( i18n("Previous Tab") ); | 362 | m_prevTabAction->setText( i18n("Previous Tab") ); | ||
362 | actionCollection()->setDefaultShortcuts(m_prevTabAction, KStandardShortcut::tabPrev()); | 363 | actionCollection()->setDefaultShortcuts(m_prevTabAction, KStandardShortcut::tabPrev()); | ||
363 | m_prevTabAction->setEnabled( false ); | 364 | m_prevTabAction->setEnabled( false ); | ||
364 | connect( m_prevTabAction, &QAction::triggered, this, &Shell::activatePrevTab ); | 365 | connect( m_prevTabAction, &QAction::triggered, this, &Shell::activatePrevTab ); | ||
366 | | ||||
367 | // force the creation of the main toolbar before the annotation toolbar | ||||
368 | // to respect the default toolbar layout defined in shell.rc | ||||
369 | toolBar( "mainToolBar" ); | ||||
370 | KToggleToolBarAction * aToggleAnnotator = new KToggleToolBarAction( toolBar( "annotationToolBar" ), i18n("&Annotations"), this ); | ||||
davidhurka: I remember you had struggle to find the annotation toolbar when you tried to show and hide it. | |||||
That’s what I thought about. :) davidhurka: >> @simgunz just wrote:
> https://phabricator.kde.org/D15580#544534
That’s what I thought… | |||||
Initially I put that action in part.rc, while now I moved it to shell.rc. This makes more sense given that the toolbar belongs to the main window somehow owns the toolbars and I create this action in Shell::setupActions() that makes more sense. The problem is that setupActions is called before setupGUI and createGUI so the toolbar does not exist yet. To solve this I have to call toolBar( "mainToolBar" ); to force the creation of the toolbar and so be able to "bind" the KToggleToolBarAction to an existing toolbar. simgunz: Initially I put that action in `part.rc`, while now I moved it to `shell.rc`. This makes more… | |||||
This (maybe) causes one problem now. The default is to open new documents in new windows. Open a new document with the Open action of an existing shell, so a new Okular window appears. Open the annotation toolbar in both windows. Click Hide in the second window. -> Only the annotation toolbar in the first window is closed. davidhurka: This (maybe) causes one problem now. The default is to open new documents in new windows.
Open… | |||||
Good that you spotted this bug, though it is unrelated to this change (I think). If you use Tools → Annotations or the shortcut F6 everything is working correctly. The problem is only related to the Hide buttton in the toolbar. I indeed expected some weird behavior somewhere. simgunz: Good that you spotted this bug, though it is unrelated to this change (I think). If you use… | |||||
davidhurka: Might it be a hint that there are too many toolbars? I think only the part should have the… | |||||
371 | aToggleAnnotator->setIcon( QIcon::fromTheme( QStringLiteral("draw-freehand") ) ); | ||||
372 | actionCollection()->addAction( QStringLiteral("mouse_toggle_annotate"), aToggleAnnotator ); | ||||
373 | actionCollection()->setDefaultShortcut( aToggleAnnotator, Qt::Key_F6 ); | ||||
365 | } | 374 | } | ||
366 | 375 | | |||
367 | void Shell::saveProperties(KConfigGroup &group) | 376 | void Shell::saveProperties(KConfigGroup &group) | ||
368 | { | 377 | { | ||
369 | if ( !m_isValid ) // part couldn't be loaded, nothing to save | 378 | if ( !m_isValid ) // part couldn't be loaded, nothing to save | ||
370 | return; | 379 | return; | ||
371 | 380 | | |||
372 | // Gather lists of settings to preserve | 381 | // Gather lists of settings to preserve | ||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |
I remember you had struggle to find the annotation toolbar when you tried to show and hide it. Is this code related to the problem and did you solve the problem?