summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 20:05:18 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 20:05:18 (GMT)
commitba4b9eb1a67e71bbe2af8ab7ca68bcdda9a0bc6b (patch)
tree7e96265e0b70b201b2c4dc9be186d82dfe2124c9
parent3fcd69889622b21ca828536c05d9e79516ae0698 (diff)
ui: Fix build without implicit cast to/from ascii
See previous commits for details.
-rw-r--r--ui/annotationmodel.cpp2
-rw-r--r--ui/annotationproxymodels.cpp4
-rw-r--r--ui/annotwindow.cpp2
-rw-r--r--ui/fileprinterpreview.cpp2
-rw-r--r--ui/guiutils.cpp2
-rw-r--r--ui/latexrenderer.cpp6
-rw-r--r--ui/minibar.cpp4
-rw-r--r--ui/pagepainter.cpp2
-rw-r--r--ui/pageview.cpp24
-rw-r--r--ui/pageviewannotator.cpp4
-rw-r--r--ui/presentationwidget.cpp12
-rw-r--r--ui/propertiesdialog.cpp2
-rw-r--r--ui/tocmodel.cpp4
-rw-r--r--ui/url_utils.h2
14 files changed, 36 insertions, 36 deletions
diff --git a/ui/annotationmodel.cpp b/ui/annotationmodel.cpp
index 2ed5e59..e2f185d 100644
--- a/ui/annotationmodel.cpp
+++ b/ui/annotationmodel.cpp
@@ -346,7 +346,7 @@ QVariant AnnotationModel::headerData( int section, Qt::Orientation orientation,
return QVariant();
if ( section == 0 && role == Qt::DisplayRole )
- return "Annotations";
+ return QString::fromLocal8Bit("Annotations");
return QVariant();
}
diff --git a/ui/annotationproxymodels.cpp b/ui/annotationproxymodels.cpp
index 76e4fcb..c4c805f 100644
--- a/ui/annotationproxymodels.cpp
+++ b/ui/annotationproxymodels.cpp
@@ -285,7 +285,7 @@ class AuthorGroupItem
void dump( int level = 0 )
{
QString prefix;
- for ( int i = 0; i < level; ++i ) prefix += ' ';
+ for ( int i = 0; i < level; ++i ) prefix += QLatin1Char(' ');
qDebug( "%s%s", qPrintable( prefix ), ( mType == Page ? "Page" : (mType == Author ? "Author" : "Annotation") ) );
@@ -478,7 +478,7 @@ QVariant AuthorGroupProxyModel::data( const QModelIndex &proxyIndex, int role )
if ( role == Qt::DisplayRole )
return item->author();
else if ( role == Qt::DecorationRole )
- return QIcon::fromTheme( item->author().isEmpty() ? "user-away" : "user-identity" );
+ return QIcon::fromTheme( item->author().isEmpty() ? QStringLiteral("user-away") : QStringLiteral("user-identity") );
else
return QVariant();
} else {
diff --git a/ui/annotwindow.cpp b/ui/annotwindow.cpp
index c8eb188..a034f98 100644
--- a/ui/annotwindow.cpp
+++ b/ui/annotwindow.cpp
@@ -154,7 +154,7 @@ public:
void setDate( const QDateTime& dt )
{
- dateLabel->setText( QLocale().toString( dt, QLocale::ShortFormat ) + ' ' );
+ dateLabel->setText( QLocale().toString( dt, QLocale::ShortFormat ) + QLatin1Char(' ') );
}
void setAuthor( const QString& author )
diff --git a/ui/fileprinterpreview.cpp b/ui/fileprinterpreview.cpp
index 6aed5ea..bfbbc15 100644
--- a/ui/fileprinterpreview.cpp
+++ b/ui/fileprinterpreview.cpp
@@ -90,7 +90,7 @@ void FilePrinterPreviewPrivate::getPart()
}
if (factory) {
qCDebug(OkularUiDebug) << "Trying to create a part";
- previewPart = factory->create<KParts::ReadOnlyPart>(q, (QVariantList() << "Print/Preview"));
+ previewPart = factory->create<KParts::ReadOnlyPart>(q, (QVariantList() << QStringLiteral("Print/Preview")));
if (!previewPart) {
qCDebug(OkularUiDebug) << "Part creation failed";
}
diff --git a/ui/guiutils.cpp b/ui/guiutils.cpp
index 821398e..72986c4 100644
--- a/ui/guiutils.cpp
+++ b/ui/guiutils.cpp
@@ -141,7 +141,7 @@ QString authorForAnnotation( const Okular::Annotation * ann )
QString contentsHtml( const Okular::Annotation * ann )
{
QString text = ann->contents().toHtmlEscaped();
- text.replace( '\n', QLatin1String("<br>") );
+ text.replace( QLatin1Char('\n'), QLatin1String("<br>") );
return text;
}
diff --git a/ui/latexrenderer.cpp b/ui/latexrenderer.cpp
index fbc93b6..47f9761 100644
--- a/ui/latexrenderer.cpp
+++ b/ui/latexrenderer.cpp
@@ -93,8 +93,8 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
continue;
imagePxWidth = theImage.width();
imagePxHeight = theImage.height();
- QString escapedLATEX=it.key().toHtmlEscaped().replace('\"',QLatin1String("&quot;")); //we need the escape quotes because that string will be in a title="" argument, but not the \n
- html.replace(it.key(), " <img width=\"" + QString::number(imagePxWidth) + "\" height=\"" + QString::number(imagePxHeight) + "\" align=\"middle\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
+ QString escapedLATEX=it.key().toHtmlEscaped().replace(QLatin1Char('"'),QLatin1String("&quot;")); //we need the escape quotes because that string will be in a title="" argument, but not the \n
+ html.replace(it.key(), QStringLiteral(" <img width=\"") + QString::number(imagePxWidth) + QStringLiteral("\" height=\"") + QString::number(imagePxHeight) + QStringLiteral("\" align=\"middle\" src=\"") + (*it) + QStringLiteral("\" alt=\"") + escapedLATEX + QStringLiteral("\" title=\"") + escapedLATEX + QStringLiteral("\" /> "));
}
return NoError;
}
@@ -151,7 +151,7 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
latexProc << latexExecutable << QStringLiteral("-interaction=nonstopmode") << QStringLiteral("-halt-on-error") << QStringLiteral("-output-directory=%1").arg(tempFilePath) << tempFile->fileName();
latexProc.setOutputChannelMode( KProcess::MergedChannels );
latexProc.execute();
- latexOutput = latexProc.readAll();
+ latexOutput = QString::fromLocal8Bit(latexProc.readAll());
tempFile->remove();
QFile::remove(tempFileNameNS + QStringLiteral(".log"));
diff --git a/ui/minibar.cpp b/ui/minibar.cpp
index ce805be..bfbe0cc 100644
--- a/ui/minibar.cpp
+++ b/ui/minibar.cpp
@@ -167,7 +167,7 @@ MiniBar::MiniBar( QWidget * parent, MiniBarLogic * miniBarLogic )
QSize buttonSize( KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium );
// bottom: left prev_page button
m_prevButton = new HoverButton( this );
- m_prevButton->setIcon( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? "arrow-right" : "arrow-left" ) );
+ m_prevButton->setIcon( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? QStringLiteral("arrow-right") : QStringLiteral("arrow-left") ) );
m_prevButton->setIconSize( buttonSize );
horLayout->addWidget( m_prevButton );
// bottom: left lineEdit (current page box)
@@ -190,7 +190,7 @@ MiniBar::MiniBar( QWidget * parent, MiniBarLogic * miniBarLogic )
horLayout->addWidget( m_pagesButton );
// bottom: right next_page button
m_nextButton = new HoverButton( this );
- m_nextButton->setIcon( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? "arrow-left" : "arrow-right" ) );
+ m_nextButton->setIcon( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? QStringLiteral("arrow-left") : QStringLiteral("arrow-right") ) );
m_nextButton->setIconSize( buttonSize );
horLayout->addWidget( m_nextButton );
diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp
index 2a3cdcc..268f328 100644
--- a/ui/pagepainter.cpp
+++ b/ui/pagepainter.cpp
@@ -35,7 +35,7 @@
#include "core/tile.h"
#include "settings_core.h"
-Q_GLOBAL_STATIC_WITH_ARGS( QPixmap, busyPixmap, ( KIconLoader::global()->loadIcon("okular", KIconLoader::NoGroup, 32, KIconLoader::DefaultState, QStringList(), 0, true) ) )
+Q_GLOBAL_STATIC_WITH_ARGS( QPixmap, busyPixmap, ( KIconLoader::global()->loadIcon(QLatin1String("okular"), KIconLoader::NoGroup, 32, KIconLoader::DefaultState, QStringList(), 0, true) ) )
#define TEXTANNOTATION_ICONSIZE 24
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index 26373bb..52b975b 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -544,7 +544,7 @@ do { \
vm->setCheckable( true ); \
vm->setData( qVariantFromValue( id ) ); \
d->aViewMode->addAction( vm ); \
- ac->addAction( name, vm ); \
+ ac->addAction( QStringLiteral(name), vm ); \
vmGroup->addAction( vm ); \
} while( 0 )
ac->addAction(QStringLiteral("view_render_mode"), d->aViewMode );
@@ -2777,7 +2777,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
if ( !mime.isDefault() )
type = QStringLiteral("PNG");
else
- type = mime.name().section( '/', -1 ).toUpper();
+ type = mime.name().section( QLatin1Char('/'), -1 ).toUpper();
copyPix.save( fileName, qPrintable( type ) );
d->messageWindow->display( i18n( "Image [%1x%2] saved to %3 file.", copyPix.width(), copyPix.height(), type ) );
}
@@ -2900,7 +2900,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
selHtml += QLatin1String("<tr>");
for (int c=0; c+1<xs.length(); c++) {
Okular::NormalizedRect cell(xs[c], ys[r], xs[c+1], ys[r+1]);
- if (c) selText += '\t';
+ if (c) selText += QLatin1Char('\t');
QString txt;
foreach (const TableSelectionPart &tsp, d->tableSelectionParts) {
// first, crop the cell to this part
@@ -2934,14 +2934,14 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
txt += tsp.item->page()->text( &rects, Okular::TextPage::CentralPixelTextAreaInclusionBehaviour );
}
QString html = txt;
- selText += txt.replace('\n', ' ');
- html.replace('&', QLatin1String("&amp;")).replace('<', QLatin1String("&lt;")).replace('>', QLatin1String("&gt;"));
+ selText += txt.replace(QLatin1Char('\n'), QLatin1Char(' '));
+ html.replace(QLatin1Char('&'), QLatin1String("&amp;")).replace(QLatin1Char('<'), QLatin1String("&lt;")).replace(QLatin1Char('>'), QLatin1String("&gt;"));
// Remove newlines, do not turn them into <br>, because
// Excel interprets <br> within cell as new cell...
- html.replace('\n', QLatin1String(" "));
- selHtml += "<td>"+html+"</td>";
+ html.replace(QLatin1Char('\n'), QLatin1String(" "));
+ selHtml += QStringLiteral("<td>") + html + QStringLiteral("</td>");
}
- selText += '\n';
+ selText += QLatin1Char('\n');
selHtml += QLatin1String("</tr>\n");
}
selHtml += QLatin1String("</table></body></html>\n");
@@ -3811,8 +3811,8 @@ void PageView::updateZoom( ZoomMode newZoomMode )
case ZoomFixed:{ //ZoomFixed case
QString z = d->aZoom->currentText();
// kdelibs4 sometimes adds accelerators to actions' text directly :(
- z.remove ('&');
- z.remove ('%');
+ z.remove (QLatin1Char('&'));
+ z.remove (QLatin1Char('%'));
newFactor = QLocale().toDouble( z ) / 100.0;
}break;
case ZoomIn:
@@ -3935,7 +3935,7 @@ void PageView::updateZoomText()
selIdx++;
// we do not need to display 2-digit precision
QString localValue( QLocale().toString( value * 100.0, 'f', 1 ) );
- localValue.remove( QLocale().decimalPoint() + '0' );
+ localValue.remove( QLocale().decimalPoint() + QLatin1Char('0') );
// remove a trailing zero in numbers like 66.70
if ( localValue.right( 1 ) == QLatin1String( "0" ) && localValue.indexOf( QLocale().decimalPoint() ) > -1 )
localValue.chop( 1 );
@@ -4213,7 +4213,7 @@ void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
}
QString searchText = text;
- searchText = searchText.replace( '\n', ' ' ).replace( '\r', ' ' ).simplified();
+ searchText = searchText.replace( QLatin1Char('\n'), QLatin1Char(' ') ).replace(QLatin1Char( '\r'), QLatin1Char(' ') ).simplified();
if ( searchText.isEmpty() )
{
diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp
index 815fb0a..49bf3d5 100644
--- a/ui/pageviewannotator.cpp
+++ b/ui/pageviewannotator.cpp
@@ -184,9 +184,9 @@ class PickPointEngine : public AnnotatorEngine
ta->setTextFont( f );
}
//set width
- if ( m_annotElement.hasAttribute( "width" ) )
+ if ( m_annotElement.hasAttribute( QStringLiteral ( "width" ) ) )
{
- ta->style().setWidth( m_annotElement.attribute( "width" ).toDouble() );
+ ta->style().setWidth( m_annotElement.attribute( QStringLiteral ( "width" ) ).toDouble() );
}
//set boundary
rect.left = qMin(startpoint.x,point.x);
diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp
index 2976bf6..b2a74a7 100644
--- a/ui/presentationwidget.cpp
+++ b/ui/presentationwidget.cpp
@@ -159,7 +159,7 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
m_topBar->setObjectName( QStringLiteral( "presentationBar" ) );
m_topBar->setMovable( false );
m_topBar->layout()->setMargin(0);
- m_topBar->addAction( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? "go-next" : "go-previous" ), i18n( "Previous Page" ), this, SLOT(slotPrevPage()) );
+ m_topBar->addAction( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? QStringLiteral("go-next") : QStringLiteral("go-previous") ), i18n( "Previous Page" ), this, SLOT(slotPrevPage()) );
m_pagesEdit = new KLineEdit( m_topBar );
QSizePolicy sp = m_pagesEdit->sizePolicy();
sp.setHorizontalPolicy( QSizePolicy::Minimum );
@@ -175,7 +175,7 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
pagesLabel->setText( QLatin1String( " / " ) + QString::number( m_document->pages() ) + QLatin1String( " " ) );
m_topBar->addWidget( pagesLabel );
connect(m_pagesEdit, &QLineEdit::returnPressed, this, &PresentationWidget::slotPageChanged);
- m_topBar->addAction( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? "go-previous" : "go-next" ), i18n( "Next Page" ), this, SLOT(slotNextPage()) );
+ m_topBar->addAction( QIcon::fromTheme( layoutDirection() == Qt::RightToLeft ? QStringLiteral("go-previous") : QStringLiteral("go-next") ), i18n( "Next Page" ), this, SLOT(slotNextPage()) );
m_topBar->addSeparator();
QAction *playPauseAct = collection->action( QStringLiteral("presentation_play_pause") );
playPauseAct->setEnabled( true );
@@ -493,10 +493,10 @@ void PresentationWidget::setupActions()
{
addAction( m_ac->action( QStringLiteral("first_page") ) );
addAction( m_ac->action( QStringLiteral("last_page") ) );
- addAction( m_ac->action( KStandardAction::name( KStandardAction::Prior ) ) );
- addAction( m_ac->action( KStandardAction::name( KStandardAction::Next ) ) );
- addAction( m_ac->action( KStandardAction::name( KStandardAction::DocumentBack ) ) );
- addAction( m_ac->action( KStandardAction::name( KStandardAction::DocumentForward ) ) );
+ addAction( m_ac->action( QString::fromLocal8Bit(KStandardAction::name( KStandardAction::Prior ) ) ) );
+ addAction( m_ac->action( QString::fromLocal8Bit(KStandardAction::name( KStandardAction::Next ) ) ) );
+ addAction( m_ac->action( QString::fromLocal8Bit(KStandardAction::name( KStandardAction::DocumentBack ) ) ) );
+ addAction( m_ac->action( QString::fromLocal8Bit(KStandardAction::name( KStandardAction::DocumentForward ) ) ) );
QAction *action = m_ac->action( QStringLiteral("switch_blackscreen_mode") );
connect(action, &QAction::toggled, this, &PresentationWidget::toggleBlackScreenMode);
diff --git a/ui/propertiesdialog.cpp b/ui/propertiesdialog.cpp
index 6ac8e3c..d6b409f 100644
--- a/ui/propertiesdialog.cpp
+++ b/ui/propertiesdialog.cpp
@@ -57,7 +57,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
QFormLayout *layout = new QFormLayout( page );
// mime name based on mimetype id
- QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( '/', -1 ).toUpper();
+ QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( QLatin1Char('/'), -1 ).toUpper();
setWindowTitle( i18n( "%1 Properties", mimeName ) );
int valMaxWidth = 100;
diff --git a/ui/tocmodel.cpp b/ui/tocmodel.cpp
index 8c97c68..a365e2f 100644
--- a/ui/tocmodel.cpp
+++ b/ui/tocmodel.cpp
@@ -198,7 +198,7 @@ QVariant TOCModel::data( const QModelIndex &index, int role ) const
break;
case Qt::DecorationRole:
if ( item->highlight )
- return QIcon::fromTheme( QApplication::layoutDirection() == Qt::RightToLeft ? "arrow-left" : "arrow-right" );
+ return QIcon::fromTheme( QApplication::layoutDirection() == Qt::RightToLeft ? QStringLiteral("arrow-left") : QStringLiteral("arrow-right") );
break;
case PageItemDelegate::PageRole:
if ( item->viewport.isValid() )
@@ -227,7 +227,7 @@ QVariant TOCModel::headerData( int section, Qt::Orientation orientation, int rol
return QVariant();
if ( section == 0 && role == Qt::DisplayRole )
- return "Topics";
+ return QStringLiteral("Topics");
return QVariant();
}
diff --git a/ui/url_utils.h b/ui/url_utils.h
index bb9756f..8644379 100644
--- a/ui/url_utils.h
+++ b/ui/url_utils.h
@@ -25,7 +25,7 @@ namespace UrlUtils
{
QString url = reg.cap();
if( url.startsWith( QLatin1String("www") ) )
- url.prepend( "http://" );
+ url.prepend( QLatin1String("http://") );
return url;
}
else