[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeplasma-addons] applets/comic: Enable QT_NO_CAST_FROM_ASCII also for applets/comic, string code a
From:       Friedrich W. H. Kossebau <null () kde ! org>
Date:       2018-01-31 22:25:28
Message-ID: E1eh0oq-0007ys-O1 () code ! kde ! org
[Download RAW message or body]

Git commit e31b70aec96651a6202d732339c0d2ba2e710044 by Friedrich W. H. Kossebau.
Committed on 31/01/2018 at 21:23.
Pushed by kossebau into branch 'master'.

Enable QT_NO_CAST_FROM_ASCII also for applets/comic, string code adapted

M  +0    -3    applets/comic/CMakeLists.txt
M  +1    -1    applets/comic/activecomicmodel.cpp
M  +5    -5    applets/comic/checknewstrips.cpp
M  +54   -46   applets/comic/comic.cpp
M  +4    -4    applets/comic/comicarchivedialog.cpp
M  +18   -18   applets/comic/comicarchivejob.cpp
M  +34   -33   applets/comic/comicdata.cpp
M  +3    -3    applets/comic/comicsaver.cpp
M  +3    -3    applets/comic/stripselector.cpp

https://commits.kde.org/kdeplasma-addons/e31b70aec96651a6202d732339c0d2ba2e710044

diff --git a/applets/comic/CMakeLists.txt b/applets/comic/CMakeLists.txt
index bfead9607..9d7b20ca1 100644
--- a/applets/comic/CMakeLists.txt
+++ b/applets/comic/CMakeLists.txt
@@ -1,8 +1,5 @@
 add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.comic\")
 
-remove_definitions(
-    -DQT_NO_CAST_FROM_ASCII
-)
 set(comic_SRCS
     comic.cpp
     comicmodel.cpp
diff --git a/applets/comic/activecomicmodel.cpp b/applets/comic/activecomicmodel.cpp
index 5beeb412d..fdd65a055 100644
--- a/applets/comic/activecomicmodel.cpp
+++ b/applets/comic/activecomicmodel.cpp
@@ -61,7 +61,7 @@ QVariantHash ActiveComicModel::get(int row) const
     const auto roleNames = this->roleNames();
     hash.reserve(roleNames.size());
     for (auto end = roleNames.constEnd(), it = roleNames.constBegin(); it != end; \
                ++it) {
-        hash.insert(it.value(), data(idx, it.key()));
+        hash.insert(QString::fromUtf8(it.value()), data(idx, it.key()));
     }
 
     return hash;
diff --git a/applets/comic/checknewstrips.cpp b/applets/comic/checknewstrips.cpp
index 88bacf60a..4a45a628a 100644
--- a/applets/comic/checknewstrips.cpp
+++ b/applets/comic/checknewstrips.cpp
@@ -41,8 +41,8 @@ void CheckNewStrips::dataUpdated( const QString &source, const \
Plasma::DataEngin  {
     QString lastIdentifierSuffix;
 
-    if ( !data[ "Error" ].toBool() ) {
-        lastIdentifierSuffix = data[ "Identifier" ].toString();
+    if (!data[QStringLiteral("Error")].toBool()) {
+        lastIdentifierSuffix = data[QStringLiteral("Identifier")].toString();
         lastIdentifierSuffix.remove( source );
     }
 
@@ -50,13 +50,13 @@ void CheckNewStrips::dataUpdated( const QString &source, const \
Plasma::DataEngin  
     if ( !lastIdentifierSuffix.isEmpty() ) {
         QString temp = source;
-        temp.remove( ':' );
+        temp.remove(QLatin1Char(':'));
         emit lastStrip( mIndex, temp, lastIdentifierSuffix );
     }
     ++mIndex;
 
     if ( mIndex < mIdentifiers.count() ) {
-        const QString newSource = mIdentifiers[mIndex] + ':';
+        const QString newSource = mIdentifiers[mIndex] + QLatin1Char(':');
         mEngine->connectSource( newSource, this );
     } else {
         mIndex = 0;
@@ -71,7 +71,7 @@ void CheckNewStrips::start()
     }
 
     if ( mIndex < mIdentifiers.count() ) {
-        const QString newSource = mIdentifiers[mIndex] + ':';
+        const QString newSource = mIdentifiers[mIndex] + QLatin1Char(':');
         mEngine->connectSource( newSource, this );
     }
 }
diff --git a/applets/comic/comic.cpp b/applets/comic/comic.cpp
index 928139ca6..823fbafb5 100644
--- a/applets/comic/comic.cpp
+++ b/applets/comic/comic.cpp
@@ -84,8 +84,8 @@ void ComicApplet::init()
 
     configChanged();
 
-    mEngine = Plasma::PluginLoader::self()->loadDataEngine( "comic" );
-    mModel = new ComicModel( mEngine, "providers", mTabIdentifier, this );
+    mEngine = Plasma::PluginLoader::self()->loadDataEngine(QStringLiteral("comic"));
+    mModel = new ComicModel(mEngine, QStringLiteral("providers"), mTabIdentifier, \
this);  mProxy = new QSortFilterProxyModel( this );
     mProxy->setSourceModel( mModel );
     mProxy->setSortCaseSensitivity( Qt::CaseInsensitive );
@@ -104,21 +104,25 @@ void ComicApplet::init()
     mDateChangedTimer->setInterval( 5 * 60 * 1000 ); // every 5 minutes
     mDateChangedTimer->start();
 
-    mActionNextNewStripTab = new QAction( QIcon::fromTheme( "go-next-view" ), i18nc( \
"here strip means comic strip", "&Next Tab with a new Strip" ), this ); +    \
mActionNextNewStripTab = new \
QAction(QIcon::fromTheme(QStringLiteral("go-next-view")), +                           \
i18nc("here strip means comic strip", "&Next Tab with a new Strip"), this);  \
                mActionNextNewStripTab->setShortcuts( KStandardShortcut::openNew() );
-    actions()->addAction( "next new strip" , mActionNextNewStripTab );
+    actions()->addAction(QStringLiteral("next new strip"), mActionNextNewStripTab);
     mActions.append( mActionNextNewStripTab );
     connect( mActionNextNewStripTab, &QAction::triggered, this, \
&ComicApplet::showNextNewStrip );  
-    mActionGoFirst = new QAction( QIcon::fromTheme( "go-first" ), i18n( "Jump to \
&first Strip" ), this ); +    mActionGoFirst = new \
QAction(QIcon::fromTheme(QStringLiteral("go-first")), +                               \
i18n("Jump to &first Strip"), this);  mActions.append( mActionGoFirst );
     connect( mActionGoFirst, &QAction::triggered, this, &ComicApplet::slotFirstDay \
);  
-    mActionGoLast = new QAction( QIcon::fromTheme( "go-last" ), i18n( "Jump to \
&current Strip" ), this ); +    mActionGoLast = new \
QAction(QIcon::fromTheme(QStringLiteral("go-last")), +                                \
i18n("Jump to &current Strip"), this);  mActions.append( mActionGoLast );
     connect( mActionGoLast, &QAction::triggered, this, &ComicApplet::slotCurrentDay \
);  
-    mActionGoJump = new QAction( QIcon::fromTheme( "go-jump" ), i18n( "Jump to Strip \
..." ), this ); +    mActionGoJump = new \
QAction(QIcon::fromTheme(QStringLiteral("go-jump")), +                                \
i18n("Jump to Strip ..."), this);  mActions.append( mActionGoJump );
     connect( mActionGoJump, &QAction::triggered, this, &ComicApplet::slotGoJump );
 
@@ -127,21 +131,25 @@ void ComicApplet::init()
     mActions.append( mActionShop );
     connect( mActionShop, &QAction::triggered, this, &ComicApplet::slotShop );
 
-    QAction *action = new QAction( QIcon::fromTheme( "document-save-as" ), i18n( \
"&Save Comic As..." ), this ); +    QAction *action = new \
QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), +                       \
i18n("&Save Comic As..."), this);  mActions.append( action );
     connect( action, &QAction::triggered, this, &ComicApplet::slotSaveComicAs );
 
-    action = new QAction( QIcon::fromTheme( "application-epub+zip" ), i18n( "&Create \
Comic Book Archive..." ), this ); +    action = new \
QAction(QIcon::fromTheme(QStringLiteral("application-epub+zip")), +                   \
i18n("&Create Comic Book Archive..."), this);  mActions.append( action );
     connect( action, &QAction::triggered, this, &ComicApplet::createComicBook );
 
-    mActionScaleContent = new QAction( QIcon::fromTheme( "zoom-original" ), i18nc( \
"@option:check Context menu of comic image", "&Actual Size" ), this ); +    \
mActionScaleContent = new QAction(QIcon::fromTheme(QStringLiteral("zoom-original")), \
+                                      i18nc("@option:check Context menu of comic \
image", "&Actual Size"), this);  mActionScaleContent->setCheckable( true );
     mActionScaleContent->setChecked( mCurrent.scaleComic() );
     mActions.append( mActionScaleContent );
     connect( mActionScaleContent, &QAction::triggered, this, \
&ComicApplet::slotScaleToContent );  
-    mActionStorePosition = new QAction( QIcon::fromTheme( "go-home" ), i18nc( \
"@option:check Context menu of comic image", "Store current &Position" ), this); +    \
mActionStorePosition = new QAction(QIcon::fromTheme(QStringLiteral("go-home")), +     \
i18nc("@option:check Context menu of comic image", "Store current &Position"), this); \
mActionStorePosition->setCheckable( true );  \
mActionStorePosition->setChecked(mCurrent.hasStored());  mActions.append( \
mActionStorePosition ); @@ -179,10 +187,10 @@ void ComicApplet::dataUpdated( const \
QString &source, const Plasma::DataEngine::  setConfigurationRequired( false );
 
     //there was an error, display information as image
-    const bool hasError = data[ "Error" ].toBool();
-    const bool errorAutoFixable = data[ "Error automatically fixable" ].toBool();
+    const bool hasError = data[QStringLiteral("Error")].toBool();
+    const bool errorAutoFixable = data[QStringLiteral("Error automatically \
fixable")].toBool();  if ( hasError ) {
-        const QString previousIdentifierSuffix = data[ "Previous identifier suffix" \
].toString(); +        const QString previousIdentifierSuffix = \
                data[QStringLiteral("Previous identifier suffix")].toString();
         if (mEngine && !mShowErrorPicture && !previousIdentifierSuffix.isEmpty() ) {
             mEngine->disconnectSource( source, this );
             updateComic( previousIdentifierSuffix );
@@ -212,11 +220,11 @@ void ComicApplet::dataUpdated( const QString &source, const \
Plasma::DataEngine::  
         //prefetch the previous and following comic for faster navigation
         if (mCurrent.hasNext()) {
-            const QString prefetch = mCurrent.id() + ':' + mCurrent.next();
+            const QString prefetch = mCurrent.id() + QLatin1Char(':') + \
mCurrent.next();  mEngine->connectSource( prefetch, this );
         }
         if ( mCurrent.hasPrev()) {
-            const QString prefetch = mCurrent.id() + ':' + mCurrent.prev();
+            const QString prefetch = mCurrent.id() + QLatin1Char(':') + \
mCurrent.prev();  mEngine->connectSource( prefetch, this );
         }
     }
@@ -237,7 +245,7 @@ void ComicApplet::getNewComics()
         return;
     }
     if (!m_newStuffDialog) {
-        m_newStuffDialog = new KNS3::DownloadDialog( \
QString::fromLatin1("comic.knsrc") ); +        m_newStuffDialog = new \
KNS3::DownloadDialog( QStringLiteral("comic.knsrc") );  KNS3::DownloadDialog *strong \
= m_newStuffDialog.data();  strong->setTitle(i18n("Download Comics"));
         connect(m_newStuffDialog.data(), SIGNAL(finished(int)), mEngine, \
SLOT(loadProviders())); @@ -299,7 +307,7 @@ void ComicApplet::updateUsedComics()
             const QString iconPath = data.data( Qt::DecorationRole \
).value<QIcon>().name();  //found a newer strip last time, which was not visited
 
-            if ( mCheckNewComicStripsInterval && !cg.readEntry( "lastStripVisited_" \
+ identifier, true ) ) { +            if (mCheckNewComicStripsInterval && \
                !cg.readEntry(QLatin1String("lastStripVisited_") + identifier, true)) \
                {
                 mActiveComicModel->addComic(identifier, name, iconPath, true);
             } else {
                 mActiveComicModel->addComic(identifier, name, iconPath);
@@ -408,9 +416,9 @@ void ComicApplet::slotFoundLastStrip( int index, const QString \
&identifier, cons  Q_UNUSED(index)
 
     KConfigGroup cg = config();
-    if (suffix != cg.readEntry( "lastStrip_" + identifier, QString() ) ) {
+    if (suffix != cg.readEntry(QLatin1String("lastStrip_") + identifier, QString())) \
{  qDebug() << identifier << "has a newer strip.";
-        cg.writeEntry( "lastStripVisited_" + identifier, false );
+        cg.writeEntry(QLatin1String("lastStripVisited_") + identifier, false);
         updateComic(suffix);
     }
 }
@@ -453,8 +461,8 @@ void ComicApplet::slotArchive( int archiveType, const QUrl &dest, \
const QString  const QString id = mCurrent.id();
     qDebug() << "Archiving:" << id <<  archiveType << dest << fromIdentifier << \
                toIdentifier;
     ComicArchiveJob *job = new ComicArchiveJob(dest, mEngine, static_cast< \
                ComicArchiveJob::ArchiveType >( archiveType ), mCurrent.type(),  id, \
                this);
-    job->setFromIdentifier(id + ':' + fromIdentifier);
-    job->setToIdentifier(id + ':' + toIdentifier);
+    job->setFromIdentifier(id + QLatin1Char(':') + fromIdentifier);
+    job->setToIdentifier(id + QLatin1Char(':') + toIdentifier);
     if (job->isValid()) {
         connect(job, &ComicArchiveJob::finished, this, \
&ComicApplet::slotArchiveFinished);  KIO::getJobTracker()->registerJob(job);
@@ -468,7 +476,7 @@ void ComicApplet::slotArchive( int archiveType, const QUrl &dest, \
const QString  void ComicApplet::slotArchiveFinished (KJob *job )
 {
     if ( job->error() ) {
-        KNotification::event( KNotification::Warning, i18n( "Archiving comic failed" \
), job->errorText(), QIcon::fromTheme( "dialog-warning" ).pixmap( \
KIconLoader::SizeMedium ) ); +        KNotification::event( KNotification::Warning, \
i18n( "Archiving comic failed" ), job->errorText(), \
QIcon::fromTheme(QStringLiteral("dialog-warning")).pixmap(KIconLoader::SizeMedium));  \
}  }
 
@@ -486,7 +494,7 @@ void ComicApplet::updateComic( const QString &identifierSuffix )
 
         setBusy(true);
 
-        const QString identifier = id + ':' + identifierSuffix;
+        const QString identifier = id + QLatin1Char(':') + identifierSuffix;
 
         //disconnecting of the oldSource is needed, otherwise you could get data for \
comics you are not looking at if you use tabs  //if there was an error only \
disconnect the oldSource if it had nothing to do with the error or if the comic \
changed, that way updates of the error can come in @@ -668,28 +676,28 @@ void \
ComicApplet::setTabIdentifiers(const QStringList &tabs)  
 void ComicApplet::refreshComicData()
 {
-    mComicData["image"] = mCurrent.image();
-    mComicData["prev"] = mCurrent.prev();
-    mComicData["next"] = mCurrent.next();
-    mComicData["additionalText"] = mCurrent.additionalText();
-
-    mComicData["websiteUrl"] = mCurrent.websiteUrl().toString();
-    mComicData["websiteHost"] = mCurrent.websiteUrl().host();
-    mComicData["imageUrl"] = mCurrent.websiteUrl().toString();
-    mComicData["shopUrl"] = mCurrent.websiteUrl().toString();
-    mComicData["first"] = mCurrent.first();
-    mComicData["stripTitle"] = mCurrent.stripTitle();
-    mComicData["author"] = mCurrent.author();
-    mComicData["title"] = mCurrent.title();
-
-    mComicData["suffixType"] = "Date";
-    mComicData["current"] = mCurrent.current();
-    //mComicData["last"] = mCurrent.last();
-    mComicData["currentReadable"] = mCurrent.currentReadable();
-    mComicData["firstStripNum"] = mCurrent.firstStripNum();
-    mComicData["maxStripNum"] = mCurrent.maxStripNum();
-    mComicData["isLeftToRight"] = mCurrent.isLeftToRight();
-    mComicData["isTopToBottom"] = mCurrent.isTopToBottom();
+    mComicData[QStringLiteral("image")] = mCurrent.image();
+    mComicData[QStringLiteral("prev")] = mCurrent.prev();
+    mComicData[QStringLiteral("next")] = mCurrent.next();
+    mComicData[QStringLiteral("additionalText")] = mCurrent.additionalText();
+
+    mComicData[QStringLiteral("websiteUrl")] = mCurrent.websiteUrl().toString();
+    mComicData[QStringLiteral("websiteHost")] = mCurrent.websiteUrl().host();
+    mComicData[QStringLiteral("imageUrl")] = mCurrent.websiteUrl().toString();
+    mComicData[QStringLiteral("shopUrl")] = mCurrent.websiteUrl().toString();
+    mComicData[QStringLiteral("first")] = mCurrent.first();
+    mComicData[QStringLiteral("stripTitle")] = mCurrent.stripTitle();
+    mComicData[QStringLiteral("author")] = mCurrent.author();
+    mComicData[QStringLiteral("title")] = mCurrent.title();
+
+    mComicData[QStringLiteral("suffixType")] = QStringLiteral("Date");
+    mComicData[QStringLiteral("current")] = mCurrent.current();
+    //mComicData[QStringLiteral("last")] = mCurrent.last();
+    mComicData[QStringLiteral("currentReadable")] = mCurrent.currentReadable();
+    mComicData[QStringLiteral("firstStripNum")] = mCurrent.firstStripNum();
+    mComicData[QStringLiteral("maxStripNum")] = mCurrent.maxStripNum();
+    mComicData[QStringLiteral("isLeftToRight")] = mCurrent.isLeftToRight();
+    mComicData[QStringLiteral("isTopToBottom")] = mCurrent.isTopToBottom();
 
     emit comicDataChanged();
 }
diff --git a/applets/comic/comicarchivedialog.cpp \
b/applets/comic/comicarchivedialog.cpp index 0b2ee943d..3306d8adf 100644
--- a/applets/comic/comicarchivedialog.cpp
+++ b/applets/comic/comicarchivedialog.cpp
@@ -40,8 +40,8 @@ ComicArchiveDialog::ComicArchiveDialog( const QString &pluginName, \
const QString  
     switch ( mIdentifierType ) {
         case Date: {
-            const QDate current = QDate::fromString( currentIdentifierSuffix, \
                "yyyy-MM-dd" );
-            const QDate first = QDate::fromString( firstIdentifierSuffix, \
"yyyy-MM-dd" ); +            const QDate current = \
QDate::fromString(currentIdentifierSuffix, QStringLiteral("yyyy-MM-dd")); +           \
const QDate first = QDate::fromString(firstIdentifierSuffix, \
QStringLiteral("yyyy-MM-dd"));  const QDate today = QDate::currentDate();
             QDate maxDate = today;
             if ( current.isValid() ) {
@@ -162,8 +162,8 @@ void ComicArchiveDialog::slotOkClicked()
 
     switch ( mIdentifierType ) {
         case Date:
-            fromIdentifier = ui.fromDate->date().toString( "yyyy-MM-dd" );
-            toIdentifier = ui.toDate->date().toString( "yyyy-MM-dd" );
+            fromIdentifier = \
ui.fromDate->date().toString(QStringLiteral("yyyy-MM-dd")); +            toIdentifier \
= ui.toDate->date().toString(QStringLiteral("yyyy-MM-dd"));  break;
         case Number: {
             fromIdentifier = QString::number( ui.fromNumber->value() );
diff --git a/applets/comic/comicarchivejob.cpp b/applets/comic/comicarchivejob.cpp
index 7a67b373c..2698e7914 100644
--- a/applets/comic/comicarchivejob.cpp
+++ b/applets/comic/comicarchivejob.cpp
@@ -95,14 +95,14 @@ void ComicArchiveJob::setToIdentifier( const QString \
&toIdentifier )  {
     mToIdentifier = toIdentifier;
     mToIdentifierSuffix = mToIdentifier;
-    mToIdentifierSuffix.remove( mPluginName + ':' );
+    mToIdentifierSuffix.remove(mPluginName + QLatin1Char(':'));
 }
 
 void ComicArchiveJob::setFromIdentifier( const QString &fromIdentifier )
 {
     mFromIdentifier = fromIdentifier;
     mFromIdentifierSuffix = mFromIdentifier;
-    mFromIdentifierSuffix.remove( mPluginName + ':' );
+    mFromIdentifierSuffix.remove(mPluginName + QLatin1Char(':'));
 }
 
 void ComicArchiveJob::start()
@@ -139,21 +139,21 @@ void ComicArchiveJob::dataUpdated( const QString &source, const \
Plasma::DataEngi  return;
     }
 
-    const QString currentIdentifier = data[ "Identifier" ].toString();
+    const QString currentIdentifier = data[QStringLiteral("Identifier")].toString();
     QString currentIdentifierSuffix = currentIdentifier;
-    currentIdentifierSuffix.remove( mPluginName + ':' );
+    currentIdentifierSuffix.remove(mPluginName + QLatin1Char(':'));
 
-    const QImage image = data[ "Image" ].value<QImage>();
-    const bool hasError = data[ "Error" ].toBool() || image.isNull();
-    const QString previousIdentifierSuffix = data[ "Previous identifier suffix" \
                ].toString();
-    const QString nextIdentifierSuffix = data[ "Next identifier suffix" \
                ].toString();
-    const QString firstIdentifierSuffix = data[ "First strip identifier suffix" \
].toString(); +    const QImage image = \
data[QStringLiteral("Image")].value<QImage>(); +    const bool hasError = \
data[QStringLiteral("Error")].toBool() || image.isNull(); +    const QString \
previousIdentifierSuffix = data[QStringLiteral("Previous identifier \
suffix")].toString(); +    const QString nextIdentifierSuffix = \
data[QStringLiteral("Next identifier suffix")].toString(); +    const QString \
firstIdentifierSuffix = data[QStringLiteral("First strip identifier \
suffix")].toString();  
-    mAuthors << data[ "Comic Author" ].toString().split( ',', \
QString::SkipEmptyParts ); +    mAuthors << data[QStringLiteral("Comic \
Author")].toString().split(QLatin1Char(','), QString::SkipEmptyParts);  \
mAuthors.removeDuplicates();  
     if ( mComicTitle.isEmpty() ) {
-        mComicTitle = data[ "Title" ].toString();
+        mComicTitle = data[QStringLiteral("Title")].toString();
     }
 
     if ( hasError ) {
@@ -272,8 +272,8 @@ void ComicArchiveJob::defineTotalNumber( const QString \
&currentSuffix )  //if there are no strips for certain days/numbers
     if ( !currentSuffix.isEmpty() ) {
         if ( mIdentifierType == Date ) {
-            const QDate current = QDate::fromString( currentSuffix, "yyyy-MM-dd" );
-            const QDate to = QDate::fromString( mToIdentifierSuffix, "yyyy-MM-dd" );
+            const QDate current = QDate::fromString(currentSuffix, \
QStringLiteral("yyyy-MM-dd")); +            const QDate to = \
QDate::fromString(mToIdentifierSuffix, QStringLiteral("yyyy-MM-dd"));  if ( \
current.isValid() && to.isValid() ) {  //processed files + files still to download
                 mTotalFiles = mProcessedFiles + qAbs( current.daysTo( to ) );
@@ -304,8 +304,8 @@ void ComicArchiveJob::findTotalNumberFromTo()
     }
 
     if ( mIdentifierType == Date ) {
-        const QDate from = QDate::fromString( mFromIdentifierSuffix, "yyyy-MM-dd" );
-        const QDate to = QDate::fromString( mToIdentifierSuffix, "yyyy-MM-dd" );
+        const QDate from = QDate::fromString( mFromIdentifierSuffix, \
QStringLiteral("yyyy-MM-dd")); +        const QDate to = \
QDate::fromString(mToIdentifierSuffix, QStringLiteral("yyyy-MM-dd"));  if ( \
from.isValid() && to.isValid() ) {  mTotalFiles = qAbs( from.daysTo( to ) ) + 1;
         }
@@ -324,7 +324,7 @@ void ComicArchiveJob::findTotalNumberFromTo()
 
 QString ComicArchiveJob::suffixToIdentifier( const QString &suffix ) const
 {
-    return mPluginName + ':' + suffix;
+    return mPluginName + QLatin1Char(':') + suffix;
 }
 
 void ComicArchiveJob::requestComic( QString identifier ) //krazy:exclude=passbyvalue
@@ -336,8 +336,8 @@ void ComicArchiveJob::requestComic( QString identifier ) \
//krazy:exclude=passbyv  }
 
     emit description( this, i18n( "Creating Comic Book Archive" ),
-                      qMakePair( QString( "source" ), identifier ),
-                      qMakePair( QString( "destination" ), mDest.toString() ) );
+                      qMakePair(QStringLiteral("source"), identifier),
+                      qMakePair(QStringLiteral("destination"), mDest.toString()));
 
     mEngine->connectSource( identifier, this );
 //    mEngine->query( identifier );
diff --git a/applets/comic/comicdata.cpp b/applets/comic/comicdata.cpp
index 2a03f6965..37f6248aa 100644
--- a/applets/comic/comicdata.cpp
+++ b/applets/comic/comicdata.cpp
@@ -37,21 +37,21 @@ void ComicData::init(const QString &id, const KConfigGroup \
&config)  
 void ComicData::load()
 {
-    mScaleComic = mCfg.readEntry("scaleToContent_" + mId, false);
-    mMaxStripNum = mCfg.readEntry("maxStripNum_" + mId, 0);
-    mStored = mCfg.readEntry("storedPosition_" + mId, QString());
+    mScaleComic = mCfg.readEntry(QLatin1String("scaleToContent_") + mId, false);
+    mMaxStripNum = mCfg.readEntry(QLatin1String("maxStripNum_") + mId, 0);
+    mStored = mCfg.readEntry(QLatin1String("storedPosition_") + mId, QString());
 }
 
 void ComicData::save()
 {
-    mCfg.writeEntry("scaleToContent_" + mId,  mScaleComic);
-    mCfg.writeEntry("maxStripNum_" + mId, mMaxStripNum);
-    mCfg.writeEntry("storedPosition_" + id(), mStored);
+    mCfg.writeEntry(QLatin1String("scaleToContent_") + mId,  mScaleComic);
+    mCfg.writeEntry(QLatin1String("maxStripNum_") + mId, mMaxStripNum);
+    mCfg.writeEntry(QLatin1String("storedPosition_") + id(), mStored);
 
     // no next, thus the most recent strip
     if (!hasNext()) {
-        mCfg.writeEntry("lastStripVisited_" + mId, true);
-        mCfg.writeEntry("lastStrip_" + mId, mLast);
+        mCfg.writeEntry(QLatin1String("lastStripVisited_") + mId, true);
+        mCfg.writeEntry(QLatin1String("lastStrip_") + mId, mLast);
     }
 }
 
@@ -69,40 +69,40 @@ void ComicData::storePosition(bool store)
 
 void ComicData::setData(const Plasma::DataEngine::Data &data)
 {
-    const bool hasError = data[ "Error" ].toBool();
+    const bool hasError = data[QStringLiteral("Error")].toBool();
     if (!hasError) {
-        mImage = data["Image"].value<QImage>();
-        mPrev = data["Previous identifier suffix"].toString();
-        mNext = data["Next identifier suffix"].toString();
-        mAdditionalText = data["Additional text"].toString();
+        mImage = data[QStringLiteral("Image")].value<QImage>();
+        mPrev = data[QStringLiteral("Previous identifier suffix")].toString();
+        mNext = data[QStringLiteral("Next identifier suffix")].toString();
+        mAdditionalText = data[QStringLiteral("Additional text")].toString();
     }
 
-    mWebsiteUrl = data[ "Website Url" ].value<QUrl>();
-    mImageUrl = data["Image Url"].value<QUrl>();
-    mShopUrl = data[ "Shop Url" ].value<QUrl>();
-    mFirst = data[ "First strip identifier suffix" ].toString();
-    mStripTitle = data[ "Strip title" ].toString();
-    mAuthor = data[ "Comic Author" ].toString();
-    mTitle = data[ "Title" ].toString();
+    mWebsiteUrl = data[QStringLiteral("Website Url")].value<QUrl>();
+    mImageUrl = data[QStringLiteral("Image Url")].value<QUrl>();
+    mShopUrl = data[QStringLiteral("Shop Url")].value<QUrl>();
+    mFirst = data[QStringLiteral("First strip identifier suffix")].toString();
+    mStripTitle = data[QStringLiteral("Strip title")].toString();
+    mAuthor = data[QStringLiteral("Comic Author")].toString();
+    mTitle = data[QStringLiteral("Title")].toString();
 
-    const QString suffixType = data[ "SuffixType" ].toString();
-    if ( suffixType == "Date" ) {
+    const QString suffixType = data[QStringLiteral("SuffixType")].toString();
+    if ( suffixType == QLatin1String("Date")) {
         mType = Date;
-    } else if ( suffixType == "Number" ) {
+    } else if ( suffixType == QLatin1String("Number")) {
         mType = Number;
     } else {
         mType = String;
     }
 
-    QString temp = data["Identifier"].toString();
-    mCurrent = temp.remove(mId + ':');
+    QString temp = data[QStringLiteral("Identifier")].toString();
+    mCurrent = temp.remove(mId + QLatin1Char(':'));
 
     //found a new last identifier
     if (!hasNext()) {
         mLast = mCurrent;
     }
 
-    mCurrentReadable = "";
+    mCurrentReadable.clear();
     if ( mType == Number ) {
         mCurrentReadable = i18nc("an abbreviation for Number", "# %1", mCurrent);
         int tempNum = mCurrent.toInt();
@@ -110,16 +110,16 @@ void ComicData::setData(const Plasma::DataEngine::Data &data)
             mMaxStripNum = tempNum;
         }
 
-        temp = mFirst.remove(mId + ':');
+        temp = mFirst.remove(mId + QLatin1Char(':'));
         mFirstStripNum = temp.toInt();
-    } else if ( mType == Date && QDate::fromString( temp, "yyyy-MM-dd" ).isValid() ) \
{ +    } else if (mType == Date && QDate::fromString(temp, \
QStringLiteral("yyyy-MM-dd")).isValid()) {  mCurrentReadable = mCurrent;
     } else if ( mType == String ) {
         mCurrentReadable = mCurrent;
     }
 
-    mIsLeftToRight = data["isLeftToRight"].toBool();
-    mIsTopToBottom = data["isTopToBottom"].toBool();
+    mIsLeftToRight = data[QStringLiteral("isLeftToRight")].toBool();
+    mIsTopToBottom = data[QStringLiteral("isTopToBottom")].toBool();
 
     save();
 }
@@ -137,10 +137,11 @@ void ComicData::createErrorPicture(const \
                Plasma::DataEngine::Data &data)
     p.drawText( QRect( 10, 10 , 480, 100 ), Qt::TextWordWrap | Qt::AlignHCenter | \
Qt::AlignVCenter, title );  QString text = i18n( "Maybe there is no Internet \
connection.\nMaybe the comic plugin is broken.\nAnother reason might be that there is \
no comic for this day/number/string, so choosing a different one might work." );  
-    mPrev = data["Previous identifier suffix"].toString();
+    mPrev = data[QStringLiteral("Previous identifier suffix")].toString();
     if (hasPrev()) {
-        if (!data["Identifier"].toString().isEmpty() ) {
-            mErrorStrip = data["Identifier"].toString();
+        const auto identifier = data[QStringLiteral("Identifier")].toString();
+        if (!identifier.isEmpty()) {
+            mErrorStrip = identifier;
         }
         text.append( i18n( "\n\nChoose the previous strip to go to the last cached \
strip." ) );  }
diff --git a/applets/comic/comicsaver.cpp b/applets/comic/comicsaver.cpp
index 27cdd7170..36fa11a8f 100644
--- a/applets/comic/comicsaver.cpp
+++ b/applets/comic/comicsaver.cpp
@@ -36,10 +36,10 @@ bool ComicSaver::save(const ComicData &comic)
 {
     const QString title = comic.title();
 
-    const QString name = title + " - " + comic.current() + ".png";
-    QUrl destUrl = QUrl::fromLocalFile( mSavingDir->getDir() + '/'+ name );
+    const QString name = title + QLatin1String(" - ") + comic.current() + \
QLatin1String(".png"); +    QUrl destUrl = QUrl::fromLocalFile(mSavingDir->getDir() + \
QLatin1Char('/') + name);  
-    destUrl = QFileDialog::getSaveFileUrl(nullptr, QString(), destUrl, "*.png" );
+    destUrl = QFileDialog::getSaveFileUrl(nullptr, QString(), destUrl, \
QStringLiteral("*.png"));  
     if ( !destUrl.isValid() ) {
         return false;
diff --git a/applets/comic/stripselector.cpp b/applets/comic/stripselector.cpp
index 94af85c09..8a71182ab 100644
--- a/applets/comic/stripselector.cpp
+++ b/applets/comic/stripselector.cpp
@@ -154,7 +154,7 @@ void DateStripSelector::select(const ComicData &currentStrip)
     KDatePicker *calendar = new KDatePicker;
     calendar->setAttribute(Qt::WA_DeleteOnClose);//to have destroyed emitted upon \
closing  calendar->setMinimumSize(calendar->sizeHint());
-    calendar->setDate(QDate::fromString(currentStrip.current(), "yyyy-MM-dd"));
+    calendar->setDate(QDate::fromString(currentStrip.current(), \
QStringLiteral("yyyy-MM-dd")));  
     connect(calendar, &KDatePicker::dateSelected, this, \
                &DateStripSelector::slotChosenDay);
     connect(calendar, &KDatePicker::dateEntered, this, \
&DateStripSelector::slotChosenDay); @@ -167,11 +167,11 @@ void \
DateStripSelector::select(const ComicData &currentStrip)  void \
DateStripSelector::slotChosenDay(const QDate &date)  {
     if (date <= QDate::currentDate()) {
-        QDate temp = QDate::fromString(mFirstIdentifierSuffix, "yyyy-MM-dd");
+        QDate temp = QDate::fromString(mFirstIdentifierSuffix, \
                QStringLiteral("yyyy-MM-dd"));
         // only update if date >= first strip date, or if there is no first
         // strip date
         if (temp.isValid() || date >= temp) {
-            emit stripChosen(date.toString("yyyy-MM-dd"));
+            emit stripChosen(date.toString(QStringLiteral("yyyy-MM-dd")));
         }
     }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic