Changeset View
Changeset View
Standalone View
Standalone View
part.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
54 | #include <KBookmarkAction> | 54 | #include <KBookmarkAction> | ||
55 | #include <KBookmarkMenu> | 55 | #include <KBookmarkMenu> | ||
56 | #include <Kdelibs4ConfigMigrator> | 56 | #include <Kdelibs4ConfigMigrator> | ||
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 <KJobWidgets> | 63 | #include <KJobWidgets> | ||
63 | #include <KMessageBox> | 64 | #include <KMessageBox> | ||
64 | #include <KPasswordDialog> | 65 | #include <KPasswordDialog> | ||
65 | #include <KPluginFactory> | 66 | #include <KPluginFactory> | ||
66 | #include <KPluginMetaData> | 67 | #include <KPluginMetaData> | ||
67 | #include <KSharedDataCache> | 68 | #include <KSharedDataCache> | ||
68 | #include <KStandardShortcut> | 69 | #include <KStandardShortcut> | ||
69 | #include <KToggleAction> | 70 | #include <KToggleAction> | ||
▲ Show 20 Lines • Show All 662 Lines • ▼ Show 20 Line(s) | 683 | #endif | |||
732 | m_findNext = KStandardAction::findNext( this, SLOT(slotFindNext()), ac); | 733 | m_findNext = KStandardAction::findNext( this, SLOT(slotFindNext()), ac); | ||
733 | m_findNext->setEnabled( false ); | 734 | m_findNext->setEnabled( false ); | ||
734 | 735 | | |||
735 | m_findPrev = KStandardAction::findPrev( this, SLOT(slotFindPrev()), ac ); | 736 | m_findPrev = KStandardAction::findPrev( this, SLOT(slotFindPrev()), ac ); | ||
736 | m_findPrev->setEnabled( false ); | 737 | m_findPrev->setEnabled( false ); | ||
737 | 738 | | |||
738 | m_save = nullptr; | 739 | m_save = nullptr; | ||
739 | m_saveAs = nullptr; | 740 | m_saveAs = nullptr; | ||
741 | m_openContainingFolder = nullptr; | ||||
740 | 742 | | |||
741 | QAction * prefs = KStandardAction::preferences( this, SLOT(slotPreferences()), ac); | 743 | QAction * prefs = KStandardAction::preferences( this, SLOT(slotPreferences()), ac); | ||
742 | if ( m_embedMode == NativeShellMode ) | 744 | if ( m_embedMode == NativeShellMode ) | ||
743 | { | 745 | { | ||
744 | prefs->setText( i18n( "Configure Okular..." ) ); | 746 | prefs->setText( i18n( "Configure Okular..." ) ); | ||
745 | } | 747 | } | ||
746 | else | 748 | else | ||
747 | { | 749 | { | ||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 909 | #endif | |||
908 | 910 | | |||
909 | m_showPresentation = ac->addAction(QStringLiteral("presentation")); | 911 | m_showPresentation = ac->addAction(QStringLiteral("presentation")); | ||
910 | m_showPresentation->setText(i18n("P&resentation")); | 912 | m_showPresentation->setText(i18n("P&resentation")); | ||
911 | m_showPresentation->setIcon( QIcon::fromTheme( QStringLiteral("view-presentation") ) ); | 913 | m_showPresentation->setIcon( QIcon::fromTheme( QStringLiteral("view-presentation") ) ); | ||
912 | connect(m_showPresentation, &QAction::triggered, this, &Part::slotShowPresentation); | 914 | connect(m_showPresentation, &QAction::triggered, this, &Part::slotShowPresentation); | ||
913 | ac->setDefaultShortcut(m_showPresentation, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P)); | 915 | ac->setDefaultShortcut(m_showPresentation, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P)); | ||
914 | m_showPresentation->setEnabled( false ); | 916 | m_showPresentation->setEnabled( false ); | ||
915 | 917 | | |||
918 | m_openContainingFolder = ac->addAction(QStringLiteral("open_containing_folder")); | ||||
919 | m_openContainingFolder->setText(i18n("Open Con&taining Folder")); | ||||
920 | m_openContainingFolder->setIcon( QIcon::fromTheme( QStringLiteral("document-open-folder") ) ); | ||||
921 | connect(m_openContainingFolder, &QAction::triggered, this, &Part::slotOpenContainingFolder); | ||||
922 | m_openContainingFolder->setEnabled( false ); | ||||
923 | | ||||
916 | QAction * importPS = ac->addAction(QStringLiteral("import_ps")); | 924 | QAction * importPS = ac->addAction(QStringLiteral("import_ps")); | ||
917 | importPS->setText(i18n("&Import PostScript as PDF...")); | 925 | importPS->setText(i18n("&Import PostScript as PDF...")); | ||
918 | importPS->setIcon(QIcon::fromTheme(QStringLiteral("document-import"))); | 926 | importPS->setIcon(QIcon::fromTheme(QStringLiteral("document-import"))); | ||
919 | connect(importPS, &QAction::triggered, this, &Part::slotImportPSFile); | 927 | connect(importPS, &QAction::triggered, this, &Part::slotImportPSFile); | ||
920 | #if 0 | 928 | #if 0 | ||
921 | QAction * ghns = ac->addAction("get_new_stuff"); | 929 | QAction * ghns = ac->addAction("get_new_stuff"); | ||
922 | ghns->setText(i18n("&Get Books From Internet...")); | 930 | ghns->setText(i18n("&Get Books From Internet...")); | ||
923 | ghns->setIcon(QIcon::fromTheme("get-hot-new-stuff")); | 931 | ghns->setIcon(QIcon::fromTheme("get-hot-new-stuff")); | ||
▲ Show 20 Lines • Show All 642 Lines • ▼ Show 20 Line(s) | 1521 | { | |||
1566 | m_find->setEnabled( ok && canSearch ); | 1574 | m_find->setEnabled( ok && canSearch ); | ||
1567 | m_findNext->setEnabled( ok && canSearch ); | 1575 | m_findNext->setEnabled( ok && canSearch ); | ||
1568 | m_findPrev->setEnabled( ok && canSearch ); | 1576 | m_findPrev->setEnabled( ok && canSearch ); | ||
1569 | if( m_save ) m_save->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) ); | 1577 | if( m_save ) m_save->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) ); | ||
1570 | if( m_saveAs ) m_saveAs->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) ); | 1578 | if( m_saveAs ) m_saveAs->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) ); | ||
1571 | emit enablePrintAction( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); | 1579 | emit enablePrintAction( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); | ||
1572 | m_printPreview->setEnabled( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); | 1580 | m_printPreview->setEnabled( ok && m_document->printingSupport() != Okular::Document::NoPrinting ); | ||
1573 | m_showProperties->setEnabled( ok ); | 1581 | m_showProperties->setEnabled( ok ); | ||
1582 | if( m_openContainingFolder ) m_openContainingFolder->setEnabled( ok ); | ||||
1574 | bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0; | 1583 | bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0; | ||
1575 | if ( m_showEmbeddedFiles ) m_showEmbeddedFiles->setEnabled( hasEmbeddedFiles ); | 1584 | if ( m_showEmbeddedFiles ) m_showEmbeddedFiles->setEnabled( hasEmbeddedFiles ); | ||
1576 | m_topMessage->setVisible( hasEmbeddedFiles && Okular::Settings::showOSD() ); | 1585 | m_topMessage->setVisible( hasEmbeddedFiles && Okular::Settings::showOSD() ); | ||
1577 | m_migrationMessage->setVisible( m_document->isDocdataMigrationNeeded() ); | 1586 | m_migrationMessage->setVisible( m_document->isDocdataMigrationNeeded() ); | ||
1578 | 1587 | | |||
1579 | // Warn the user that XFA forms are not supported yet (NOTE: poppler generator only) | 1588 | // Warn the user that XFA forms are not supported yet (NOTE: poppler generator only) | ||
1580 | if ( ok && m_document->metaData( QStringLiteral("HasUnsupportedXfaForm") ).toBool() == true ) | 1589 | if ( ok && m_document->metaData( QStringLiteral("HasUnsupportedXfaForm") ).toBool() == true ) | ||
1581 | { | 1590 | { | ||
▲ Show 20 Lines • Show All 2111 Lines • ▼ Show 20 Line(s) | 3700 | { | |||
3693 | ReadWritePart::setReadWrite( readwrite ); | 3702 | ReadWritePart::setReadWrite( readwrite ); | ||
3694 | } | 3703 | } | ||
3695 | 3704 | | |||
3696 | void Part::enableStartWithFind(const QString &text) | 3705 | void Part::enableStartWithFind(const QString &text) | ||
3697 | { | 3706 | { | ||
3698 | m_textToFindOnOpen = QString(text); | 3707 | m_textToFindOnOpen = QString(text); | ||
3699 | } | 3708 | } | ||
3700 | 3709 | | |||
3710 | void Part::slotOpenContainingFolder() | ||||
3711 | { | ||||
3712 | KIO::highlightInFileManager( { QUrl(localFilePath()) } ); | ||||
davidhurka: Did someone test this with an encrypted PDF file? | |||||
Encrypted files are just files, why would they be any different? Anyhow https://gitlab.freedesktop.org/poppler/test/raw/master/unittestcases/PasswordEncrypted.pdf?inline=false + "password" if you feel like testing it aacid: Encrypted files are just files, why would they be any different?
Anyhow https://gitlab. | |||||
3713 | } | ||||
3714 | | ||||
3701 | } // namespace Okular | 3715 | } // namespace Okular | ||
3702 | 3716 | | |||
3703 | #include "part.moc" | 3717 | #include "part.moc" | ||
3704 | 3718 | | |||
3705 | /* kate: replace-tabs on; indent-width 4; */ | 3719 | /* kate: replace-tabs on; indent-width 4; */ |
Did someone test this with an encrypted PDF file?