mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
ui: Fix build without implicit cast to/from ascii
See previous commits for details.
This commit is contained in:
parent
3fcd698896
commit
ba4b9eb1a6
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(""")); //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(""")); //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"));
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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("&")).replace('<', QLatin1String("<")).replace('>', QLatin1String(">"));
|
||||
selText += txt.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||
html.replace(QLatin1Char('&'), QLatin1String("&")).replace(QLatin1Char('<'), QLatin1String("<")).replace(QLatin1Char('>'), QLatin1String(">"));
|
||||
// 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() )
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue