Changeset View
Changeset View
Standalone View
Standalone View
part.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
57 | #include <Kdelibs4Migration> | 57 | #include <Kdelibs4Migration> | ||
58 | #include <KDirWatch> | 58 | #include <KDirWatch> | ||
59 | #include <KFilterBase> | 59 | #include <KFilterBase> | ||
60 | #include <KFilterDev> | 60 | #include <KFilterDev> | ||
61 | #include <KIO/Job> | 61 | #include <KIO/Job> | ||
62 | #include <KIO/OpenFileManagerWindowJob> | 62 | #include <KIO/OpenFileManagerWindowJob> | ||
63 | #include <KJobWidgets> | 63 | #include <KJobWidgets> | ||
64 | #include <KMessageBox> | 64 | #include <KMessageBox> | ||
65 | #include <KParts/MainWindow> | ||||
65 | #include <KPasswordDialog> | 66 | #include <KPasswordDialog> | ||
66 | #include <KPluginFactory> | 67 | #include <KPluginFactory> | ||
67 | #include <KPluginMetaData> | 68 | #include <KPluginMetaData> | ||
68 | #include <KSharedDataCache> | 69 | #include <KSharedDataCache> | ||
69 | #include <KStandardShortcut> | 70 | #include <KStandardShortcut> | ||
70 | #include <KToggleAction> | 71 | #include <KToggleAction> | ||
71 | #include <KToggleFullScreenAction> | 72 | #include <KToggleFullScreenAction> | ||
73 | #include <KToggleToolBarAction> | ||||
72 | #ifdef WITH_KWALLET | 74 | #ifdef WITH_KWALLET | ||
73 | #include <KWallet> | 75 | #include <KWallet> | ||
74 | #endif | 76 | #endif | ||
75 | #include <KXMLGUIClient> | 77 | #include <KXMLGUIClient> | ||
76 | #include <KXMLGUIFactory> | 78 | #include <KXMLGUIFactory> | ||
77 | 79 | | |||
78 | 80 | | |||
79 | #if PURPOSE_FOUND | 81 | #if PURPOSE_FOUND | ||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 317 | { | |||
442 | // ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList ); | 444 | // ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList ); | ||
443 | connect( m_thumbnailList.data(), &ThumbnailList::rightClick, this, &Part::slotShowMenu ); | 445 | connect( m_thumbnailList.data(), &ThumbnailList::rightClick, this, &Part::slotShowMenu ); | ||
444 | m_sidebar->addItem( thumbsBox, QIcon::fromTheme( QStringLiteral("view-preview") ), i18n("Thumbnails") ); | 446 | m_sidebar->addItem( thumbsBox, QIcon::fromTheme( QStringLiteral("view-preview") ), i18n("Thumbnails") ); | ||
445 | 447 | | |||
446 | m_sidebar->setCurrentItem( thumbsBox ); | 448 | m_sidebar->setCurrentItem( thumbsBox ); | ||
447 | 449 | | |||
448 | // [left toolbox: Reviews] | [] | 450 | // [left toolbox: Reviews] | [] | ||
449 | m_reviewsWidget = new Reviews( nullptr, m_document ); | 451 | m_reviewsWidget = new Reviews( nullptr, m_document ); | ||
450 | m_sidebar->addItem( m_reviewsWidget, QIcon::fromTheme(QStringLiteral("draw-freehand")), i18n("Reviews") ); | 452 | m_sidebar->addItem( m_reviewsWidget, QIcon::fromTheme(QStringLiteral("draw-freehand")), i18n("Annotations") ); | ||
451 | m_sidebar->setItemEnabled( m_reviewsWidget, false ); | 453 | m_sidebar->setItemEnabled( m_reviewsWidget, false ); | ||
452 | 454 | | |||
453 | // [left toolbox: Bookmarks] | [] | 455 | // [left toolbox: Bookmarks] | [] | ||
454 | m_bookmarkList = new BookmarkList( m_document, nullptr ); | 456 | m_bookmarkList = new BookmarkList( m_document, nullptr ); | ||
455 | m_sidebar->addItem( m_bookmarkList, QIcon::fromTheme(QStringLiteral("bookmarks")), i18n("Bookmarks") ); | 457 | m_sidebar->addItem( m_bookmarkList, QIcon::fromTheme(QStringLiteral("bookmarks")), i18n("Bookmarks") ); | ||
456 | m_sidebar->setItemEnabled( m_bookmarkList, false ); | 458 | m_sidebar->setItemEnabled( m_bookmarkList, false ); | ||
457 | 459 | | |||
458 | // [left toolbox: Signature Panel] | [] | 460 | // [left toolbox: Signature Panel] | [] | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 577 | #endif | |||
580 | 582 | | |||
581 | connect( m_document->bookmarkManager(), &BookmarkManager::saved, | 583 | connect( m_document->bookmarkManager(), &BookmarkManager::saved, | ||
582 | this, &Part::slotRebuildBookmarkMenu ); | 584 | this, &Part::slotRebuildBookmarkMenu ); | ||
583 | 585 | | |||
584 | setupViewerActions(); | 586 | setupViewerActions(); | ||
585 | 587 | | |||
586 | if ( m_embedMode != ViewerWidgetMode ) | 588 | if ( m_embedMode != ViewerWidgetMode ) | ||
587 | { | 589 | { | ||
588 | setupActions(); | 590 | KParts::MainWindow * shell = qobject_cast<KParts::MainWindow *>( parent ); | ||
591 | setupActions( shell ); | ||||
589 | } | 592 | } | ||
590 | else | 593 | else | ||
591 | { | 594 | { | ||
592 | setViewerShortcuts(); | 595 | setViewerShortcuts(); | ||
593 | } | 596 | } | ||
594 | 597 | | |||
595 | // document watcher and reloader | 598 | // document watcher and reloader | ||
596 | m_watcher = new KDirWatch( this ); | 599 | m_watcher = new KDirWatch( this ); | ||
▲ Show 20 Lines • Show All 242 Lines • ▼ Show 20 Line(s) | 830 | { | |||
839 | ac->setDefaultShortcut(m_endOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_End)); | 842 | ac->setDefaultShortcut(m_endOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_End)); | ||
840 | 843 | | |||
841 | QAction *action = static_cast<QAction*>( ac->action( QStringLiteral("file_reload") ) ); | 844 | QAction *action = static_cast<QAction*>( ac->action( QStringLiteral("file_reload") ) ); | ||
842 | if (action) { | 845 | if (action) { | ||
843 | ac->setDefaultShortcut(action, QKeySequence(Qt::ALT + Qt::Key_F5)); | 846 | ac->setDefaultShortcut(action, QKeySequence(Qt::ALT + Qt::Key_F5)); | ||
844 | } | 847 | } | ||
845 | } | 848 | } | ||
846 | 849 | | |||
847 | void Part::setupActions() | 850 | void Part::setupActions( KParts::MainWindow * shell ) | ||
848 | { | 851 | { | ||
849 | KActionCollection * ac = actionCollection(); | 852 | KActionCollection * ac = actionCollection(); | ||
850 | 853 | | |||
851 | m_copy = KStandardAction::create( KStandardAction::Copy, m_pageView, SLOT(copyTextSelection()), ac ); | 854 | m_copy = KStandardAction::create( KStandardAction::Copy, m_pageView, SLOT(copyTextSelection()), ac ); | ||
852 | 855 | | |||
853 | m_selectAll = KStandardAction::selectAll( m_pageView, SLOT(selectAll()), ac ); | 856 | m_selectAll = KStandardAction::selectAll( m_pageView, SLOT(selectAll()), ac ); | ||
854 | 857 | | |||
855 | // Setup select all action for the current page | 858 | // Setup select all action for the current page | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 942 | #endif | |||
954 | QAction *configureAnnotations = new QAction( i18n( "Configure Annotations..." ), ac ); | 957 | QAction *configureAnnotations = new QAction( i18n( "Configure Annotations..." ), ac ); | ||
955 | ac->addAction( QStringLiteral("options_configure_annotations"), configureAnnotations ); | 958 | ac->addAction( QStringLiteral("options_configure_annotations"), configureAnnotations ); | ||
956 | configureAnnotations->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) ); | 959 | configureAnnotations->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) ); | ||
957 | connect(configureAnnotations, &QAction::triggered, this, &Part::slotAnnotationPreferences); | 960 | connect(configureAnnotations, &QAction::triggered, this, &Part::slotAnnotationPreferences); | ||
958 | 961 | | |||
959 | QAction *playPauseAction = new QAction( i18n( "Play/Pause Presentation" ), ac ); | 962 | QAction *playPauseAction = new QAction( i18n( "Play/Pause Presentation" ), ac ); | ||
960 | ac->addAction( QStringLiteral("presentation_play_pause"), playPauseAction ); | 963 | ac->addAction( QStringLiteral("presentation_play_pause"), playPauseAction ); | ||
961 | playPauseAction->setEnabled( false ); | 964 | playPauseAction->setEnabled( false ); | ||
965 | | ||||
966 | // force the creation of the main toolbar before the annotation toolbar | ||||
967 | // to respect the default toolbar layout defined in shell.rc | ||||
968 | shell->toolBar( "mainToolBar" ); | ||||
969 | KToggleToolBarAction * showAnnotationToolBar = new KToggleToolBarAction( shell->toolBar( "annotationToolBar" ), i18n("&Annotations"), this ); | ||||
970 | showAnnotationToolBar->setIcon( QIcon::fromTheme( QStringLiteral("draw-freehand") ) ); | ||||
971 | ac->addAction( QStringLiteral("mouse_toggle_annotate"), showAnnotationToolBar ); | ||||
972 | ac->setDefaultShortcut( showAnnotationToolBar, Qt::Key_F6 ); | ||||
962 | } | 973 | } | ||
963 | 974 | | |||
964 | Part::~Part() | 975 | Part::~Part() | ||
965 | { | 976 | { | ||
966 | QDBusConnection::sessionBus().unregisterObject(m_registerDbusName); | 977 | QDBusConnection::sessionBus().unregisterObject(m_registerDbusName); | ||
967 | 978 | | |||
968 | GuiUtils::removeIconLoader( iconLoader() ); | 979 | GuiUtils::removeIconLoader( iconLoader() ); | ||
969 | m_document->removeObserver( this ); | 980 | m_document->removeObserver( this ); | ||
▲ Show 20 Lines • Show All 2756 Lines • Show Last 20 Lines |