Minor tweaks

This commit is contained in:
Albert Astals Cid 2013-04-06 00:28:39 +02:00
parent 78faf1e68f
commit d0fd156dc9
5 changed files with 51 additions and 46 deletions

View file

@ -752,7 +752,7 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
}
}
QDomNode Annotation::getAnnotationPropertiesDomNode()
QDomNode Annotation::getAnnotationPropertiesDomNode() const
{
QDomDocument doc( "documentInfo" );
QDomElement node = doc.createElement( "annotation" );

View file

@ -659,14 +659,18 @@ class OKULAR_EXPORT Annotation
virtual void store( QDomNode & node, QDomDocument & document ) const;
/**
* Retrieve the QDomNode representing this annotation's properties
*/
QDomNode getAnnotationPropertiesDomNode();
* Retrieve the QDomNode representing this annotation's properties
* @since 0.17 (KDE 4.11)
*/
QDomNode getAnnotationPropertiesDomNode() const;
/**
* Sets annotations internal properties according to the contents of @p node
*/
void setAnnotationProperties(const QDomNode & node);
* Sets annotations internal properties according to the contents of @p node
*
* @since 0.17 (KDE 4.11)
*/
void setAnnotationProperties( const QDomNode & node );
protected:
/// @cond PRIVATE

View file

@ -2007,13 +2007,13 @@ QVariant DocumentPrivate::documentMetaData( const QString &key, const QVariant &
};
AddAnnotationCommand::AddAnnotationCommand( Okular::DocumentPrivate * docPriv, Okular::Annotation* annotation, int pageNumber )
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_done( false )
{
setText( i18nc ("Add an annotation to the page", "add annotation" ) );
}
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_done( false )
{
setText( i18nc ("Add an annotation to the page", "add annotation" ) );
}
AddAnnotationCommand::~AddAnnotationCommand()
{
@ -2037,15 +2037,16 @@ void AddAnnotationCommand::redo()
RemoveAnnotationCommand::RemoveAnnotationCommand(Okular::DocumentPrivate * doc, Okular::Annotation* annotation, int pageNumber)
: m_doc( doc ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_done( false )
{
setText( i18nc( "Remove an annotation from the page", "remove annotation" ) );
}
: m_doc( doc ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_done( false )
{
setText( i18nc( "Remove an annotation from the page", "remove annotation" ) );
}
RemoveAnnotationCommand::~RemoveAnnotationCommand(){
RemoveAnnotationCommand::~RemoveAnnotationCommand()
{
if ( m_done )
{
delete m_annotation;
@ -2069,14 +2070,14 @@ ModifyAnnotationPropertiesCommand::ModifyAnnotationPropertiesCommand( DocumentPr
int pageNumber,
QDomNode oldProperties,
QDomNode newProperties )
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_prevProperties( oldProperties ),
m_newProperties( newProperties )
{
setText(i18nc("Modify an annotation's internal properties (Color, line-width, etc.)", "modify annotation properties"));
}
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_prevProperties( oldProperties ),
m_newProperties( newProperties )
{
setText(i18nc("Modify an annotation's internal properties (Color, line-width, etc.)", "modify annotation properties"));
}
void ModifyAnnotationPropertiesCommand::undo()
{
@ -2095,14 +2096,14 @@ TranslateAnnotationCommand::TranslateAnnotationCommand( DocumentPrivate* docPriv
int pageNumber,
const Okular::NormalizedPoint & delta,
bool completeDrag )
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_delta( delta ),
m_completeDrag( completeDrag )
{
setText( i18nc( "Translate an annotation's position on the page", "translate annotation" ) );
}
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
m_delta( delta ),
m_completeDrag( completeDrag )
{
setText( i18nc( "Translate an annotation's position on the page", "translate annotation" ) );
}
void TranslateAnnotationCommand::undo()
{
@ -2148,11 +2149,11 @@ EditTextCommand::EditTextCommand( const QString & newContents,
const QString & prevContents,
int prevCursorPos,
int prevAnchorPos )
: m_newContents( newContents ),
m_newCursorPos( newCursorPos ),
m_prevContents( prevContents ),
m_prevCursorPos( prevCursorPos ),
m_prevAnchorPos( prevAnchorPos )
: m_newContents( newContents ),
m_newCursorPos( newCursorPos ),
m_prevContents( prevContents ),
m_prevCursorPos( prevCursorPos ),
m_prevAnchorPos( prevAnchorPos )
{
setText( i18nc( "Generic text edit command", "edit text" ) );
@ -3196,10 +3197,10 @@ bool Document::canModifyPageAnnotation( const Annotation * annotation ) const
void Document::prepareToModifyAnnotationProperties( Annotation * annotation )
{
Q_ASSERT(d->m_prevPropsOfAnnotBeingModified.isNull());
if (!d->m_prevPropsOfAnnotBeingModified.isNull())
{
kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties has already been called since last call to Document::modifyPageAnnotationProperties";
Q_ASSERT(d->m_prevPropsOfAnnotBeingModified.isNull());
return;
}
d->m_prevPropsOfAnnotBeingModified = annotation->getAnnotationPropertiesDomNode();
@ -3207,10 +3208,10 @@ void Document::prepareToModifyAnnotationProperties( Annotation * annotation )
void Document::modifyPageAnnotationProperties( int page, Annotation * annotation )
{
Q_ASSERT(!d->m_prevPropsOfAnnotBeingModified.isNull());
if (d->m_prevPropsOfAnnotBeingModified.isNull())
{
kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties must be called before Annotation is modified";
Q_ASSERT(!d->m_prevPropsOfAnnotBeingModified.isNull());
return;
}
QDomNode prevProps = d->m_prevPropsOfAnnotBeingModified;

View file

@ -20,7 +20,6 @@
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtGui/QPrinter>
#include <QUndoCommand>
#include <QtXml/QDomDocument>
#include <kmimetype.h>

View file

@ -19,6 +19,7 @@
#include <QtCore/QMap>
#include <QtCore/QMutex>
#include <QtCore/QPointer>
#include <QtGui/QUndoCommand>
#include <kcomponentdata.h>
#include <kservicetypetrader.h>