Commit e1b9f53d authored by Laurent Montel's avatar Laurent Montel 😁

Add some QStringLiteral

parent edd5e889
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
......
......@@ -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...
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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("...") );
}
}
}
......
......@@ -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 );
......
......@@ -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)
......
......@@ -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());
......
......@@ -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;
}
......
......@@ -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);
......
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
......
......@@ -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);
......
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
)
......
......@@ -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();
......
......@@ -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());
}
......
......@@ -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();
......
......@@ -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()));
......
......@@ -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"),
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment