Some more changes according to the review.

This commit is contained in:
Michel Ludwig 2011-10-31 21:41:50 +00:00
parent 31828b4850
commit a823df5c8f
5 changed files with 36 additions and 19 deletions

View file

@ -730,6 +730,16 @@ class OKULAR_EXPORT Document : public QObject
*/
void formFieldChanged( Okular::FormField *formField );
/**
* This signal is emitted whenever a source reference with the given parameters has been
* activated.
*
* \param handled should be set to 'true' if a slot handles this source reference; the
* default action to launch the configured editor will then not be performed
* by the document
*
* @since 0.14 (KDE 4.8)
*/
void sourceReferenceActivated(const QString& absFileName, int line, int col, bool *handled);
private:

View file

@ -78,6 +78,11 @@ enum ScriptType
JavaScript = 0 ///< JavaScript code
};
/**
* Describes the possible embedding modes of the part
*
* @since 0.14 (KDE 4.8)
*/
enum EmbedMode
{
UnknownEmbedMode,

View file

@ -828,37 +828,39 @@ KUrl Part::realUrl() const
void Part::showSourceLocation(const QString& fileName, int line, int column)
{
QString u = "src:" + QString::number(line) + ' ' + fileName;
GotoAction action(QString(), u);
m_document->processAction(&action);
const QString u = QString( "src:%1 %2" ).arg( line ).arg( fileName );
GotoAction action( QString(), u );
m_document->processAction( &action );
}
void Part::setWatchFileModeEnabled(bool b)
void Part::setWatchFileModeEnabled(bool enabled)
{
if (b && m_watcher->isStopped()) {
if ( enabled && m_watcher->isStopped() )
{
m_watcher->startScan();
}
else if(!b && !m_watcher->isStopped() )
else if( !enabled && !m_watcher->isStopped() )
{
m_dirtyHandler->stop();
m_watcher->stopScan();
}
}
void Part::setShowSourceLocationsGraphically(bool b)
void Part::setShowSourceLocationsGraphically(bool show)
{
if( b == Okular::Settings::showSourceLocationsGraphically() )
if( show == Okular::Settings::showSourceLocationsGraphically() )
{
return;
}
Okular::Settings::setShowSourceLocationsGraphically(b);
m_pageView->repaint();
Okular::Settings::setShowSourceLocationsGraphically( show );
m_pageView->update();
}
void Part::slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled)
{
emit(openSourceReference(absFileName, line, col));
if ( m_embedMode == Okular::ViewerWidgetMode ) {
emit openSourceReference( absFileName, line, col );
if ( m_embedMode == Okular::ViewerWidgetMode )
{
*handled = true;
}
}
@ -1544,7 +1546,7 @@ void Part::updateViewActions()
menu = factory()->container("view_orientation", this);
if (menu) menu->setEnabled( opened );
}
emit(viewerMenuStateChange( opened ));
emit viewerMenuStateChange( opened );
updateBookmarksActions();
}

4
part.h
View file

@ -106,8 +106,8 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
KUrl realUrl() const;
void showSourceLocation(const QString& fileName, int line, int column);
void setWatchFileModeEnabled(bool b);
void setShowSourceLocationsGraphically(bool b);
void setWatchFileModeEnabled(bool enable);
void setShowSourceLocationsGraphically(bool show);
public slots: // dbus
Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page);

View file

@ -533,7 +533,6 @@ void PageView::setupActions( KActionCollection * ac )
d->aMouseTextSelect->setIconText( i18nc( "Text Selection Tool", "Text Selection" ) );
d->aMouseTextSelect->setCheckable( true );
d->aMouseTextSelect->setShortcut( Qt::CTRL + Qt::Key_4 );
Q_ASSERT( d->mouseModeActionGroup );
d->aMouseTextSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTableSelect = new KAction(KIcon( "select-table" ), i18n("T&able Selection Tool"), this);
@ -1059,8 +1058,9 @@ void PageView::notifyViewportChanged( bool smoothMove )
if ( d->zoomMode != ZoomFixed )
updateZoomText();
if(viewport()) {
viewport()->repaint();
if( viewport() )
{
viewport()->update();
}
// since the page has moved below cursor, update it
@ -3276,7 +3276,7 @@ void PageView::updateZoomText()
else if ( d->zoomMode == ZoomFitText )
selIdx = 2;
d->aZoom->setCurrentItem( selIdx );
d->aZoom->setEnabled(d->items.size() > 0);
d->aZoom->setEnabled( d->items.size() > 0 );
d->aZoom->selectableActionGroup()->setEnabled( d->items.size() > 0 );
}