mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
Fixlets to the txt backend
This commit is contained in:
parent
74420f1baa
commit
d28e1af956
|
@ -14,7 +14,7 @@ set(okularGenerator_txt_SRCS
|
|||
|
||||
kde4_add_plugin(okularGenerator_txt ${okularGenerator_txt_SRCS})
|
||||
|
||||
target_link_libraries(okularGenerator_txt okularcore ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY})
|
||||
target_link_libraries(okularGenerator_txt okularcore ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
|
||||
|
||||
install(TARGETS okularGenerator_txt DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
using namespace Txt;
|
||||
|
||||
Converter::Converter() : m_textDocument(NULL)
|
||||
Converter::Converter()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,17 +25,17 @@ Converter::~Converter()
|
|||
|
||||
QTextDocument* Converter::convert( const QString &fileName )
|
||||
{
|
||||
m_textDocument = new Document( fileName );
|
||||
Document *textDocument = new Document( fileName );
|
||||
|
||||
m_textDocument->setPageSize(QSizeF( 600, 800 ));
|
||||
textDocument->setPageSize(QSizeF( 600, 800 ));
|
||||
|
||||
QTextFrameFormat frameFormat;
|
||||
frameFormat.setMargin( 20 );
|
||||
|
||||
QTextFrame *rootFrame = m_textDocument->rootFrame();
|
||||
QTextFrame *rootFrame = textDocument->rootFrame();
|
||||
rootFrame->setFrameFormat( frameFormat );
|
||||
|
||||
emit addMetaData( Okular::DocumentInfo::MimeType, "text/plain" );
|
||||
|
||||
return m_textDocument;
|
||||
}
|
||||
return textDocument;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ namespace Txt
|
|||
~Converter();
|
||||
|
||||
virtual QTextDocument *convert( const QString &fileName );
|
||||
|
||||
private:
|
||||
QTextDocument *m_textDocument;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
using namespace Txt;
|
||||
|
||||
Document::Document( QString fileName )
|
||||
Document::Document( const QString &fileName )
|
||||
{
|
||||
#ifdef TXT_DEBUG
|
||||
kDebug() << "Opening file" << fileName;
|
||||
|
@ -32,7 +32,7 @@ Document::Document( QString fileName )
|
|||
return;
|
||||
}
|
||||
|
||||
QByteArray buffer = plainFile.readAll();
|
||||
const QByteArray buffer = plainFile.readAll();
|
||||
setPlainText( toUnicode(buffer) );
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ QByteArray Document::detectEncoding( const QByteArray &array )
|
|||
|
||||
QString Document::toUnicode( const QByteArray &array )
|
||||
{
|
||||
QByteArray encoding = detectEncoding( array );
|
||||
const QByteArray encoding = detectEncoding( array );
|
||||
if ( encoding.isEmpty() )
|
||||
{
|
||||
return QString();
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Txt
|
|||
class Document : public QTextDocument
|
||||
{
|
||||
public:
|
||||
Document( QString fileName );
|
||||
Document( const QString &fileName );
|
||||
~Document();
|
||||
|
||||
private:
|
||||
|
@ -23,4 +23,4 @@ namespace Txt
|
|||
QByteArray detectEncoding( const QByteArray &array );
|
||||
QString toUnicode( const QByteArray &array );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue