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

List:       kde-commits
Subject:    [plasma-workspace] /: Add some QStringLiteral
From:       Laurent Montel <null () kde ! org>
Date:       2018-07-10 11:25:30
Message-ID: E1fcqlu-0004I8-QG () code ! kde ! org
[Download RAW message or body]

Git commit e1b9f53dff3c952afeb41c06def323ab87991644 by Laurent Montel.
Committed on 10/07/2018 at 11:25.
Pushed by mlaurent into branch 'master'.

Add some QStringLiteral

M  +3    -1    klipper/CMakeLists.txt
M  +5    -5    klipper/clipcommandprocess.cpp
M  +1    -1    klipper/klipper.cpp
M  +3    -3    klipper/popupproxy.cpp
M  +1    -1    klipper/tray.cpp
M  +3    -3    klipper/urlgrabber.cpp
M  +4    -0    ksmserver/CMakeLists.txt
M  +1    -1    ksmserver/main.cpp
M  +1    -1    ksmserver/startup.cpp
M  +2    -2    ksmserver/switchuserdialog.cpp
M  +4    -0    plasma-windowed/CMakeLists.txt
M  +1    -1    plasma-windowed/main.cpp
M  +4    -0    plasmacalendarintegration/CMakeLists.txt
M  +1    -1    plasmacalendarintegration/holidaysevents.cpp
M  +1    -1    plasmacalendarintegration/qmlhelper/holidayeventshelperplugin.cpp
M  +4    -4    shell/containmentconfigview.cpp
M  +6    -6    shell/currentcontainmentactionsmodel.cpp
M  +2    -2    shell/main.cpp
M  +3    -3    shell/panelview.cpp

https://commits.kde.org/plasma-workspace/e1b9f53dff3c952afeb41c06def323ab87991644

diff --git a/klipper/CMakeLists.txt b/klipper/CMakeLists.txt
index ce888cae..f90e1774 100644
--- a/klipper/CMakeLists.txt
+++ b/klipper/CMakeLists.txt
@@ -1,6 +1,8 @@
 set(KLIPPER_VERSION_STRING ${PROJECT_VERSION})
 add_definitions(-DTRANSLATION_DOMAIN=\"klipper\")
-
+add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
+add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
+add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
 set(libklipper_common_SRCS
     klipper.cpp
     urlgrabber.cpp
diff --git a/klipper/clipcommandprocess.cpp b/klipper/clipcommandprocess.cpp
index f126a6d8..49313205 100644
--- a/klipper/clipcommandprocess.cpp
+++ b/klipper/clipcommandprocess.cpp
@@ -32,13 +32,13 @@ ClipCommandProcess::ClipCommandProcess(const ClipAction& action, \
const ClipComma  m_newhistoryItem()
 {
     QHash<QChar,QString> map;
-    map.insert( 's', clip );
+    map.insert( QLatin1Char('s'), clip );
 
     // support %u, %U (indicates url param(s)) and %f, %F (file param(s))
-    map.insert( 'u', clip );
-    map.insert( 'U', clip );
-    map.insert( 'f', clip );
-    map.insert( 'F', clip );
+    map.insert( QLatin1Char('u'), clip );
+    map.insert( QLatin1Char('U'), clip );
+    map.insert( QLatin1Char('f'), clip );
+    map.insert( QLatin1Char('F'), clip );
 
     const QStringList matches = action.regExpMatches();
     // support only %0 and the first 9 matches...
diff --git a/klipper/klipper.cpp b/klipper/klipper.cpp
index 89740af5..97de688e 100644
--- a/klipper/klipper.cpp
+++ b/klipper/klipper.cpp
@@ -607,7 +607,7 @@ HistoryItemPtr Klipper::applyClipChanges( const QMimeData* \
clipData )  }
     Ignore lock( m_locklevel );
     HistoryItemPtr item = HistoryItem::create( clipData );
-    if (clipData->data("x-kde-passwordManagerHint") != QByteArrayLiteral("secret")) \
{ +    if (clipData->data(QStringLiteral("x-kde-passwordManagerHint")) != \
QByteArrayLiteral("secret")) {  history()->insert( item );
     }
     return item;
diff --git a/klipper/popupproxy.cpp b/klipper/popupproxy.cpp
index 316d50c7..4e94781c 100644
--- a/klipper/popupproxy.cpp
+++ b/klipper/popupproxy.cpp
@@ -93,7 +93,7 @@ void PopupProxy::tryInsertItem( HistoryItem const * const item,
     if ( image.isNull() ) {
         // Squeeze text strings so that do not take up the entire screen (or more)
         QString text = m_proxy_for_menu->fontMetrics().elidedText( \
                item->text().simplified(), Qt::ElideMiddle, m_menu_width );
-        text.replace( '&', QLatin1String("&&") );
+        text.replace( QLatin1Char('&'), QLatin1String("&&") );
         action->setText(text);
     } else {
 #if 0 // not used because QAction#setIcon does not respect this size; it does scale \
anyway. TODO: find a way to set a bigger image @@ -108,7 +108,7 @@ void \
PopupProxy::tryInsertItem( HistoryItem const * const item,  \
action->setData(item->uuid());  
     // if the m_proxy_for_menu is a submenu (aka a "More" menu) then it may the \
                case, that there is no other action in that menu yet.
-    QAction *before = index < m_proxy_for_menu->actions().count() ? \
m_proxy_for_menu->actions().at(index) : 0; +    QAction *before = index < \
m_proxy_for_menu->actions().count() ? m_proxy_for_menu->actions().at(index) : \
nullptr;  // insert the new action to the m_proxy_for_menu
     m_proxy_for_menu->insertAction(before, action);
 
@@ -167,7 +167,7 @@ int PopupProxy::insertFromSpill( int index ) {
     if (history->first() && m_spill_uuid != history->first()->uuid()) {
         QMenu* moreMenu = new QMenu(i18n("&More"), m_proxy_for_menu);
         connect(moreMenu, &QMenu::aboutToShow, this, &PopupProxy::slotAboutToShow);
-        QAction *before = index < m_proxy_for_menu->actions().count() ? \
m_proxy_for_menu->actions().at(index) : 0; +        QAction *before = index < \
m_proxy_for_menu->actions().count() ? m_proxy_for_menu->actions().at(index) : \
nullptr;  m_proxy_for_menu->insertMenu(before, moreMenu);
         m_proxy_for_menu = moreMenu;
     }
diff --git a/klipper/tray.cpp b/klipper/tray.cpp
index 80f93ace..071404a1 100644
--- a/klipper/tray.cpp
+++ b/klipper/tray.cpp
@@ -57,7 +57,7 @@ void KlipperTray::slotSetToolTipFromHistory()
         if (top->text().length() <= TOOLTIP_LENGTH_LIMIT) {
             setToolTipSubTitle(top->text());
         } else {
-            setToolTipSubTitle(top->text().left(TOOLTIP_LENGTH_LIMIT - 3) + "..." );
+            setToolTipSubTitle(top->text().left(TOOLTIP_LENGTH_LIMIT - 3) + \
QStringLiteral("...") );  }
     }
 }
diff --git a/klipper/urlgrabber.cpp b/klipper/urlgrabber.cpp
index 03a9b8c4..28d8ce0b 100644
--- a/klipper/urlgrabber.cpp
+++ b/klipper/urlgrabber.cpp
@@ -350,7 +350,7 @@ bool URLGrabber::isAvoidedWindow() const
         return false;
     }
     KWindowInfo info(active, NET::Properties(), NET::WM2WindowClass);
-    return m_myAvoidWindows.contains(info.windowClassName());
+    return m_myAvoidWindows.contains(QString::fromLatin1(info.windowClassName()));
 }
 
 
@@ -422,7 +422,7 @@ ClipAction::ClipAction( KSharedConfigPtr kc, const QString& group \
)  
     // read the commands
     for ( int i = 0; i < num; i++ ) {
-        QString _group = group + "/Command_%1";
+        QString _group = group + QStringLiteral("/Command_%1");
         KConfigGroup _cg(kc, _group.arg(i));
 
         addCommand( ClipCommand(_cg.readPathEntry( "Commandline", QString() ),
@@ -471,7 +471,7 @@ void ClipAction::save( KSharedConfigPtr kc, const QString& group \
) const  int i=0;
     // now iterate over all commands of this action
     foreach (const ClipCommand& cmd, m_myCommands) {
-        QString _group = group + "/Command_%1";
+        QString _group = group + QStringLiteral("/Command_%1");
         KConfigGroup cg(kc, _group.arg(i));
 
         cg.writePathEntry( "Commandline", cmd.command );
diff --git a/ksmserver/CMakeLists.txt b/ksmserver/CMakeLists.txt
index d2e4e968..178f3ba6 100644
--- a/ksmserver/CMakeLists.txt
+++ b/ksmserver/CMakeLists.txt
@@ -5,6 +5,10 @@ include_directories(${PHONON_INCLUDE_DIR})
 check_library_exists(ICE _IceTransNoListen "" HAVE__ICETRANSNOLISTEN)
 configure_file(config-ksmserver.h.cmake \
${CMAKE_CURRENT_BINARY_DIR}/config-ksmserver.h)  
+add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
+add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
+add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
+
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 add_subdirectory(logout-greeter)
 add_subdirectory(switchuser-greeter)
diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp
index 4b3fcf0b..93db1168 100644
--- a/ksmserver/main.cpp
+++ b/ksmserver/main.cpp
@@ -214,7 +214,7 @@ void sanity_check( int argc, char* argv[] )
         const QString msg_pre =
                 i18n("The following installation problem was detected\n"
                      "while trying to start KDE:") +
-                "\n\n    ";
+                QStringLiteral("\n\n    ");
         const QString msg_post = i18n("\n\nKDE is unable to start.\n");
         fputs(msg_pre.toUtf8().constData(), stderr);
         fprintf(stderr, "%s", msg.toUtf8().constData());
diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp
index a8dc11a2..064b5f36 100644
--- a/ksmserver/startup.cpp
+++ b/ksmserver/startup.cpp
@@ -105,7 +105,7 @@ class NotificationThread : public QThread
         QObject parent;
         KNotifyConfig notifyConfig(QStringLiteral("plasma_workspace"), QList< \
                QPair<QString,QString> >(), QStringLiteral("startkde"));
         const QString action = notifyConfig.readEntry(QStringLiteral("Action"));
-        if (action.isEmpty() || \
!action.split('|').contains(QStringLiteral("Sound"))) { +        if (action.isEmpty() \
|| !action.split(QLatin1Char('|')).contains(QStringLiteral("Sound"))) {  // no \
startup sound configured  return;
         }
diff --git a/ksmserver/switchuserdialog.cpp b/ksmserver/switchuserdialog.cpp
index d1f6e69e..01a0faf8 100644
--- a/ksmserver/switchuserdialog.cpp
+++ b/ksmserver/switchuserdialog.cpp
@@ -90,8 +90,8 @@ void KSMSwitchUserDialog::init()
 {
     rootContext()->setContextProperty(QStringLiteral("screenGeometry"), \
screen()->geometry());  
-    KPackage::Package package = \
                KPackage::PackageLoader::self()->loadPackage("Plasma/LookAndFeel");
-    KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "KDE");
+    KPackage::Package package = \
KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); + \
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), \
                QStringLiteral("KDE"));
     const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
     if (!packageName.isEmpty()) {
         package.setPath(packageName);
diff --git a/plasma-windowed/CMakeLists.txt b/plasma-windowed/CMakeLists.txt
index 867cdc7e..4cf96521 100644
--- a/plasma-windowed/CMakeLists.txt
+++ b/plasma-windowed/CMakeLists.txt
@@ -1,3 +1,7 @@
+add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
+add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
+add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
+
 set(plasmawindowed-app_SRCS
     plasmawindowedcorona.cpp
     plasmawindowedview.cpp
diff --git a/plasma-windowed/main.cpp b/plasma-windowed/main.cpp
index abc126e0..985c5c7e 100644
--- a/plasma-windowed/main.cpp
+++ b/plasma-windowed/main.cpp
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
     QQuickWindow::setDefaultAlphaBuffer(true);
 
     QApplication app(argc, argv);
-    app.setApplicationVersion(version);
+    app.setApplicationVersion(QLatin1String(version));
     app.setOrganizationDomain(QStringLiteral("kde.org"));
 
     KDBusService service(KDBusService::Unique);
diff --git a/plasmacalendarintegration/CMakeLists.txt \
b/plasmacalendarintegration/CMakeLists.txt index e881a62d..8556aaba 100644
--- a/plasmacalendarintegration/CMakeLists.txt
+++ b/plasmacalendarintegration/CMakeLists.txt
@@ -1,3 +1,7 @@
+add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
+add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
+add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
+
 set(holidays-plugin_SRCS
     holidaysevents.cpp
 )
diff --git a/plasmacalendarintegration/holidaysevents.cpp \
b/plasmacalendarintegration/holidaysevents.cpp index 62dcd836..675ff8d1 100644
--- a/plasmacalendarintegration/holidaysevents.cpp
+++ b/plasmacalendarintegration/holidaysevents.cpp
@@ -25,7 +25,7 @@
 HolidaysEventsPlugin::HolidaysEventsPlugin(QObject *parent)
     : CalendarEvents::CalendarEventsPlugin(parent)
 {
-    KSharedConfig::Ptr m_config = \
KSharedConfig::openConfig("plasma_calendar_holiday_regions"); +    KSharedConfig::Ptr \
m_config = KSharedConfig::openConfig(QStringLiteral("plasma_calendar_holiday_regions"));
  const KConfigGroup regionsConfig = m_config->group("General");
     QStringList regionCodes = regionsConfig.readEntry("selectedRegions", \
QStringList());  regionCodes.removeDuplicates();
diff --git a/plasmacalendarintegration/qmlhelper/holidayeventshelperplugin.cpp \
b/plasmacalendarintegration/qmlhelper/holidayeventshelperplugin.cpp index \
                9ae11d7b..4efb7990 100644
--- a/plasmacalendarintegration/qmlhelper/holidayeventshelperplugin.cpp
+++ b/plasmacalendarintegration/qmlhelper/holidayeventshelperplugin.cpp
@@ -33,7 +33,7 @@ class QmlConfigHelper : public QObject
 public:
     explicit QmlConfigHelper(QObject *parent = nullptr) : QObject(parent)
     {
-        KSharedConfig::Ptr config = \
KSharedConfig::openConfig("plasma_calendar_holiday_regions"); +        \
KSharedConfig::Ptr config = \
KSharedConfig::openConfig(QStringLiteral("plasma_calendar_holiday_regions"));  \
                m_configGroup = config->group("General");
         m_regions = m_configGroup.readEntry("selectedRegions", QStringList());
     }
diff --git a/shell/containmentconfigview.cpp b/shell/containmentconfigview.cpp
index b50dd73d..31e7ccbe 100644
--- a/shell/containmentconfigview.cpp
+++ b/shell/containmentconfigview.cpp
@@ -80,7 +80,7 @@ PlasmaQuick::ConfigModel \
                *ContainmentConfigView::containmentActionConfigModel()
         KPackage::Package pkg = \
KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));  
         foreach (const KPluginInfo &info, actions) {
-            pkg.setDefaultPackageRoot(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions", \
QStandardPaths::LocateDirectory)); +            \
pkg.setDefaultPackageRoot(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions"), \
                QStandardPaths::LocateDirectory));
             m_containmentActionConfigModel->appendCategory(info.icon(), info.name(), \
pkg.filePath("ui", QStringLiteral("config.qml")), info.pluginName());  }
 
@@ -116,8 +116,8 @@ PlasmaQuick::ConfigModel \
*ContainmentConfigView::wallpaperConfigModel()  if (!m_wallpaperConfigModel) {
         m_wallpaperConfigModel = new PlasmaQuick::ConfigModel(this);
 
-        for (const KPluginMetaData &m : \
                KPackage::PackageLoader::self()->listPackages("Plasma/Wallpaper")) {
-            KPackage::Package pkg = \
KPackage::PackageLoader::self()->loadPackage("Plasma/Wallpaper", m.pluginId()); +     \
for (const KPluginMetaData &m : \
KPackage::PackageLoader::self()->listPackages(QStringLiteral("Plasma/Wallpaper"))) { \
+            KPackage::Package pkg = \
KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper"), \
m.pluginId());  if (!pkg.isValid()) {
                 continue;
             }
@@ -167,7 +167,7 @@ void ContainmentConfigView::setCurrentWallpaper(const QString \
&wallpaper)  
         //we have to construct an independent ConfigPropertyMap when we want to \
                configure wallpapers that are not the current one
         KPackage::Package pkg = \
                KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));
                
-        pkg.setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers");
+        pkg.setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR \
"/wallpapers"));  pkg.setPath(wallpaper);
         QFile file(pkg.filePath("config", QStringLiteral("main.xml")));
         KConfigGroup cfg = m_containment->config();
diff --git a/shell/currentcontainmentactionsmodel.cpp \
b/shell/currentcontainmentactionsmodel.cpp index 4e9cb9cc..4d509b9a 100644
--- a/shell/currentcontainmentactionsmodel.cpp
+++ b/shell/currentcontainmentactionsmodel.cpp
@@ -244,16 +244,16 @@ void CurrentContainmentActionsModel::showAbout(int row, \
QQuickItem *ctx)  
     KPluginInfo info = m_plugins[action]->pluginInfo();
 
-    KAboutData aboutData(info.name().toUtf8(),
+    KAboutData aboutData(info.name(),
             ki18n(info.name().toUtf8()).toString(),
-            info.version().toUtf8(),
+            info.version(),
             ki18n(info.comment().toUtf8()).toString(),
             KAboutLicense::byKeyword(info.license()).key(),
-            QByteArray(),
-            QByteArray(), info.website().toLatin1(),
-            info.email().toLatin1());
+            QString(),
+            QString(), info.website(),
+            info.email());
 
-    aboutData.addAuthor(ki18n(info.author().toUtf8()).toString(), QByteArray(), \
info.email().toLatin1()); +    \
aboutData.addAuthor(ki18n(info.author().toUtf8()).toString(), QString(), \
info.email());  
     KAboutApplicationDialog *aboutDialog = new KAboutApplicationDialog(aboutData, \
qobject_cast<QWidget*>(parent()));  \
                aboutDialog->setWindowIcon(QIcon::fromTheme(info.icon()));
diff --git a/shell/main.cpp b/shell/main.cpp
index 6e241360..e4945a24 100644
--- a/shell/main.cpp
+++ b/shell/main.cpp
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
     if (cliOptions.isSet(standaloneOption)) {
         if (cliOptions.isSet(shellPluginOption)) {
             ShellManager::s_standaloneOption = true;
-            app.setApplicationName("plasmashell_"+cliOptions.value(shellPluginOption));
 +            app.setApplicationName(QStringLiteral("plasmashell_") + \
cliOptions.value(shellPluginOption));  app.setQuitOnLastWindowClosed(true);
 
             KDBusService service(KDBusService::Unique);
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
         if (configGroup.readEntry("SceneGraphBackend") != QLatin1String("software")) \
                {
             configGroup.writeEntry("SceneGraphBackend", "software", \
KConfigBase::Global | KConfigBase::Persistent);  configGroup.sync();
-            QProcess::startDetached("plasmashell", app.arguments());
+            QProcess::startDetached(QStringLiteral("plasmashell"), app.arguments());
         } else {
             QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets);
             QMessageBox::critical(nullptr, i18n("Plasma Failed To Start"),
diff --git a/shell/panelview.cpp b/shell/panelview.cpp
index dbdf356f..18496205 100644
--- a/shell/panelview.cpp
+++ b/shell/panelview.cpp
@@ -124,10 +124,10 @@ KConfigGroup PanelView::panelConfig(ShellCorona *corona, \
                Plasma::Containment *co
     views = KConfigGroup(&views, QStringLiteral("Panel %1").arg(containment->id()));
 
     if (containment->formFactor() == Plasma::Types::Vertical) {
-        return KConfigGroup(&views, "Vertical" + \
QString::number(screen->size().height())); +        return KConfigGroup(&views, \
QStringLiteral("Vertical") + QString::number(screen->size().height()));  //treat \
everything else as horizontal  } else {
-        return KConfigGroup(&views, "Horizontal" + \
QString::number(screen->size().width())); +        return KConfigGroup(&views, \
QStringLiteral("Horizontal") + QString::number(screen->size().width()));  }
 }
 
@@ -1141,7 +1141,7 @@ void PanelView::containmentChanged()
         if (containment()->destroyed()) {
             KConfigGroup views(m_corona->applicationConfig(), "PlasmaViews");
             for (auto grp : views.groupList()) {
-                if (grp.contains(QRegExp("Panel " + \
QString::number(containment()->id()) + "$"))) { +                if \
(grp.contains(QRegExp(QStringLiteral("Panel ") + QString::number(containment()->id()) \
                + QStringLiteral("$")))) {
                     qDebug() << "Panel" << containment()->id() << "removed by user";
                     views.deleteGroup(grp);
                 }


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

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