From f53365633cc04439a09a7302dd9d7cd26e784c93 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Thu, 29 Aug 2019 07:23:49 +0200 Subject: [PATCH] GIT_SILENT: Use QLatin1String in QString::contains etc. Fix replace usage --- .../core/windowthumbnail.cpp | 2 +- .../appbackgroundprovider.cpp | 2 +- src/plasma/applet.cpp | 2 +- .../packagestructure/plasmoidpackage.cpp | 2 +- src/plasma/pluginloader.cpp | 4 +-- src/plasma/private/storage.cpp | 4 +-- src/plasma/private/storagethread.cpp | 10 +++---- src/plasma/private/theme_p.cpp | 14 ++++----- src/plasma/scripting/scriptengine.cpp | 4 +-- src/plasma/svg.cpp | 2 +- src/plasma/theme.cpp | 16 +++++----- src/plasmapkg/main.cpp | 30 +++++++++---------- src/plasmaquick/appletquickitem.cpp | 6 ++-- src/plasmaquick/packageurlinterceptor.cpp | 6 ++-- src/plasmaquick/packageurlinterceptor.h | 10 +++---- .../qml/plasmoid/containmentinterface.cpp | 2 +- 16 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/declarativeimports/core/windowthumbnail.cpp b/src/declarativeimports/core/windowthumbnail.cpp index 64cd11e76..e8e318b10 100644 --- a/src/declarativeimports/core/windowthumbnail.cpp +++ b/src/declarativeimports/core/windowthumbnail.cpp @@ -163,7 +163,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem *parent) setFlag(ItemHasContents); if (QGuiApplication *gui = dynamic_cast(QCoreApplication::instance())) { - m_xcb = (gui->platformName() == QStringLiteral("xcb")); + m_xcb = (gui->platformName() == QLatin1String("xcb")); if (m_xcb) { gui->installNativeEventFilter(this); #if HAVE_XCB_COMPOSITE diff --git a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp index 0a64d7274..87ee0ac73 100644 --- a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp +++ b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp @@ -19,7 +19,7 @@ #include "appbackgroundprovider_p.h" -#include +#include #include #include #include diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index eaec9a58a..5ca148388 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -787,7 +787,7 @@ Applet *Applet::loadPlasmoid(const QString &path, uint appletId) if (md.isValid()) { QStringList types = md.serviceTypes(); - if (types.contains(QStringLiteral("Plasma/Containment"))) { + if (types.contains(QLatin1String("Plasma/Containment"))) { return new Containment(md, appletId); } else { return new Applet(md, nullptr, appletId); diff --git a/src/plasma/packagestructure/plasmoidpackage.cpp b/src/plasma/packagestructure/plasmoidpackage.cpp index 53366c1ab..7070b1f96 100644 --- a/src/plasma/packagestructure/plasmoidpackage.cpp +++ b/src/plasma/packagestructure/plasmoidpackage.cpp @@ -47,7 +47,7 @@ public: if (!package->metadata().isValid()) { return; } - if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { + if (package->metadata().serviceTypes().contains(QLatin1String("Plasma/Containment"))) { package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets")); } else { package->removeDefinition("compactapplet"); diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp index e69ee2257..d6715db5b 100644 --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -215,7 +215,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari QVariantList allArgs; allArgs << QVariant::fromValue(p) << p.metadata().fileName() << appletId << args; - if (p.metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { + if (p.metadata().serviceTypes().contains(QLatin1String("Plasma/Containment"))) { applet = new Containment(nullptr, allArgs); } else { applet = new Applet(nullptr, allArgs); @@ -637,7 +637,7 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type, KConfigGroup group(KSharedConfig::openConfig(), "General"); auto filter = [&type, &category, &parentApp](const KPluginMetaData &md) -> bool { - if (!md.serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { + if (!md.serviceTypes().contains(QLatin1String("Plasma/Containment"))) { return false; } if (!parentApp.isEmpty() && md.value(QStringLiteral("X-KDE-ParentApp")) != parentApp) { diff --git a/src/plasma/private/storage.cpp b/src/plasma/private/storage.cpp index 7a76aa8ec..e00bc0d38 100644 --- a/src/plasma/private/storage.cpp +++ b/src/plasma/private/storage.cpp @@ -136,8 +136,8 @@ Storage::Storage(QObject *parent) } } - m_clientName = m_clientName.replace(QLatin1Char('.'), QLatin1Char('_')); - m_clientName = m_clientName.replace(QLatin1Char('-'), QLatin1Char('_')); + m_clientName.replace(QLatin1Char('.'), QLatin1Char('_')); + m_clientName.replace(QLatin1Char('-'), QLatin1Char('_')); setName(QStringLiteral("storage")); } diff --git a/src/plasma/private/storagethread.cpp b/src/plasma/private/storagethread.cpp index a6d0fce8e..587b4597e 100644 --- a/src/plasma/private/storagethread.cpp +++ b/src/plasma/private/storagethread.cpp @@ -246,11 +246,11 @@ void StorageThread::retrieve(QPointer wcaller, const QVariantMap &pa if (success) { QSqlRecord rec = query.record(); - const int keyColumn = rec.indexOf(QStringLiteral("id")); - const int textColumn = rec.indexOf(QStringLiteral("txt")); - const int intColumn = rec.indexOf(QStringLiteral("int")); - const int floatColumn = rec.indexOf(QStringLiteral("float")); - const int binaryColumn = rec.indexOf(QStringLiteral("binary")); + const int keyColumn = rec.indexOf(QLatin1String("id")); + const int textColumn = rec.indexOf(QLatin1String("txt")); + const int intColumn = rec.indexOf(QLatin1String("int")); + const int floatColumn = rec.indexOf(QLatin1String("float")); + const int binaryColumn = rec.indexOf(QLatin1String("binary")); QVariantMap data; while (query.next()) { diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 315c7eb60..d4917388e 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -303,7 +303,7 @@ void ThemePrivate::onAppExitCleanup() QString ThemePrivate::imagePath(const QString& theme, const QString& type, const QString& image) { - QString subdir = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % type % image; + QString subdir = QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % type % image; return QStandardPaths::locate(QStandardPaths::GenericDataLocation, subdir); } @@ -699,7 +699,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const void ThemePrivate::processWallpaperSettings(KConfigBase *metadata) { - if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QStringLiteral(DEFAULT_WALLPAPER_THEME)) { + if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QLatin1String(DEFAULT_WALLPAPER_THEME)) { return; } @@ -784,7 +784,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings themeName = theme; // load the color scheme config - const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/colors")) + const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/colors")) : QString(); //qCDebug(LOG_PLASMA) << "we're going for..." << colorsFile << "*******************"; @@ -800,12 +800,12 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors); viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors); complementaryColorScheme = KColorScheme(QPalette::Active, KColorScheme::Complementary, colors); - const QString wallpaperPath = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/wallpapers/"); + const QString wallpaperPath = QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/wallpapers/"); hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty(); // load the wallpaper settings, if any if (realTheme) { - const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop"))); + const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop"))); KConfig metadata(metadataPath, KConfig::SimpleConfig); pluginInfo = KPluginInfo(metadataPath); @@ -821,7 +821,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings while (!fallback.isEmpty() && !fallbackThemes.contains(fallback)) { fallbackThemes.append(fallback); - QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % fallback % QLatin1Literal("/metadata.desktop"))); + QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % fallback % QLatin1String("/metadata.desktop"))); KConfig metadata(metadataPath, KConfig::SimpleConfig); KConfigGroup cg(&metadata, "Settings"); fallback = cg.readEntry("FallbackTheme", QString()); @@ -832,7 +832,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings } foreach (const QString &theme, fallbackThemes) { - QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop"))); + QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop"))); KConfig metadata(metadataPath, KConfig::SimpleConfig); processWallpaperSettings(&metadata); } diff --git a/src/plasma/scripting/scriptengine.cpp b/src/plasma/scripting/scriptengine.cpp index 2faec97b4..dab8d16e8 100644 --- a/src/plasma/scripting/scriptengine.cpp +++ b/src/plasma/scripting/scriptengine.cpp @@ -41,8 +41,8 @@ static QVector listEngines(Types::ComponentTypes types, std::fu if (!filter(plugin)) continue; const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes")); - if (((types & Types::AppletComponent) && componentTypes.contains(QStringLiteral("Applet"))) - ||((types & Types::DataEngineComponent) && componentTypes.contains(QStringLiteral("DataEngine")))) { + if (((types & Types::AppletComponent) && componentTypes.contains(QLatin1String("Applet"))) + ||((types & Types::DataEngineComponent) && componentTypes.contains(QLatin1String("DataEngine")))) { ret << plugin; } } diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index f8bd18450..6f90d3d0a 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -186,7 +186,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath) QString actualPath = imagePath; if (imagePath.startsWith(QLatin1String("file://"))) { //length of file:// - actualPath = actualPath.mid(7); + actualPath.remove(0, 7); } bool isThemed = !actualPath.isEmpty() && !QDir::isAbsolutePath(actualPath); diff --git a/src/plasma/theme.cpp b/src/plasma/theme.cpp index afa181367..511064b89 100644 --- a/src/plasma/theme.cpp +++ b/src/plasma/theme.cpp @@ -149,12 +149,12 @@ QString Theme::imagePath(const QString &name) const return QString(); } - const QString svgzName = name % QLatin1Literal(".svgz"); + const QString svgzName = name % QLatin1String(".svgz"); QString path = d->findInTheme(svgzName, d->themeName); if (path.isEmpty()) { // try for an uncompressed svg file - const QString svgName = name % QLatin1Literal(".svg"); + const QString svgName = name % QLatin1String(".svg"); path = d->findInTheme(svgName, d->themeName); // search in fallback themes if necessary @@ -215,10 +215,10 @@ QString Theme::wallpaperPath(const QSize &size) const // to override the theme? if (d->hasWallpapers) { // check in the theme first - fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % image, d->themeName); + fullPath = d->findInTheme(QLatin1String("wallpapers/") % image, d->themeName); if (fullPath.isEmpty()) { - fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % defaultImage, d->themeName); + fullPath = d->findInTheme(QLatin1String("wallpapers/") % defaultImage, d->themeName); } } @@ -256,8 +256,8 @@ bool Theme::currentThemeHasImage(const QString &name) const return false; } - return !(d->findInTheme(name % QLatin1Literal(".svgz"), d->themeName, false).isEmpty()) || - !(d->findInTheme(name % QLatin1Literal(".svg"), d->themeName, false).isEmpty()); + return !(d->findInTheme(name % QLatin1String(".svgz"), d->themeName, false).isEmpty()) || + !(d->findInTheme(name % QLatin1String(".svg"), d->themeName, false).isEmpty()); } KSharedConfigPtr Theme::colorScheme() const @@ -337,7 +337,7 @@ bool Theme::findInRectsCache(const QString &image, const QString &element, QRect } KConfigGroup imageGroup(d->svgElementsCache, image); - rect = imageGroup.readEntry(element % QLatin1Literal("Size"), QRectF()); + rect = imageGroup.readEntry(element % QLatin1String("Size"), QRectF()); if (rect.isValid()) { return true; @@ -394,7 +394,7 @@ void Theme::insertIntoRectsCache(const QString &image, const QString &element, c if (rect.isValid()) { KConfigGroup imageGroup(d->svgElementsCache, image); - imageGroup.writeEntry(element % QLatin1Literal("Size"), rect); + imageGroup.writeEntry(element % QLatin1String("Size"), rect); } else { QHash >::iterator it = d->invalidElements.find(image); if (it == d->invalidElements.end()) { diff --git a/src/plasmapkg/main.cpp b/src/plasmapkg/main.cpp index ba2f7035d..a6ad39780 100644 --- a/src/plasmapkg/main.cpp +++ b/src/plasmapkg/main.cpp @@ -27,31 +27,31 @@ QString typeFromLegacy(const QString &type) { - if (type == QStringLiteral("plasmoid")) { + if (type == QLatin1String("plasmoid")) { return QStringLiteral("Plasma/Applet"); - } else if (type == QStringLiteral("package")) { + } else if (type == QLatin1String("package")) { return QStringLiteral("Plasma/Generic"); - } else if (type == QStringLiteral("theme")) { + } else if (type == QLatin1String("theme")) { return QStringLiteral("Plasma/Theme"); - } else if (type == QStringLiteral("wallpaper")) { + } else if (type == QLatin1String("wallpaper")) { return QStringLiteral("Plasma/ImageWallpaper"); - } else if (type == QStringLiteral("dataengine")) { + } else if (type == QLatin1String("dataengine")) { return QStringLiteral("Plasma/DataEngine"); - } else if (type == QStringLiteral("runner")) { + } else if (type == QLatin1String("runner")) { return QStringLiteral("Plasma/Runner"); - } else if (type == QStringLiteral("wallpaperplugin")) { + } else if (type == QLatin1String("wallpaperplugin")) { return QStringLiteral("Plasma/Wallpaper"); - } else if (type == QStringLiteral("lookandfeel")) { + } else if (type == QLatin1String("lookandfeel")) { return QStringLiteral("Plasma/LookAndFeel"); - } else if (type == QStringLiteral("shell")) { + } else if (type == QLatin1String("shell")) { return QStringLiteral("Plasma/Shell"); - } else if (type == QStringLiteral("layout-template")) { + } else if (type == QLatin1String("layout-template")) { return QStringLiteral("Plasma/LayoutTemplate"); - } else if (type == QStringLiteral("kwineffect")) { + } else if (type == QLatin1String("kwineffect")) { return QStringLiteral("KWin/Effect"); - } else if (type == QStringLiteral("windowswitcher")) { + } else if (type == QLatin1String("windowswitcher")) { return QStringLiteral("KWin/WindowSwitcher"); - } else if (type == QStringLiteral("kwinscript")) { + } else if (type == QLatin1String("kwinscript")) { return QStringLiteral("KWin/Script"); } else { return type; @@ -67,12 +67,12 @@ int main(int argc, char **argv) //plasmapkg2 had some hardcoded types, kpackagetool5 requires the servicetype passed as the type parameter //convert between the two //user passed -t typeName - int typeIndex = params.indexOf(QStringLiteral("-t")); + int typeIndex = params.indexOf(QLatin1String("-t")); if (typeIndex > -1 && params.length() > typeIndex + 1) { params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1)); } else { //user passed --type typeName - typeIndex = params.indexOf(QStringLiteral("--type")); + typeIndex = params.indexOf(QLatin1String("--type")); if (typeIndex > -1 && params.length() > typeIndex + 1) { params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1)); } else { diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp index f2bfb89d5..7e2c68ada 100644 --- a/src/plasmaquick/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -62,9 +62,9 @@ AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickIte if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) { const QString policy = QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower(); - if (policy == QStringLiteral("aggressive")) { + if (policy == QLatin1String("aggressive")) { s_preloadPolicy = Aggressive; - } else if (policy == QStringLiteral("none")) { + } else if (policy == QLatin1String("none")) { s_preloadPolicy = None; } } @@ -95,7 +95,7 @@ int AppletQuickItemPrivate::preloadWeight() const const QStringList provides(KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"))); //some applet types we want a bigger weight - if (provides.contains(QStringLiteral("org.kde.plasma.launchermenu"))) { + if (provides.contains(QLatin1String("org.kde.plasma.launchermenu"))) { defaultWeight = DefaultLauncherPreloadWeight; } else { defaultWeight = DefaultPreloadWeight; diff --git a/src/plasmaquick/packageurlinterceptor.cpp b/src/plasmaquick/packageurlinterceptor.cpp index bc0e85255..729ad7f6a 100644 --- a/src/plasmaquick/packageurlinterceptor.cpp +++ b/src/plasmaquick/packageurlinterceptor.cpp @@ -92,8 +92,8 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept //qDebug() << "Intercepted URL:" << path << type; //we assume we never rewritten qml/qmldir files - if (path.path().endsWith(QStringLiteral("qml")) || path.path().endsWith(QStringLiteral("qmldir")) - || path.path().endsWith(QStringLiteral("/inline"))) { + if (path.path().endsWith(QLatin1String("qml")) || path.path().endsWith(QStringLiteral("qmldir")) + || path.path().endsWith(QLatin1String("/inline"))) { return path; } const QString prefix = QString::fromUtf8(prefixForType(type, path.path())); @@ -104,7 +104,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept QString rewritten = plainPath.replace(match, QStringLiteral("/%1/\\1").arg(prefix)); //search it in a resource or as a file on disk - if (!(rewritten.contains(QStringLiteral("qrc")) && + if (!(rewritten.contains(QLatin1String("qrc")) && QFile::exists(QStringLiteral(":") + QUrl(rewritten).path())) && !QFile::exists(QUrl(rewritten).path())) { return path; diff --git a/src/plasmaquick/packageurlinterceptor.h b/src/plasmaquick/packageurlinterceptor.h index 191eed49b..86a5837de 100644 --- a/src/plasmaquick/packageurlinterceptor.h +++ b/src/plasmaquick/packageurlinterceptor.h @@ -74,14 +74,14 @@ public: //failed by type, let's try by extension const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower(); - if (extension == QStringLiteral("svg") || extension == QStringLiteral("svgz") || - extension == QStringLiteral("png") || extension == QStringLiteral("gif") || - extension == QStringLiteral("jpg") || extension == QStringLiteral("jpeg")) { + if (extension == QLatin1String("svg") || extension == QStringLiteral("svgz") || + extension == QLatin1String("png") || extension == QStringLiteral("gif") || + extension == QLatin1String("jpg") || extension == QStringLiteral("jpeg")) { return QByteArray("images"); //FIXME: are those necessary? are they *always* caught by type? - } else if (extension == QStringLiteral("js")) { + } else if (extension == QLatin1String("js")) { return QByteArray("code"); - } else if (extension == QStringLiteral("qml") || extension == QStringLiteral("qmldir")) { + } else if (extension == QLatin1String("qml") || extension == QStringLiteral("qmldir")) { return QByteArray("ui"); //everything else, throw it in "data" } else { diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index 333fffe37..d7f579f5c 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -915,7 +915,7 @@ QList ContainmentInterface::actions() const i = 0; foreach (QAction *a, m_containment->corona()->actions()->actions()) { - if (a->objectName() == QStringLiteral("lock widgets") || a->menu()) { + if (a->objectName() == QLatin1String("lock widgets") || a->menu()) { //It is up to the Containment to decide if the user is allowed or not //to lock/unluck the widgets, so corona should not add one when there is none //(user is not allow) and it shouldn't add another one when there is already