Fix Tools->review inconsistency when switching tool

BUGS: 304621
FIXED-IN: 4.9.1
(cherry picked from commit a2dd088ebd)
remotes/origin/KDE/4.10
Sandro Mani 14 years ago committed by Albert Astals Cid
parent 6d011cd2f0
commit 56dd5278d2
  1. 35
      ui/pageview.cpp
  2. 12
      ui/pageviewannotator.cpp
  3. 4
      ui/pageviewannotator.h

@ -4234,9 +4234,9 @@ void PageView::slotSetMouseNormal()
Okular::Settings::setMouseMode( Okular::Settings::EnumMouseMode::Browse );
// hide the messageWindow
d->messageWindow->hide();
// reshow the annotator toolbar if hiding was forced
if ( d->aToggleAnnotator && d->aToggleAnnotator->isChecked() )
slotToggleAnnotator( true );
// reshow the annotator toolbar if hiding was forced (and if it is not already visible)
if ( d->annotator && d->annotator->hidingWasForced() && d->aToggleAnnotator && !d->aToggleAnnotator->isChecked() )
d->aToggleAnnotator->trigger();
// force an update of the cursor
updateCursor( contentAreaPosition() + viewport()->mapFromGlobal( QCursor::pos() ) );
Okular::Settings::self()->writeConfig();
@ -4248,8 +4248,11 @@ void PageView::slotSetMouseZoom()
// change the text in messageWindow (and show it if hidden)
d->messageWindow->display( i18n( "Select zooming area. Right-click to zoom out." ), QString(), PageViewMessage::Info, -1 );
// force hiding of annotator toolbar
if ( d->annotator )
d->annotator->setEnabled( false );
if ( d->aToggleAnnotator && d->aToggleAnnotator->isChecked() )
{
d->aToggleAnnotator->trigger();
d->annotator->setHidingForced( true );
}
// force an update of the cursor
updateCursor( contentAreaPosition() + viewport()->mapFromGlobal( QCursor::pos() ) );
Okular::Settings::self()->writeConfig();
@ -4261,8 +4264,11 @@ void PageView::slotSetMouseSelect()
// change the text in messageWindow (and show it if hidden)
d->messageWindow->display( i18n( "Draw a rectangle around the text/graphics to copy." ), QString(), PageViewMessage::Info, -1 );
// force hiding of annotator toolbar
if ( d->annotator )
d->annotator->setEnabled( false );
if ( d->aToggleAnnotator && d->aToggleAnnotator->isChecked() )
{
d->aToggleAnnotator->trigger();
d->annotator->setHidingForced( true );
}
// force an update of the cursor
updateCursor( contentAreaPosition() + viewport()->mapFromGlobal( QCursor::pos() ) );
Okular::Settings::self()->writeConfig();
@ -4274,8 +4280,11 @@ void PageView::slotSetMouseTextSelect()
// change the text in messageWindow (and show it if hidden)
d->messageWindow->display( i18n( "Select text" ), QString(), PageViewMessage::Info, -1 );
// force hiding of annotator toolbar
if ( d->annotator )
d->annotator->setEnabled( false );
if ( d->aToggleAnnotator && d->aToggleAnnotator->isChecked() )
{
d->aToggleAnnotator->trigger();
d->annotator->setHidingForced( true );
}
// force an update of the cursor
updateCursor( contentAreaPosition() + viewport()->mapFromGlobal( QCursor::pos() ) );
Okular::Settings::self()->writeConfig();
@ -4289,8 +4298,11 @@ void PageView::slotSetMouseTableSelect()
"Draw a rectangle around the table, then click near edges to divide up; press Esc to clear."
), QString(), PageViewMessage::Info, -1 );
// force hiding of annotator toolbar
if ( d->annotator )
d->annotator->setEnabled( false );
if ( d->aToggleAnnotator && d->aToggleAnnotator->isChecked() )
{
d->aToggleAnnotator->trigger();
d->annotator->setHidingForced( true );
}
// force an update of the cursor
updateCursor( contentAreaPosition() + viewport()->mapFromGlobal( QCursor::pos() ) );
Okular::Settings::self()->writeConfig();
@ -4347,6 +4359,7 @@ void PageView::slotToggleAnnotator( bool on )
// initialize/reset annotator (and show/hide toolbar)
d->annotator->setEnabled( on );
d->annotator->setHidingForced( false );
inHere = false;
}

@ -604,7 +604,7 @@ class TextSelectorEngine : public AnnotatorEngine
PageViewAnnotator::PageViewAnnotator( PageView * parent, Okular::Document * storage )
: QObject( parent ), m_document( storage ), m_pageView( parent ),
m_toolBar( 0 ), m_engine( 0 ), m_textToolsEnabled( false ), m_toolsEnabled( false ),
m_continuousMode( false ), m_lastToolID( -1 ), m_lockedItem( 0 )
m_continuousMode( false ), m_hidingWasForced( false ), m_lastToolID( -1 ), m_lockedItem( 0 )
{
// load the tools from the 'xml tools definition' file. store the tree internally.
QFile infoFile( KStandardDirs::locate("data", "okular/tools.xml") );
@ -706,6 +706,16 @@ void PageViewAnnotator::setToolsEnabled( bool enabled )
m_toolBar->setToolsEnabled( m_toolsEnabled );
}
void PageViewAnnotator::setHidingForced( bool forced )
{
m_hidingWasForced = forced;
}
bool PageViewAnnotator::hidingWasForced() const
{
return m_hidingWasForced;
}
bool PageViewAnnotator::routeEvents() const
{
return m_engine && m_toolBar;

@ -60,6 +60,9 @@ class PageViewAnnotator : public QObject
void setToolsEnabled( bool enabled );
void setHidingForced( bool forced );
bool hidingWasForced() const;
// methods used when creating the annotation
bool routeEvents() const;
QRect routeEvent( QMouseEvent * event, PageViewItem * item );
@ -85,6 +88,7 @@ class PageViewAnnotator : public QObject
bool m_textToolsEnabled;
bool m_toolsEnabled;
bool m_continuousMode;
bool m_hidingWasForced;
// creation related variables
int m_lastToolID;

Loading…
Cancel
Save