From kde-commits Mon Oct 31 21:54:32 2011 From: Michel Ludwig Date: Mon, 31 Oct 2011 21:54:32 +0000 To: kde-commits Subject: [okular/viewerinterface] /: Some more changes according to the review. Message-Id: <20111031215432.B406DA60A6 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=132009812230394 Git commit a823df5c8fa9b6a8ec52a89c6123f73ff42411e6 by Michel Ludwig. Committed on 31/10/2011 at 22:41. Pushed by mludwig into branch 'viewerinterface'. Some more changes according to the review. M +10 -0 core/document.h M +5 -0 core/global.h M +15 -13 part.cpp M +2 -2 part.h M +4 -4 ui/pageview.cpp http://commits.kde.org/okular/a823df5c8fa9b6a8ec52a89c6123f73ff42411e6 diff --git a/core/document.h b/core/document.h index 995def6..6c27313 100644 --- a/core/document.h +++ b/core/document.h @@ -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 giv= en parameters has been + * activated. + * + * \param handled should be set to 'true' if a slot handles this s= ource reference; the + * default action to launch the configured editor w= ill 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: diff --git a/core/global.h b/core/global.h index 85ade0a..ae4c87b 100644 --- a/core/global.h +++ b/core/global.h @@ -78,6 +78,11 @@ enum ScriptType JavaScript =3D 0 ///< JavaScript code }; = +/** + * Describes the possible embedding modes of the part + * + * @since 0.14 (KDE 4.8) + */ enum EmbedMode { UnknownEmbedMode, diff --git a/part.cpp b/part.cpp index eb84576..e8b6f14 100644 --- a/part.cpp +++ b/part.cpp @@ -828,37 +828,39 @@ KUrl Part::realUrl() const = void Part::showSourceLocation(const QString& fileName, int line, int colum= n) { - QString u =3D "src:" + QString::number(line) + ' ' + fileName; - GotoAction action(QString(), u); - m_document->processAction(&action); + const QString u =3D 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 =3D=3D Okular::Settings::showSourceLocationsGraphically() ) + if( show =3D=3D 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 =3D=3D Okular::ViewerWidgetMode ) { + emit openSourceReference( absFileName, line, col ); + if ( m_embedMode =3D=3D Okular::ViewerWidgetMode ) + { *handled =3D true; } } @@ -1544,7 +1546,7 @@ void Part::updateViewActions() menu =3D factory()->container("view_orientation", this); if (menu) menu->setEnabled( opened ); } - emit(viewerMenuStateChange( opened )); + emit viewerMenuStateChange( opened ); = updateBookmarksActions(); } diff --git a/part.h b/part.h index 1229dd0..5408cac 100644 --- a/part.h +++ b/part.h @@ -106,8 +106,8 @@ class Part : public KParts::ReadOnlyPart, public Okular= ::DocumentObserver, publi KUrl realUrl() const; = void showSourceLocation(const QString& fileName, int line, int col= umn); - 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); diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 4049f34..f2aa504 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -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 =3D new KAction(KIcon( "select-table" ), i18n("T= &able Selection Tool"), this); @@ -1059,8 +1058,9 @@ void PageView::notifyViewportChanged( bool smoothMove= ) if ( d->zoomMode !=3D 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 =3D=3D ZoomFitText ) selIdx =3D 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 ); } =20