Port KAction and KMenu

This commit is contained in:
Vishesh Handa 2014-08-13 12:45:40 +02:00
parent e038950f50
commit 077689c4d3
10 changed files with 72 additions and 73 deletions

View file

@ -61,7 +61,7 @@ KIMGIOGenerator::KIMGIOGenerator( QObject *parent, const QVariantList &args )
setComponentData( *ownComponentData() ); setComponentData( *ownComponentData() );
setXMLFile( "gui.rc" ); setXMLFile( "gui.rc" );
KAction * kimgio_test = new KAction( this ); QAction * kimgio_test = new QAction( this );
kimgio_test->setText( "Image test" ); kimgio_test->setText( "Image test" );
kimgio_test->setIcon( QIcon::fromTheme( "smiley" ) ); kimgio_test->setIcon( QIcon::fromTheme( "smiley" ) );
connect( kimgio_test, SIGNAL(triggered(bool)), this, SLOT(slotTest()) ); connect( kimgio_test, SIGNAL(triggered(bool)), this, SLOT(slotTest()) );

View file

@ -652,7 +652,7 @@ void Part::setupViewerActions()
prefs->setText( i18n( "Configure Viewer..." ) ); prefs->setText( i18n( "Configure Viewer..." ) );
} }
KAction * genPrefs = new KAction( ac ); QAction * genPrefs = new QAction( ac );
ac->addAction("options_configure_generators", genPrefs); ac->addAction("options_configure_generators", genPrefs);
if ( m_embedMode == ViewerWidgetMode ) if ( m_embedMode == ViewerWidgetMode )
{ {
@ -691,7 +691,7 @@ void Part::setupViewerActions()
m_aboutBackend->setEnabled( false ); m_aboutBackend->setEnabled( false );
connect(m_aboutBackend, SIGNAL(triggered()), this, SLOT(slotAboutBackend())); connect(m_aboutBackend, SIGNAL(triggered()), this, SLOT(slotAboutBackend()));
KAction *reload = ac->add<KAction>( "file_reload" ); QAction *reload = ac->add<QAction>( "file_reload" );
reload->setText( i18n( "Reloa&d" ) ); reload->setText( i18n( "Reloa&d" ) );
reload->setIcon( QIcon::fromTheme( "view-refresh" ) ); reload->setIcon( QIcon::fromTheme( "view-refresh" ) );
reload->setWhatsThis( i18n( "Reload the current document from disk." ) ); reload->setWhatsThis( i18n( "Reload the current document from disk." ) );
@ -704,7 +704,8 @@ void Part::setupViewerActions()
m_closeFindBar->setShortcut( QKeySequence(Qt::Key_Escape) ); m_closeFindBar->setShortcut( QKeySequence(Qt::Key_Escape) );
m_closeFindBar->setEnabled( false ); m_closeFindBar->setEnabled( false );
KAction *pageno = new KAction( i18n( "Page Number" ), ac ); QWidgetAction *pageno = new QWidgetAction( ac );
pageno->setText( i18n( "Page Number" ) );
pageno->setDefaultWidget( m_pageNumberTool ); pageno->setDefaultWidget( m_pageNumberTool );
ac->addAction( "page_number", pageno ); ac->addAction( "page_number", pageno );
} }
@ -724,7 +725,7 @@ void Part::setViewerShortcuts()
m_beginningOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_Home ) ); m_beginningOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_Home ) );
m_endOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_End ) ); m_endOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_End ) );
KAction *action = static_cast<KAction*>( ac->action( "file_reload" ) ); QAction *action = static_cast<QAction*>( ac->action( "file_reload" ) );
if( action ) action->setShortcuts( QList<QKeySequence>() << QKeySequence( Qt::ALT + Qt::Key_F5 ) ); if( action ) action->setShortcuts( QList<QKeySequence>() << QKeySequence( Qt::ALT + Qt::Key_F5 ) );
} }
@ -812,17 +813,17 @@ void Part::setupActions()
drawingAction->setIcon( QIcon::fromTheme( "draw-freehand" ) ); drawingAction->setIcon( QIcon::fromTheme( "draw-freehand" ) );
drawingAction->setEnabled( false ); drawingAction->setEnabled( false );
KAction *eraseDrawingAction = new KAction( i18n( "Erase Drawings" ), ac ); QAction *eraseDrawingAction = new QAction( i18n( "Erase Drawings" ), ac );
ac->addAction( "presentation_erase_drawings", eraseDrawingAction ); ac->addAction( "presentation_erase_drawings", eraseDrawingAction );
eraseDrawingAction->setIcon( QIcon::fromTheme( "draw-eraser" ) ); eraseDrawingAction->setIcon( QIcon::fromTheme( "draw-eraser" ) );
eraseDrawingAction->setEnabled( false ); eraseDrawingAction->setEnabled( false );
KAction *configureAnnotations = new KAction( i18n( "Configure Annotations..." ), ac ); QAction *configureAnnotations = new QAction( i18n( "Configure Annotations..." ), ac );
ac->addAction( "options_configure_annotations", configureAnnotations ); ac->addAction( "options_configure_annotations", configureAnnotations );
configureAnnotations->setIcon( QIcon::fromTheme( "configure" ) ); configureAnnotations->setIcon( QIcon::fromTheme( "configure" ) );
connect(configureAnnotations, SIGNAL(triggered()), this, SLOT(slotAnnotationPreferences())); connect(configureAnnotations, SIGNAL(triggered()), this, SLOT(slotAnnotationPreferences()));
KAction *playPauseAction = new KAction( i18n( "Play/Pause Presentation" ), ac ); QAction *playPauseAction = new QAction( i18n( "Play/Pause Presentation" ), ac );
ac->addAction( "presentation_play_pause", playPauseAction ); ac->addAction( "presentation_play_pause", playPauseAction );
playPauseAction->setEnabled( false ); playPauseAction->setEnabled( false );
} }
@ -2392,13 +2393,13 @@ void Part::slotShowMenu(const Okular::Page *page, const QPoint &point)
m_actionsSearched = true; m_actionsSearched = true;
} }
KMenu *popup = new KMenu( widget() ); QMenu *popup = new QMenu( widget() );
QAction *addBookmark = 0; QAction *addBookmark = 0;
QAction *removeBookmark = 0; QAction *removeBookmark = 0;
QAction *fitPageWidth = 0; QAction *fitPageWidth = 0;
if (page) if (page)
{ {
popup->addTitle( i18n( "Page %1", page->number() + 1 ) ); popup->setTitle( i18n( "Page %1", page->number() + 1 ) );
if ( ( !currentPage && m_document->bookmarkManager()->isBookmarked( page->number() ) ) || if ( ( !currentPage && m_document->bookmarkManager()->isBookmarked( page->number() ) ) ||
( currentPage && m_document->bookmarkManager()->isBookmarked( m_document->viewport() ) ) ) ( currentPage && m_document->bookmarkManager()->isBookmarked( m_document->viewport() ) ) )
removeBookmark = popup->addAction( QIcon::fromTheme("edit-delete-bookmark"), i18n("Remove Bookmark") ); removeBookmark = popup->addAction( QIcon::fromTheme("edit-delete-bookmark"), i18n("Remove Bookmark") );
@ -2420,7 +2421,7 @@ void Part::slotShowMenu(const Okular::Page *page, const QPoint &point)
if ((m_showMenuBarAction && !m_showMenuBarAction->isChecked()) || (m_showFullScreenAction && m_showFullScreenAction->isChecked())) if ((m_showMenuBarAction && !m_showMenuBarAction->isChecked()) || (m_showFullScreenAction && m_showFullScreenAction->isChecked()))
{ {
popup->addTitle( i18n( "Tools" ) ); popup->setTitle( i18n( "Tools" ) );
if (m_showMenuBarAction && !m_showMenuBarAction->isChecked()) popup->addAction(m_showMenuBarAction); if (m_showMenuBarAction && !m_showMenuBarAction->isChecked()) popup->addAction(m_showMenuBarAction);
if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) popup->addAction(m_showFullScreenAction); if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) popup->addAction(m_showFullScreenAction);
reallyShow = true; reallyShow = true;
@ -2896,7 +2897,7 @@ void Part::rebuildBookmarkMenu( bool unplugActions )
if ( m_bookmarkActions.isEmpty() ) if ( m_bookmarkActions.isEmpty() )
{ {
havebookmarks = false; havebookmarks = false;
QAction * a = new KAction( 0 ); QAction * a = new QAction( 0 );
a->setText( i18n( "No Bookmarks" ) ); a->setText( i18n( "No Bookmarks" ) );
a->setEnabled( false ); a->setEnabled( false );
m_bookmarkActions.append( a ); m_bookmarkActions.append( a );

5
part.h
View file

@ -48,8 +48,7 @@ class KToggleFullScreenAction;
class KSelectAction; class KSelectAction;
class KAboutData; class KAboutData;
class KTemporaryFile; class KTemporaryFile;
class KAction; class QAction;
class KMenu;
namespace KParts { class GUIActivateEvent; } namespace KParts { class GUIActivateEvent; }
class FindBar; class FindBar;
@ -187,7 +186,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
void slotAddBookmark(); void slotAddBookmark();
void slotRenameBookmarkFromMenu(); void slotRenameBookmarkFromMenu();
void slotRenameCurrentViewportBookmark(); void slotRenameCurrentViewportBookmark();
void slotAboutToShowContextMenu(KMenu *menu, QAction *action, QMenu *contextMenu); void slotAboutToShowContextMenu(QMenu *menu, QAction *action, QMenu *contextMenu);
void slotPreviousBookmark(); void slotPreviousBookmark();
void slotNextBookmark(); void slotNextBookmark();
void slotFindNext(); void slotFindNext();

View file

@ -39,7 +39,7 @@ void AnnotationPopup::exec( const QPoint &point )
if ( mAnnotations.isEmpty() ) if ( mAnnotations.isEmpty() )
return; return;
KMenu menu( mParent ); QMenu menu( mParent );
QAction *action = 0; QAction *action = 0;
Okular::FileAttachmentAnnotation *fileAttachAnnot = 0; Okular::FileAttachmentAnnotation *fileAttachAnnot = 0;
@ -58,7 +58,7 @@ void AnnotationPopup::exec( const QPoint &point )
const AnnotPagePair &pair = mAnnotations.at(0); const AnnotPagePair &pair = mAnnotations.at(0);
menu.addTitle( i18np( "Annotation", "%1 Annotations", mAnnotations.count() ) ); menu.setTitle( i18np( "Annotation", "%1 Annotations", mAnnotations.count() ) );
action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) ); action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) );
action->setData( QVariant::fromValue( pair ) ); action->setData( QVariant::fromValue( pair ) );
@ -95,7 +95,7 @@ void AnnotationPopup::exec( const QPoint &point )
{ {
foreach ( const AnnotPagePair& pair, mAnnotations ) foreach ( const AnnotPagePair& pair, mAnnotations )
{ {
menu.addTitle( GuiUtils::captionForAnnotation( pair.annotation ) ); menu.setTitle( GuiUtils::captionForAnnotation( pair.annotation ) );
action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) ); action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) );
action->setData( QVariant::fromValue( pair ) ); action->setData( QVariant::fromValue( pair ) );

View file

@ -244,7 +244,7 @@ void BookmarkList::contextMenuForBookmarkItem( const QPoint& p, BookmarkItem* bm
if ( !bmItem || !bmItem->viewport().isValid() ) if ( !bmItem || !bmItem->viewport().isValid() )
return; return;
KMenu menu( this ); QMenu menu( this );
QAction * gotobm = menu.addAction( i18n( "Go to This Bookmark" ) ); QAction * gotobm = menu.addAction( i18n( "Go to This Bookmark" ) );
QAction * editbm = menu.addAction( QIcon::fromTheme( "edit-rename" ), i18n( "Rename Bookmark" ) ); QAction * editbm = menu.addAction( QIcon::fromTheme( "edit-rename" ), i18n( "Rename Bookmark" ) );
QAction * removebm = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "Remove Bookmark" ) ); QAction * removebm = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "Remove Bookmark" ) );
@ -269,7 +269,7 @@ void BookmarkList::contextMenuForFileItem( const QPoint& p, FileItem* fItem )
const KUrl itemurl = fItem->data( 0, UrlRole ).value< KUrl >(); const KUrl itemurl = fItem->data( 0, UrlRole ).value< KUrl >();
const bool thisdoc = itemurl == m_document->currentDocument(); const bool thisdoc = itemurl == m_document->currentDocument();
KMenu menu( this ); QMenu menu( this );
QAction * open = 0; QAction * open = 0;
if ( !thisdoc ) if ( !thisdoc )
open = menu.addAction( i18nc( "Opens the selected document", "Open Document" ) ); open = menu.addAction( i18nc( "Opens the selected document", "Open Document" ) );

View file

@ -30,12 +30,12 @@
#include <qtooltip.h> #include <qtooltip.h>
#include <qapplication.h> #include <qapplication.h>
#include <qclipboard.h> #include <qclipboard.h>
#include <qmenu.h>
#include <kaction.h> #include <kaction.h>
#include <kactionmenu.h> #include <kactionmenu.h>
#include <kstandardaction.h> #include <kstandardaction.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kmenu.h>
#include <klocale.h> #include <klocale.h>
#include <kfiledialog.h> #include <kfiledialog.h>
#include <kglobal.h> #include <kglobal.h>
@ -188,16 +188,16 @@ public:
QTimer leftClickTimer; QTimer leftClickTimer;
// actions // actions
KAction * aRotateClockwise; QAction * aRotateClockwise;
KAction * aRotateCounterClockwise; QAction * aRotateCounterClockwise;
KAction * aRotateOriginal; QAction * aRotateOriginal;
KSelectAction * aPageSizes; KSelectAction * aPageSizes;
KToggleAction * aTrimMargins; KToggleAction * aTrimMargins;
KAction * aMouseNormal; QAction * aMouseNormal;
KAction * aMouseSelect; QAction * aMouseSelect;
KAction * aMouseTextSelect; QAction * aMouseTextSelect;
KAction * aMouseTableSelect; QAction * aMouseTableSelect;
KAction * aMouseMagnifier; QAction * aMouseMagnifier;
KToggleAction * aToggleAnnotator; KToggleAction * aToggleAnnotator;
KSelectAction * aZoom; KSelectAction * aZoom;
QAction * aZoomIn; QAction * aZoomIn;
@ -208,10 +208,10 @@ public:
KActionMenu * aViewMode; KActionMenu * aViewMode;
KToggleAction * aViewContinuous; KToggleAction * aViewContinuous;
QAction * aPrevAction; QAction * aPrevAction;
KAction * aToggleForms; QAction * aToggleForms;
KAction * aSpeakDoc; QAction * aSpeakDoc;
KAction * aSpeakPage; QAction * aSpeakPage;
KAction * aSpeakStop; QAction * aSpeakStop;
KActionCollection * actionCollection; KActionCollection * actionCollection;
QActionGroup * mouseModeActionGroup; QActionGroup * mouseModeActionGroup;
@ -450,17 +450,17 @@ void PageView::setupViewerActions( KActionCollection * ac )
d->aZoomOut->setShortcut( QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus) ); d->aZoomOut->setShortcut( QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus) );
// orientation menu actions // orientation menu actions
d->aRotateClockwise = new KAction( QIcon::fromTheme( "object-rotate-right" ), i18n( "Rotate &Right" ), this ); d->aRotateClockwise = new QAction( QIcon::fromTheme( "object-rotate-right" ), i18n( "Rotate &Right" ), this );
d->aRotateClockwise->setIconText( i18nc( "Rotate right", "Right" ) ); d->aRotateClockwise->setIconText( i18nc( "Rotate right", "Right" ) );
ac->addAction( "view_orientation_rotate_cw", d->aRotateClockwise ); ac->addAction( "view_orientation_rotate_cw", d->aRotateClockwise );
d->aRotateClockwise->setEnabled( false ); d->aRotateClockwise->setEnabled( false );
connect( d->aRotateClockwise, SIGNAL(triggered()), this, SLOT(slotRotateClockwise()) ); connect( d->aRotateClockwise, SIGNAL(triggered()), this, SLOT(slotRotateClockwise()) );
d->aRotateCounterClockwise = new KAction( QIcon::fromTheme( "object-rotate-left" ), i18n( "Rotate &Left" ), this ); d->aRotateCounterClockwise = new QAction( QIcon::fromTheme( "object-rotate-left" ), i18n( "Rotate &Left" ), this );
d->aRotateCounterClockwise->setIconText( i18nc( "Rotate left", "Left" ) ); d->aRotateCounterClockwise->setIconText( i18nc( "Rotate left", "Left" ) );
ac->addAction( "view_orientation_rotate_ccw", d->aRotateCounterClockwise ); ac->addAction( "view_orientation_rotate_ccw", d->aRotateCounterClockwise );
d->aRotateCounterClockwise->setEnabled( false ); d->aRotateCounterClockwise->setEnabled( false );
connect( d->aRotateCounterClockwise, SIGNAL(triggered()), this, SLOT(slotRotateCounterClockwise()) ); connect( d->aRotateCounterClockwise, SIGNAL(triggered()), this, SLOT(slotRotateCounterClockwise()) );
d->aRotateOriginal = new KAction( i18n( "Original Orientation" ), this ); d->aRotateOriginal = new QAction( i18n( "Original Orientation" ), this );
ac->addAction( "view_orientation_original", d->aRotateOriginal ); ac->addAction( "view_orientation_original", d->aRotateOriginal );
d->aRotateOriginal->setEnabled( false ); d->aRotateOriginal->setEnabled( false );
connect( d->aRotateOriginal, SIGNAL(triggered()), this, SLOT(slotRotateOriginal()) ); connect( d->aRotateOriginal, SIGNAL(triggered()), this, SLOT(slotRotateOriginal()) );
@ -494,7 +494,8 @@ void PageView::setupViewerActions( KActionCollection * ac )
d->aViewMode->setDelayed( false ); d->aViewMode->setDelayed( false );
#define ADD_VIEWMODE_ACTION( text, name, id ) \ #define ADD_VIEWMODE_ACTION( text, name, id ) \
do { \ do { \
KAction *vm = new KAction( text, d->aViewMode->menu() ); \ QAction *vm = new QAction( text, this ); \
vm->setMenu( d->aViewMode->menu() ); \
vm->setCheckable( true ); \ vm->setCheckable( true ); \
vm->setData( qVariantFromValue( id ) ); \ vm->setData( qVariantFromValue( id ) ); \
d->aViewMode->addAction( vm ); \ d->aViewMode->addAction( vm ); \
@ -502,7 +503,7 @@ do { \
vmGroup->addAction( vm ); \ vmGroup->addAction( vm ); \
} while( 0 ) } while( 0 )
ac->addAction("view_render_mode", d->aViewMode ); ac->addAction("view_render_mode", d->aViewMode );
QActionGroup *vmGroup = new QActionGroup( d->aViewMode->menu() ); QActionGroup *vmGroup = new QActionGroup( this ); //d->aViewMode->menu() );
ADD_VIEWMODE_ACTION( i18n( "Single Page" ), "view_render_mode_single", (int)Okular::Settings::EnumViewMode::Single ); ADD_VIEWMODE_ACTION( i18n( "Single Page" ), "view_render_mode_single", (int)Okular::Settings::EnumViewMode::Single );
ADD_VIEWMODE_ACTION( i18n( "Facing Pages" ), "view_render_mode_facing", (int)Okular::Settings::EnumViewMode::Facing ); ADD_VIEWMODE_ACTION( i18n( "Facing Pages" ), "view_render_mode_facing", (int)Okular::Settings::EnumViewMode::Facing );
ADD_VIEWMODE_ACTION( i18n( "Facing Pages (Center First Page)" ), "view_render_mode_facing_center_first", (int)Okular::Settings::EnumViewMode::FacingFirstCentered ); ADD_VIEWMODE_ACTION( i18n( "Facing Pages (Center First Page)" ), "view_render_mode_facing_center_first", (int)Okular::Settings::EnumViewMode::FacingFirstCentered );
@ -526,7 +527,7 @@ do { \
// Mouse mode actions for viewer mode // Mouse mode actions for viewer mode
d->mouseModeActionGroup = new QActionGroup( this ); d->mouseModeActionGroup = new QActionGroup( this );
d->mouseModeActionGroup->setExclusive( true ); d->mouseModeActionGroup->setExclusive( true );
d->aMouseNormal = new KAction( QIcon::fromTheme( "input-mouse" ), i18n( "&Browse Tool" ), this ); d->aMouseNormal = new QAction( QIcon::fromTheme( "input-mouse" ), i18n( "&Browse Tool" ), this );
ac->addAction("mouse_drag", d->aMouseNormal ); ac->addAction("mouse_drag", d->aMouseNormal );
connect( d->aMouseNormal, SIGNAL(triggered()), this, SLOT(slotSetMouseNormal()) ); connect( d->aMouseNormal, SIGNAL(triggered()), this, SLOT(slotSetMouseNormal()) );
d->aMouseNormal->setIconText( i18nc( "Browse Tool", "Browse" ) ); d->aMouseNormal->setIconText( i18nc( "Browse Tool", "Browse" ) );
@ -535,7 +536,7 @@ do { \
d->aMouseNormal->setActionGroup( d->mouseModeActionGroup ); d->aMouseNormal->setActionGroup( d->mouseModeActionGroup );
d->aMouseNormal->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse ); d->aMouseNormal->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse );
KAction * mz = new KAction(QIcon::fromTheme( "page-zoom" ), i18n("&Zoom Tool"), this); QAction * mz = new QAction(QIcon::fromTheme( "page-zoom" ), i18n("&Zoom Tool"), this);
ac->addAction("mouse_zoom", mz ); ac->addAction("mouse_zoom", mz );
connect( mz, SIGNAL(triggered()), this, SLOT(slotSetMouseZoom()) ); connect( mz, SIGNAL(triggered()), this, SLOT(slotSetMouseZoom()) );
mz->setIconText( i18nc( "Zoom Tool", "Zoom" ) ); mz->setIconText( i18nc( "Zoom Tool", "Zoom" ) );
@ -544,7 +545,7 @@ do { \
mz->setActionGroup( d->mouseModeActionGroup ); mz->setActionGroup( d->mouseModeActionGroup );
mz->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Zoom ); mz->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Zoom );
KAction * aToggleChangeColors = new KAction(i18n("&Toggle Change Colors"), this); QAction * aToggleChangeColors = new QAction(i18n("&Toggle Change Colors"), this);
ac->addAction("toggle_change_colors", aToggleChangeColors ); ac->addAction("toggle_change_colors", aToggleChangeColors );
connect( aToggleChangeColors, SIGNAL(triggered()), this, SLOT(slotToggleChangeColors()) ); connect( aToggleChangeColors, SIGNAL(triggered()), this, SLOT(slotToggleChangeColors()) );
} }
@ -558,7 +559,7 @@ void PageView::setupActions( KActionCollection * ac )
d->aZoomOut->setShortcut( QKeySequence(QKeySequence::ZoomOut) ); d->aZoomOut->setShortcut( QKeySequence(QKeySequence::ZoomOut) );
// Mouse-Mode actions // Mouse-Mode actions
d->aMouseSelect = new KAction(QIcon::fromTheme( "select-rectangular" ), i18n("&Selection Tool"), this); d->aMouseSelect = new QAction(QIcon::fromTheme( "select-rectangular" ), i18n("&Selection Tool"), this);
ac->addAction("mouse_select", d->aMouseSelect ); ac->addAction("mouse_select", d->aMouseSelect );
connect( d->aMouseSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseSelect()) ); connect( d->aMouseSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseSelect()) );
d->aMouseSelect->setIconText( i18nc( "Select Tool", "Selection" ) ); d->aMouseSelect->setIconText( i18nc( "Select Tool", "Selection" ) );
@ -567,7 +568,7 @@ void PageView::setupActions( KActionCollection * ac )
d->aMouseSelect->setActionGroup( d->mouseModeActionGroup ); d->aMouseSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::RectSelect ); d->aMouseSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::RectSelect );
d->aMouseTextSelect = new KAction(QIcon::fromTheme( "draw-text" ), i18n("&Text Selection Tool"), this); d->aMouseTextSelect = new QAction(QIcon::fromTheme( "draw-text" ), i18n("&Text Selection Tool"), this);
ac->addAction("mouse_textselect", d->aMouseTextSelect ); ac->addAction("mouse_textselect", d->aMouseTextSelect );
connect( d->aMouseTextSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseTextSelect()) ); connect( d->aMouseTextSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseTextSelect()) );
d->aMouseTextSelect->setIconText( i18nc( "Text Selection Tool", "Text Selection" ) ); d->aMouseTextSelect->setIconText( i18nc( "Text Selection Tool", "Text Selection" ) );
@ -576,7 +577,7 @@ void PageView::setupActions( KActionCollection * ac )
d->aMouseTextSelect->setActionGroup( d->mouseModeActionGroup ); d->aMouseTextSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTextSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TextSelect ); d->aMouseTextSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TextSelect );
d->aMouseTableSelect = new KAction(QIcon::fromTheme( "table" ), i18n("T&able Selection Tool"), this); d->aMouseTableSelect = new QAction(QIcon::fromTheme( "table" ), i18n("T&able Selection Tool"), this);
ac->addAction("mouse_tableselect", d->aMouseTableSelect ); ac->addAction("mouse_tableselect", d->aMouseTableSelect );
connect( d->aMouseTableSelect, SIGNAL( triggered() ), this, SLOT( slotSetMouseTableSelect() ) ); connect( d->aMouseTableSelect, SIGNAL( triggered() ), this, SLOT( slotSetMouseTableSelect() ) );
d->aMouseTableSelect->setIconText( i18nc( "Table Selection Tool", "Table Selection" ) ); d->aMouseTableSelect->setIconText( i18nc( "Table Selection Tool", "Table Selection" ) );
@ -585,7 +586,7 @@ void PageView::setupActions( KActionCollection * ac )
d->aMouseTableSelect->setActionGroup( d->mouseModeActionGroup ); d->aMouseTableSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTableSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TableSelect ); d->aMouseTableSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TableSelect );
d->aMouseMagnifier = new KAction(QIcon::fromTheme( "document-preview" ), i18n("&Magnifier"), this); d->aMouseMagnifier = new QAction(QIcon::fromTheme( "document-preview" ), i18n("&Magnifier"), this);
ac->addAction("mouse_magnifier", d->aMouseMagnifier ); ac->addAction("mouse_magnifier", d->aMouseMagnifier );
connect( d->aMouseMagnifier, SIGNAL(triggered()), this, SLOT(slotSetMouseMagnifier()) ); connect( d->aMouseMagnifier, SIGNAL(triggered()), this, SLOT(slotSetMouseMagnifier()) );
d->aMouseMagnifier->setIconText( i18nc( "Magnifier Tool", "Magnifier" ) ); d->aMouseMagnifier->setIconText( i18nc( "Magnifier Tool", "Magnifier" ) );
@ -607,47 +608,47 @@ void PageView::setupActions( KActionCollection * ac )
ta->addAction( d->aMouseTableSelect ); ta->addAction( d->aMouseTableSelect );
// speak actions // speak actions
d->aSpeakDoc = new KAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Whole Document" ), this ); d->aSpeakDoc = new QAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Whole Document" ), this );
ac->addAction( "speak_document", d->aSpeakDoc ); ac->addAction( "speak_document", d->aSpeakDoc );
d->aSpeakDoc->setEnabled( false ); d->aSpeakDoc->setEnabled( false );
connect( d->aSpeakDoc, SIGNAL(triggered()), SLOT(slotSpeakDocument()) ); connect( d->aSpeakDoc, SIGNAL(triggered()), SLOT(slotSpeakDocument()) );
d->aSpeakPage = new KAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Current Page" ), this ); d->aSpeakPage = new QAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Current Page" ), this );
ac->addAction( "speak_current_page", d->aSpeakPage ); ac->addAction( "speak_current_page", d->aSpeakPage );
d->aSpeakPage->setEnabled( false ); d->aSpeakPage->setEnabled( false );
connect( d->aSpeakPage, SIGNAL(triggered()), SLOT(slotSpeakCurrentPage()) ); connect( d->aSpeakPage, SIGNAL(triggered()), SLOT(slotSpeakCurrentPage()) );
d->aSpeakStop = new KAction( QIcon::fromTheme( "media-playback-stop" ), i18n( "Stop Speaking" ), this ); d->aSpeakStop = new QAction( QIcon::fromTheme( "media-playback-stop" ), i18n( "Stop Speaking" ), this );
ac->addAction( "speak_stop_all", d->aSpeakStop ); ac->addAction( "speak_stop_all", d->aSpeakStop );
d->aSpeakStop->setEnabled( false ); d->aSpeakStop->setEnabled( false );
connect( d->aSpeakStop, SIGNAL(triggered()), SLOT(slotStopSpeaks()) ); connect( d->aSpeakStop, SIGNAL(triggered()), SLOT(slotStopSpeaks()) );
// Other actions // Other actions
KAction * su = new KAction(i18n("Scroll Up"), this); QAction * su = new QAction(i18n("Scroll Up"), this);
ac->addAction("view_scroll_up", su ); ac->addAction("view_scroll_up", su );
connect( su, SIGNAL(triggered()), this, SLOT(slotAutoScrollUp()) ); connect( su, SIGNAL(triggered()), this, SLOT(slotAutoScrollUp()) );
su->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Up) ); su->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Up) );
addAction(su); addAction(su);
KAction * sd = new KAction(i18n("Scroll Down"), this); QAction * sd = new QAction(i18n("Scroll Down"), this);
ac->addAction("view_scroll_down", sd ); ac->addAction("view_scroll_down", sd );
connect( sd, SIGNAL(triggered()), this, SLOT(slotAutoScrollDown()) ); connect( sd, SIGNAL(triggered()), this, SLOT(slotAutoScrollDown()) );
sd->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Down) ); sd->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Down) );
addAction(sd); addAction(sd);
KAction * spu = new KAction(i18n("Scroll Page Up"), this); QAction * spu = new QAction(i18n("Scroll Page Up"), this);
ac->addAction( "view_scroll_page_up", spu ); ac->addAction( "view_scroll_page_up", spu );
connect( spu, SIGNAL(triggered()), this, SLOT(slotScrollUp()) ); connect( spu, SIGNAL(triggered()), this, SLOT(slotScrollUp()) );
spu->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Space) ); spu->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Space) );
addAction( spu ); addAction( spu );
KAction * spd = new KAction(i18n("Scroll Page Down"), this); QAction * spd = new QAction(i18n("Scroll Page Down"), this);
ac->addAction( "view_scroll_page_down", spd ); ac->addAction( "view_scroll_page_down", spd );
connect( spd, SIGNAL(triggered()), this, SLOT(slotScrollDown()) ); connect( spd, SIGNAL(triggered()), this, SLOT(slotScrollDown()) );
spd->setShortcut( QKeySequence(Qt::Key_Space) ); spd->setShortcut( QKeySequence(Qt::Key_Space) );
addAction( spd ); addAction( spd );
d->aToggleForms = new KAction( this ); d->aToggleForms = new QAction( this );
ac->addAction( "view_toggle_forms", d->aToggleForms ); ac->addAction( "view_toggle_forms", d->aToggleForms );
connect( d->aToggleForms, SIGNAL(triggered()), this, SLOT(slotToggleForms()) ); connect( d->aToggleForms, SIGNAL(triggered()), this, SLOT(slotToggleForms()) );
d->aToggleForms->setEnabled( false ); d->aToggleForms->setEnabled( false );
@ -794,7 +795,7 @@ KActionCollection *PageView::actionCollection() const
return d->actionCollection; return d->actionCollection;
} }
KAction *PageView::toggleFormsAction() const QAction *PageView::toggleFormsAction() const
{ {
return d->aToggleForms; return d->aToggleForms;
} }
@ -2421,7 +2422,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
// handle right click over a link // handle right click over a link
const Okular::Action * link = static_cast< const Okular::Action * >( rect->object() ); const Okular::Action * link = static_cast< const Okular::Action * >( rect->object() );
// creating the menu and its actions // creating the menu and its actions
KMenu menu( this ); QMenu menu( this );
QAction * actProcessLink = menu.addAction( i18n( "Follow This Link" ) ); QAction * actProcessLink = menu.addAction( i18n( "Follow This Link" ) );
QAction * actStopSound = 0; QAction * actStopSound = 0;
if ( link->actionType() == Okular::Action::Sound ) if ( link->actionType() == Okular::Action::Sound )
@ -2573,11 +2574,11 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
} }
// popup that ask to copy:text and copy/save:image // popup that ask to copy:text and copy/save:image
KMenu menu( this ); QMenu menu( this );
QAction *textToClipboard = 0, *speakText = 0, *imageToClipboard = 0, *imageToFile = 0; QAction *textToClipboard = 0, *speakText = 0, *imageToClipboard = 0, *imageToFile = 0;
if ( d->document->supportsSearching() && !selectedText.isEmpty() ) if ( d->document->supportsSearching() && !selectedText.isEmpty() )
{ {
menu.addTitle( i18np( "Text (1 character)", "Text (%1 characters)", selectedText.length() ) ); menu.setTitle( i18np( "Text (1 character)", "Text (%1 characters)", selectedText.length() ) );
textToClipboard = menu.addAction( QIcon::fromTheme("edit-copy"), i18n( "Copy to Clipboard" ) ); textToClipboard = menu.addAction( QIcon::fromTheme("edit-copy"), i18n( "Copy to Clipboard" ) );
bool copyAllowed = d->document->isAllowed( Okular::AllowCopy ); bool copyAllowed = d->document->isAllowed( Okular::AllowCopy );
if ( !copyAllowed ) if ( !copyAllowed )
@ -2592,7 +2593,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
addWebShortcutsMenu( &menu, selectedText ); addWebShortcutsMenu( &menu, selectedText );
} }
} }
menu.addTitle( i18n( "Image (%1 by %2 pixels)", selectionRect.width(), selectionRect.height() ) ); menu.setTitle( i18n( "Image (%1 by %2 pixels)", selectionRect.width(), selectionRect.height() ) );
imageToClipboard = menu.addAction( QIcon::fromTheme("image-x-generic"), i18n( "Copy to Clipboard" ) ); imageToClipboard = menu.addAction( QIcon::fromTheme("image-x-generic"), i18n( "Copy to Clipboard" ) );
imageToFile = menu.addAction( QIcon::fromTheme("document-save"), i18n( "Save to File..." ) ); imageToFile = menu.addAction( QIcon::fromTheme("document-save"), i18n( "Save to File..." ) );
QAction *choice = menu.exec( e->globalPos() ); QAction *choice = menu.exec( e->globalPos() );
@ -2832,7 +2833,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
//if there is text selected in the page //if there is text selected in the page
if (item && (page = item->page())->textSelection()) if (item && (page = item->page())->textSelection())
{ {
KMenu menu( this ); QMenu menu( this );
QAction *textToClipboard = menu.addAction( QIcon::fromTheme( "edit-copy" ), i18n( "Copy Text" ) ); QAction *textToClipboard = menu.addAction( QIcon::fromTheme( "edit-copy" ), i18n( "Copy Text" ) );
QAction *speakText = 0; QAction *speakText = 0;
QAction *httpLink = 0; QAction *httpLink = 0;
@ -4005,7 +4006,7 @@ void PageView::updatePageStep() {
verticalScrollBar()->setPageStep( vs.height() * (100 - Okular::Settings::scrollOverlap()) / 100 ); verticalScrollBar()->setPageStep( vs.height() * (100 - Okular::Settings::scrollOverlap()) / 100 );
} }
void PageView::addWebShortcutsMenu( KMenu * menu, const QString & text ) void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
{ {
#if KDE_IS_VERSION(4,5,70) #if KDE_IS_VERSION(4,5,70)
if ( text.isEmpty() ) if ( text.isEmpty() )
@ -4031,17 +4032,17 @@ void PageView::addWebShortcutsMenu( KMenu * menu, const QString & text )
if ( !searchProviders.isEmpty() ) if ( !searchProviders.isEmpty() )
{ {
KMenu *webShortcutsMenu = new KMenu( menu ); QMenu *webShortcutsMenu = new QMenu( menu );
webShortcutsMenu->setIcon( QIcon::fromTheme( "preferences-web-browser-shortcuts" ) ); webShortcutsMenu->setIcon( QIcon::fromTheme( "preferences-web-browser-shortcuts" ) );
const QString squeezedText = KStringHandler::rsqueeze( searchText, 21 ); const QString squeezedText = KStringHandler::rsqueeze( searchText, 21 );
webShortcutsMenu->setTitle( i18n( "Search for '%1' with", squeezedText ) ); webShortcutsMenu->setTitle( i18n( "Search for '%1' with", squeezedText ) );
KAction *action = 0; QAction *action = 0;
foreach( const QString &searchProvider, searchProviders ) foreach( const QString &searchProvider, searchProviders )
{ {
action = new KAction( searchProvider, webShortcutsMenu ); action = new QAction( searchProvider, webShortcutsMenu );
action->setIcon( QIcon::fromTheme( filterData.iconNameForPreferredSearchProvider( searchProvider ) ) ); action->setIcon( QIcon::fromTheme( filterData.iconNameForPreferredSearchProvider( searchProvider ) ) );
action->setData( filterData.queryForPreferredSearchProvider( searchProvider ) ); action->setData( filterData.queryForPreferredSearchProvider( searchProvider ) );
connect( action, SIGNAL(triggered()), this, SLOT(slotHandleWebShortcutAction()) ); connect( action, SIGNAL(triggered()), this, SLOT(slotHandleWebShortcutAction()) );
@ -4050,7 +4051,7 @@ void PageView::addWebShortcutsMenu( KMenu * menu, const QString & text )
webShortcutsMenu->addSeparator(); webShortcutsMenu->addSeparator();
action = new KAction( i18n( "Configure Web Shortcuts..." ), webShortcutsMenu ); action = new QAction( i18n( "Configure Web Shortcuts..." ), webShortcutsMenu );
action->setIcon( QIcon::fromTheme( "configure" ) ); action->setIcon( QIcon::fromTheme( "configure" ) );
connect( action, SIGNAL(triggered()), this, SLOT(slotConfigureWebShortcuts()) ); connect( action, SIGNAL(triggered()), this, SLOT(slotConfigureWebShortcuts()) );
webShortcutsMenu->addAction( action ); webShortcutsMenu->addAction( action );
@ -4551,7 +4552,7 @@ void PageView::slotShowSizeAllCursor()
void PageView::slotHandleWebShortcutAction() void PageView::slotHandleWebShortcutAction()
{ {
#if KDE_IS_VERSION(4,5,70) #if KDE_IS_VERSION(4,5,70)
KAction *action = qobject_cast<KAction*>( sender() ); QAction *action = qobject_cast<QAction*>( sender() );
if (action) if (action)
{ {

View file

@ -27,9 +27,7 @@
#include "core/observer.h" #include "core/observer.h"
#include "core/view.h" #include "core/view.h"
class KAction;
class KActionCollection; class KActionCollection;
class KMenu;
namespace Okular { namespace Okular {
class Action; class Action;
@ -97,7 +95,7 @@ Q_OBJECT
void reparseConfig(); void reparseConfig();
KActionCollection *actionCollection() const; KActionCollection *actionCollection() const;
KAction *toggleFormsAction() const; QAction *toggleFormsAction() const;
int contentAreaWidth() const; int contentAreaWidth() const;
int contentAreaHeight() const; int contentAreaHeight() const;
@ -182,7 +180,7 @@ Q_OBJECT
void resizeContentArea( const QSize & newSize ); void resizeContentArea( const QSize & newSize );
void updatePageStep(); void updatePageStep();
void addWebShortcutsMenu( KMenu * menu, const QString & text ); void addWebShortcutsMenu( QMenu * menu, const QString & text );
// used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view // used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view
void scrollPosIntoView( const QPoint & pos ); void scrollPosIntoView( const QPoint & pos );

View file

@ -701,8 +701,8 @@ void Sidebar::saveSplitterSize() const
void Sidebar::listContextMenu( const QPoint &pos ) void Sidebar::listContextMenu( const QPoint &pos )
{ {
KMenu menu( this ); QMenu menu( this );
menu.addTitle( i18n( "Okular" ) ); menu.setTitle( i18n( "Okular" ) );
QAction *showTextAct = menu.addAction( i18n( "Show Text" ) ); QAction *showTextAct = menu.addAction( i18n( "Show Text" ) );
showTextAct->setCheckable( true ); showTextAct->setCheckable( true );
showTextAct->setChecked( d->sideDelegate->isTextShown() ); showTextAct->setChecked( d->sideDelegate->isTextShown() );

View file

@ -16,7 +16,7 @@
#include <klocale.h> #include <klocale.h>
ToolAction::ToolAction( QObject *parent ) ToolAction::ToolAction( QObject *parent )
: KAction( parent ) : QAction( parent )
{ {
setText( i18n( "Selection Tools" ) ); setText( i18n( "Selection Tools" ) );
} }

View file

@ -17,7 +17,7 @@
class QToolButton; class QToolButton;
class ToolAction : public KAction class ToolAction : public QAction
{ {
Q_OBJECT Q_OBJECT