Commit 48300404 authored by Lukáš Tinkl's avatar Lukáš Tinkl
Browse files

replace deprecated QAction::setShortcut with KStandardShortcut

parent fc13e5c1
......@@ -558,7 +558,7 @@ void Part::setupViewerActions()
// Page Traversal actions
m_gotoPage = KStandardAction::gotoPage( this, SLOT(slotGoToPage()), ac );
m_gotoPage->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_G) );
ac->setDefaultShortcuts(m_gotoPage, KStandardShortcut::gotoLine());
// dirty way to activate gotopage when pressing miniBar's button
connect( m_miniBar, SIGNAL(gotoPage()), m_gotoPage, SLOT(trigger()) );
connect( m_pageNumberTool, SIGNAL(gotoPage()), m_gotoPage, SLOT(trigger()) );
......@@ -567,7 +567,7 @@ void Part::setupViewerActions()
m_prevPage->setIconText( i18nc( "Previous page", "Previous" ) );
m_prevPage->setToolTip( i18n( "Go back to the Previous Page" ) );
m_prevPage->setWhatsThis( i18n( "Moves to the previous page of the document" ) );
m_prevPage->setShortcut( 0 );
ac->setDefaultShortcuts(m_prevPage, KStandardShortcut::prior());
// dirty way to activate prev page when pressing miniBar's button
connect( m_miniBar, SIGNAL(prevPage()), m_prevPage, SLOT(trigger()) );
connect( m_pageNumberTool, SIGNAL(prevPage()), m_prevPage, SLOT(trigger()) );
......@@ -579,7 +579,7 @@ void Part::setupViewerActions()
m_nextPage->setIconText( i18nc( "Next page", "Next" ) );
m_nextPage->setToolTip( i18n( "Advance to the Next Page" ) );
m_nextPage->setWhatsThis( i18n( "Moves to the next page of the document" ) );
m_nextPage->setShortcut( 0 );
ac->setDefaultShortcuts(m_nextPage, KStandardShortcut::next());
// dirty way to activate next page when pressing miniBar's button
connect( m_miniBar, SIGNAL(nextPage()), m_nextPage, SLOT(trigger()) );
connect( m_pageNumberTool, SIGNAL(nextPage()), m_nextPage, SLOT(trigger()) );
......@@ -631,7 +631,7 @@ void Part::setupViewerActions()
m_find = KStandardAction::find( this, SLOT(slotShowFindBar()), ac );
QList<QKeySequence> s = m_find->shortcuts();
s.append( QKeySequence( Qt::Key_Slash ) );
m_find->setShortcuts( s );
ac->setDefaultShortcuts(m_find, s);
m_find->setEnabled( false );
m_findNext = KStandardAction::findNext( this, SLOT(slotFindNext()), ac);
......@@ -698,12 +698,12 @@ void Part::setupViewerActions()
reload->setIcon( QIcon::fromTheme( "view-refresh" ) );
reload->setWhatsThis( i18n( "Reload the current document from disk." ) );
connect( reload, SIGNAL(triggered()), this, SLOT(slotReload()) );
reload->setShortcut( QKeySequence(QKeySequence::Refresh) );
ac->setDefaultShortcuts(reload, KStandardShortcut::reload());
m_reload = reload;
m_closeFindBar = ac->addAction( "close_find_bar", this, SLOT(slotHideFindBar()) );
m_closeFindBar->setText( i18n("Close &Find Bar") );
m_closeFindBar->setShortcut( QKeySequence(Qt::Key_Escape) );
ac->setDefaultShortcut(m_closeFindBar, QKeySequence(Qt::Key_Escape));
m_closeFindBar->setEnabled( false );
QWidgetAction *pageno = new QWidgetAction( ac );
......@@ -716,19 +716,21 @@ void Part::setViewerShortcuts()
{
KActionCollection * ac = actionCollection();
m_gotoPage->setShortcut( QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_G) );
m_find->setShortcuts( QList<QKeySequence>() );
ac->setDefaultShortcut(m_gotoPage, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_G));
ac->setDefaultShortcut(m_find, QKeySequence());
m_findNext->setShortcut( QKeySequence() );
m_findPrev->setShortcut( QKeySequence() );
ac->setDefaultShortcut(m_findNext, QKeySequence());
ac->setDefaultShortcut(m_findPrev, QKeySequence());
m_addBookmark->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_B ) );
ac->setDefaultShortcut(m_addBookmark, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_B));
m_beginningOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_Home ) );
m_endOfDocument->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_End ) );
ac->setDefaultShortcut(m_beginningOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Home));
ac->setDefaultShortcut(m_endOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_End));
QAction *action = static_cast<QAction*>( ac->action( "file_reload" ) );
if( action ) action->setShortcuts( QList<QKeySequence>() << QKeySequence( Qt::ALT + Qt::Key_F5 ) );
if (action) {
ac->setDefaultShortcut(action, QKeySequence(Qt::ALT + Qt::Key_F5));
}
}
void Part::setupActions()
......@@ -742,8 +744,8 @@ void Part::setupActions()
m_saveCopyAs = KStandardAction::saveAs( this, SLOT(slotSaveCopyAs()), ac );
m_saveCopyAs->setText( i18n( "Save &Copy As..." ) );
m_saveCopyAs->setShortcut( QKeySequence(QKeySequence::SaveAs) );
ac->addAction( "file_save_copy", m_saveCopyAs );
ac->setDefaultShortcuts(m_saveCopyAs, KStandardShortcut::shortcut(KStandardShortcut::SaveAs));
m_saveCopyAs->setEnabled( false );
m_saveAs = KStandardAction::saveAs( this, SLOT(slotSaveFileAs()), ac );
......@@ -753,7 +755,7 @@ void Part::setupActions()
m_showLeftPanel->setText(i18n( "Show &Navigation Panel"));
m_showLeftPanel->setIcon(QIcon::fromTheme( "view-sidetree" ));
connect( m_showLeftPanel, SIGNAL(toggled(bool)), this, SLOT(slotShowLeftPanel()) );
m_showLeftPanel->setShortcut( Qt::Key_F7 );
ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7));
m_showLeftPanel->setChecked( Okular::Settings::showLeftPanel() );
slotShowLeftPanel();
......@@ -789,7 +791,7 @@ void Part::setupActions()
m_showPresentation->setText(i18n("P&resentation"));
m_showPresentation->setIcon( QIcon::fromTheme( "view-presentation" ) );
connect(m_showPresentation, SIGNAL(triggered()), this, SLOT(slotShowPresentation()));
m_showPresentation->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) );
ac->setDefaultShortcut(m_showPresentation, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P));
m_showPresentation->setEnabled( false );
QAction * importPS = ac->addAction("import_ps");
......@@ -801,13 +803,11 @@ void Part::setupActions()
ghns->setText(i18n("&Get Books From Internet..."));
ghns->setIcon(QIcon::fromTheme("get-hot-new-stuff"));
connect(ghns, SIGNAL(triggered()), this, SLOT(slotGetNewStuff()));
// TEMP, REMOVE ME!
ghns->setShortcut( Qt::Key_G );
#endif
KToggleAction *blackscreenAction = new KToggleAction( i18n( "Switch Blackscreen Mode" ), ac );
ac->addAction( "switch_blackscreen_mode", blackscreenAction );
blackscreenAction->setShortcut( QKeySequence( Qt::Key_B ) );
ac->setDefaultShortcut(blackscreenAction, QKeySequence(Qt::Key_B));
blackscreenAction->setIcon( QIcon::fromTheme( "view-presentation" ) );
blackscreenAction->setEnabled( false );
......
......@@ -307,13 +307,13 @@ void Shell::setupActions()
m_nextTabAction = actionCollection()->addAction("tab-next");
m_nextTabAction->setText( i18n("Next Tab") );
m_nextTabAction->setShortcut( QKeySequence(QKeySequence::NextChild) );
actionCollection()->setDefaultShortcuts(m_nextTabAction, KStandardShortcut::tabNext());
m_nextTabAction->setEnabled( false );
connect( m_nextTabAction, SIGNAL(triggered()), this, SLOT(activateNextTab()) );
m_prevTabAction = actionCollection()->addAction("tab-previous");
m_prevTabAction->setText( i18n("Previous Tab") );
m_prevTabAction->setShortcut( QKeySequence(QKeySequence::PreviousChild) );
actionCollection()->setDefaultShortcuts(m_prevTabAction, KStandardShortcut::tabPrev());
m_prevTabAction->setEnabled( false );
connect( m_prevTabAction, SIGNAL(triggered()), this, SLOT(activatePrevTab()) );
}
......
......@@ -448,8 +448,8 @@ void PageView::setupViewerActions( KActionCollection * ac )
{
d->actionCollection = ac;
d->aZoomIn->setShortcut( QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Plus) );
d->aZoomOut->setShortcut( QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus) );
ac->setDefaultShortcut(d->aZoomIn, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Plus));
ac->setDefaultShortcut(d->aZoomOut, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus));
// orientation menu actions
d->aRotateClockwise = new QAction( QIcon::fromTheme( "object-rotate-right" ), i18n( "Rotate &Right" ), this );
......@@ -534,7 +534,7 @@ do { \
connect( d->aMouseNormal, SIGNAL(triggered()), this, SLOT(slotSetMouseNormal()) );
d->aMouseNormal->setIconText( i18nc( "Browse Tool", "Browse" ) );
d->aMouseNormal->setCheckable( true );
d->aMouseNormal->setShortcut( Qt::CTRL + Qt::Key_1 );
ac->setDefaultShortcut(d->aMouseNormal, QKeySequence(Qt::CTRL + Qt::Key_1));
d->aMouseNormal->setActionGroup( d->mouseModeActionGroup );
d->aMouseNormal->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse );
......@@ -543,7 +543,7 @@ do { \
connect( mz, SIGNAL(triggered()), this, SLOT(slotSetMouseZoom()) );
mz->setIconText( i18nc( "Zoom Tool", "Zoom" ) );
mz->setCheckable( true );
mz->setShortcut( Qt::CTRL + Qt::Key_2 );
ac->setDefaultShortcut(mz, QKeySequence(Qt::CTRL + Qt::Key_2));
mz->setActionGroup( d->mouseModeActionGroup );
mz->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Zoom );
......@@ -557,8 +557,8 @@ void PageView::setupActions( KActionCollection * ac )
{
d->actionCollection = ac;
d->aZoomIn->setShortcut( QKeySequence(QKeySequence::ZoomIn) );
d->aZoomOut->setShortcut( QKeySequence(QKeySequence::ZoomOut) );
ac->setDefaultShortcuts(d->aZoomIn, KStandardShortcut::zoomIn());
ac->setDefaultShortcuts(d->aZoomOut, KStandardShortcut::zoomOut());
// Mouse-Mode actions
d->aMouseSelect = new QAction(QIcon::fromTheme( "select-rectangular" ), i18n("&Selection Tool"), this);
......@@ -566,7 +566,8 @@ void PageView::setupActions( KActionCollection * ac )
connect( d->aMouseSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseSelect()) );
d->aMouseSelect->setIconText( i18nc( "Select Tool", "Selection" ) );
d->aMouseSelect->setCheckable( true );
d->aMouseSelect->setShortcut( Qt::CTRL + Qt::Key_3 );
ac->setDefaultShortcut(d->aMouseSelect, Qt::CTRL + Qt::Key_3);
d->aMouseSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::RectSelect );
......@@ -575,7 +576,7 @@ void PageView::setupActions( KActionCollection * ac )
connect( d->aMouseTextSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseTextSelect()) );
d->aMouseTextSelect->setIconText( i18nc( "Text Selection Tool", "Text Selection" ) );
d->aMouseTextSelect->setCheckable( true );
d->aMouseTextSelect->setShortcut( Qt::CTRL + Qt::Key_4 );
ac->setDefaultShortcut(d->aMouseTextSelect, Qt::CTRL + Qt::Key_4);
d->aMouseTextSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTextSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TextSelect );
......@@ -584,7 +585,7 @@ void PageView::setupActions( KActionCollection * ac )
connect( d->aMouseTableSelect, SIGNAL( triggered() ), this, SLOT( slotSetMouseTableSelect() ) );
d->aMouseTableSelect->setIconText( i18nc( "Table Selection Tool", "Table Selection" ) );
d->aMouseTableSelect->setCheckable( true );
d->aMouseTableSelect->setShortcut( Qt::CTRL + Qt::Key_5 );
ac->setDefaultShortcut(d->aMouseTableSelect, Qt::CTRL + Qt::Key_5);
d->aMouseTableSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTableSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TableSelect );
......@@ -593,7 +594,7 @@ void PageView::setupActions( KActionCollection * ac )
connect( d->aMouseMagnifier, SIGNAL(triggered()), this, SLOT(slotSetMouseMagnifier()) );
d->aMouseMagnifier->setIconText( i18nc( "Magnifier Tool", "Magnifier" ) );
d->aMouseMagnifier->setCheckable( true );
d->aMouseMagnifier->setShortcut( Qt::CTRL + Qt::Key_6 );
ac->setDefaultShortcut(d->aMouseMagnifier, Qt::CTRL + Qt::Key_6);
d->aMouseMagnifier->setActionGroup( d->mouseModeActionGroup );
d->aMouseMagnifier->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Magnifier );
......@@ -601,7 +602,7 @@ void PageView::setupActions( KActionCollection * ac )
ac->addAction("mouse_toggle_annotate", d->aToggleAnnotator );
d->aToggleAnnotator->setCheckable( true );
connect( d->aToggleAnnotator, SIGNAL(toggled(bool)), SLOT(slotToggleAnnotator(bool)) );
d->aToggleAnnotator->setShortcut( Qt::Key_F6 );
ac->setDefaultShortcut(d->aToggleAnnotator, Qt::Key_F6);
ToolAction *ta = new ToolAction( this );
ac->addAction( "mouse_selecttools", ta );
......@@ -629,25 +630,25 @@ void PageView::setupActions( KActionCollection * ac )
QAction * su = new QAction(i18n("Scroll Up"), this);
ac->addAction("view_scroll_up", su );
connect( su, SIGNAL(triggered()), this, SLOT(slotAutoScrollUp()) );
su->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Up) );
ac->setDefaultShortcut(su, QKeySequence(Qt::SHIFT + Qt::Key_Up));
addAction(su);
QAction * sd = new QAction(i18n("Scroll Down"), this);
ac->addAction("view_scroll_down", sd );
connect( sd, SIGNAL(triggered()), this, SLOT(slotAutoScrollDown()) );
sd->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Down) );
ac->setDefaultShortcut(sd, QKeySequence(Qt::SHIFT + Qt::Key_Down));
addAction(sd);
QAction * spu = new QAction(i18n("Scroll Page Up"), this);
ac->addAction( "view_scroll_page_up", spu );
connect( spu, SIGNAL(triggered()), this, SLOT(slotScrollUp()) );
spu->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Space) );
ac->setDefaultShortcut(spu, QKeySequence(Qt::SHIFT + Qt::Key_Space));
addAction( spu );
QAction * spd = new QAction(i18n("Scroll Page Down"), this);
ac->addAction( "view_scroll_page_down", spd );
connect( spd, SIGNAL(triggered()), this, SLOT(slotScrollDown()) );
spd->setShortcut( QKeySequence(Qt::Key_Space) );
ac->setDefaultShortcut(spd, QKeySequence(Qt::Key_Space));
addAction( spd );
d->aToggleForms = new QAction( this );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment