Commit 5b7c6b81 authored by Michel Ludwig's avatar Michel Ludwig
Browse files

Add two new methods to the viewer interface.

Namely, 'areSourceLocationsShownGraphically()' and 'isWatchFileModeEnabled()'.
A corresponding implementation is provided.
parent 1be2696c
......@@ -32,7 +32,7 @@ class OKULAR_EXPORT ViewerInterface
* Show the specified source location centrally in the viewer.
*
* @param showGraphically controls whether the given source location will be
* shown graphically in the viewer (if that feature is globally activated)
* shown graphically in the viewer (if that feature is globally activated)
*/
virtual void showSourceLocation(const QString& fileName, int line, int column, bool showGraphically = true) = 0;
......@@ -42,10 +42,20 @@ class OKULAR_EXPORT ViewerInterface
virtual void clearLastShownSourceLocation() = 0;
/**
* Allows to control whether source locations are shown graphically, or not.
**/
* Returns true iff source locations are shown graphically.
*/
virtual bool areSourceLocationsShownGraphically() const = 0;
/**
* Allows to control whether source locations are shown graphically, or not.
*/
virtual void setShowSourceLocationsGraphically(bool b) = 0;
/**
* Returns true iff the watch file mode is enabled.
*/
virtual bool isWatchFileModeEnabled() const = 0;
/**
* Allows to enable or disable the watch file mode
*/
......
......@@ -851,6 +851,11 @@ void Part::clearLastShownSourceLocation()
m_pageView->viewport()->update();
}
bool Part::isWatchFileModeEnabled() const
{
return !m_watcher->isStopped();
}
void Part::setWatchFileModeEnabled(bool enabled)
{
if ( enabled && m_watcher->isStopped() )
......@@ -864,6 +869,11 @@ void Part::setWatchFileModeEnabled(bool enabled)
}
}
bool Part::areSourceLocationsShownGraphically() const
{
return Okular::Settings::showSourceLocationsGraphically();
}
void Part::setShowSourceLocationsGraphically(bool show)
{
if( show == Okular::Settings::showSourceLocationsGraphically() )
......
......@@ -122,7 +122,9 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
void showSourceLocation(const QString& fileName, int line, int column, bool showGraphically = true);
void clearLastShownSourceLocation();
bool isWatchFileModeEnabled() const;
void setWatchFileModeEnabled(bool enable);
bool areSourceLocationsShownGraphically() const;
void setShowSourceLocationsGraphically(bool show);
public slots: // dbus
......
Markdown is supported
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