From 45e687ae8261e3c112883d7641d3b85d1a7a9ec1 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Sun, 2 Jul 2017 11:15:23 +0200 Subject: [PATCH] Fix clazy warning --- src/konfigurator/konfigurator.cpp | 24 ++++---- src/manager/allyourbase.cpp | 42 ++++++------- src/manager/authorizedappmodel.cpp | 4 +- src/manager/connectedappmodel.cpp | 2 +- src/manager/disconnectappbutton.cpp | 2 +- src/manager/kwalleteditor.cpp | 78 ++++++++++++------------ src/manager/kwalletmanager.cpp | 66 ++++++++++---------- src/manager/kwalletmanagerwidget.cpp | 2 +- src/manager/kwalletmanagerwidgetitem.cpp | 4 +- src/manager/kwalletpopup.cpp | 14 ++--- src/manager/kwmapeditor.cpp | 4 +- src/manager/main.cpp | 12 ++-- src/manager/revokeauthbutton.cpp | 2 +- 13 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/konfigurator/konfigurator.cpp b/src/konfigurator/konfigurator.cpp index de7e15d..da54520 100644 --- a/src/konfigurator/konfigurator.cpp +++ b/src/konfigurator/konfigurator.cpp @@ -47,7 +47,7 @@ K_PLUGIN_FACTORY(KWalletFactory, registerPlugin();) KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList &args) : KCModule(parent, args), - _cfg(KSharedConfig::openConfig(QLatin1String("kwalletrc"), KConfig::NoGlobals)) + _cfg(KSharedConfig::openConfig(QStringLiteral("kwalletrc"), KConfig::NoGlobals)) { KAboutData *about = new KAboutData(QStringLiteral("kcmkwallet5"), i18n("KDE Wallet Control Module"), @@ -87,7 +87,7 @@ KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList &args) _wcw->_accessList->setContextMenuPolicy(Qt::CustomContextMenu); updateWalletLists(); - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.kwalletmanager"))) { + if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kwalletmanager"))) { _wcw->_launch->hide(); } @@ -172,12 +172,12 @@ void KWalletConfig::newNetworkWallet() void KWalletConfig::launchManager() { - if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.kwalletmanager5"))) { - QProcess::startDetached(QLatin1String("kwalletmanager5 --show")); + if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kwalletmanager5"))) { + QProcess::startDetached(QStringLiteral("kwalletmanager5 --show")); } else { - QDBusInterface kwalletd(QLatin1String("org.kde.kwalletmanager5"), QLatin1String("/kwalletmanager5/MainWindow_1")); - kwalletd.call(QLatin1String("show")); - kwalletd.call(QLatin1String("raise")); + QDBusInterface kwalletd(QStringLiteral("org.kde.kwalletmanager5"), QStringLiteral("/kwalletmanager5/MainWindow_1")); + kwalletd.call(QStringLiteral("show")); + kwalletd.call(QStringLiteral("raise")); } } @@ -228,13 +228,13 @@ void KWalletConfig::load() // perform cleanup in the kwalletrc file, by removing entries that correspond to non-existent // (previously deleted, for example) wallets QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - path.append(QString("/kwalletd/%1.kwl").arg(walletName)); + path.append(QStringLiteral("/kwalletd/%1.kwl").arg(walletName)); if (!QFile::exists(path)) { // if the wallet no longer exists, delete the entries from the configuration file and skip to next entry - KConfigGroup cfgAllow = KSharedConfig::openConfig("kwalletrc")->group("Auto Allow"); + KConfigGroup cfgAllow = KSharedConfig::openConfig(QStringLiteral("kwalletrc"))->group("Auto Allow"); cfgAllow.deleteEntry(walletName); - KConfigGroup cfgDeny = KSharedConfig::openConfig("kwalletrc")->group("Auto Deny"); + KConfigGroup cfgDeny = KSharedConfig::openConfig(QStringLiteral("kwalletrc"))->group("Auto Deny"); cfgDeny.deleteEntry(walletName); continue; } @@ -338,12 +338,12 @@ void KWalletConfig::save() _cfg->sync(); // this restarts kwalletd if necessary - QDBusInterface kwalletd(QLatin1String("org.kde.kwalletd5"), QLatin1String("/modules/kwalletd"), QLatin1String(KWALLETMANAGERINTERFACE)); + QDBusInterface kwalletd(QStringLiteral("org.kde.kwalletd5"), QStringLiteral("/modules/kwalletd"), QStringLiteral(KWALLETMANAGERINTERFACE)); // if wallet was deactivated, then kwalletd will exit upon start so check // the status before invoking reconfigure if (kwalletd.isValid()) { // this will eventually make kwalletd exit upon deactivation - kwalletd.call(QLatin1String("reconfigure")); + kwalletd.call(QStringLiteral("reconfigure")); } emit changed(false); diff --git a/src/manager/allyourbase.cpp b/src/manager/allyourbase.cpp index 2720644..40ff305 100644 --- a/src/manager/allyourbase.cpp +++ b/src/manager/allyourbase.cpp @@ -42,7 +42,7 @@ KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, QTreeWidget *parent, const QString &name, int entries) : QTreeWidgetItem(parent, KWalletFolderItemClass), _wallet(w), _name(name), _entries(entries) { - setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_entries)); + setText(0, QStringLiteral("%1 (%2)").arg(_name).arg(_entries)); setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled); setIcon(0, getFolderIcon(KIconLoader::Small)); } @@ -55,7 +55,7 @@ QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group group) pix = QIcon::fromTheme(_name.toLower()).pixmap(IconSize(group), IconSize(group)); if (pix.isNull()) - pix = QIcon::fromTheme(QLatin1String("folder-red")).pixmap(IconSize(group), IconSize(group)); + pix = QIcon::fromTheme(QStringLiteral("folder-red")).pixmap(IconSize(group), IconSize(group)); return pix; } @@ -64,7 +64,7 @@ void KWalletFolderItem::refresh() { const QString saveFolder = _wallet->currentFolder(); _wallet->setFolder(_name); - setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_wallet->entryList().count())); + setText(0, QStringLiteral("%1 (%2)").arg(_name).arg(_wallet->entryList().count())); _wallet->setFolder(saveFolder); } @@ -82,7 +82,7 @@ void KWalletFolderItem::refreshItemsCount() } } } - setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(visibleLeafCount)); + setText(0, QStringLiteral("%1 (%2)").arg(_name).arg(visibleLeafCount)); } KWalletContainerItem *KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type) @@ -121,8 +121,8 @@ QTreeWidgetItem *KWalletFolderItem::getItem(const QString &key) bool KWalletFolderItem::acceptDrop(const QMimeData *mime) const { - return mime->hasFormat("application/x-kwallet-entry") || - mime->hasFormat("text/uri-list"); + return mime->hasFormat(QStringLiteral("application/x-kwallet-entry")) || + mime->hasFormat(QStringLiteral("text/uri-list")); } QString KWalletFolderItem::name() const @@ -295,8 +295,8 @@ void KWalletItem::processDropEvent(QDropEvent *e) el = dynamic_cast(e->source()->parent()); } - if (e->mimeData()->hasFormat("application/x-kwallet-folder") || - e->mimeData()->hasFormat("text/uri-list")) { + if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-folder")) || + e->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) { // FIXME: don't allow the drop if the wallet name is the same KWallet::Wallet *_wallet = KWallet::Wallet::openWallet(text(), listWidget()->topLevelWidget()->winId()); if (!_wallet) { @@ -308,8 +308,8 @@ void KWalletItem::processDropEvent(QDropEvent *e) QByteArray data; - if (e->mimeData()->hasFormat("application/x-kwallet-folder")) { - data = e->mimeData()->data("application/x-kwallet-folder"); + if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-folder"))) { + data = e->mimeData()->data(QStringLiteral("application/x-kwallet-folder")); e->accept(); } else { // text/uri-list const QList urls = e->mimeData()->urls(); @@ -407,7 +407,7 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item) } } - if (e->mimeData()->hasFormat("application/x-kwallet-entry")) { + if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-entry"))) { //do nothing if we are in the same folder if (sel && sel->parent()->parent() == KWalletEntryList::getItemFolder(item)) { @@ -415,26 +415,26 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item) return; } isEntry = true; - data = e->mimeData()->data("application/x-kwallet-entry"); + data = e->mimeData()->data(QStringLiteral("application/x-kwallet-entry")); if (data.isEmpty()) { e->ignore(); return; } e->accept(); - } else if (e->mimeData()->hasFormat("application/x-kwallet-folder")) { + } else if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-folder"))) { //do nothing if we are in the same wallet if (this == el) { e->ignore(); return; } isEntry = false; - data = e->mimeData()->data("application/x-kwallet-folder"); + data = e->mimeData()->data(QStringLiteral("application/x-kwallet-folder")); if (data.isEmpty()) { e->ignore(); return; } e->accept(); - } else if (e->mimeData()->hasFormat("text/uri-list")) { + } else if (e->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) { const QList urls = e->mimeData()->urls(); if (urls.isEmpty()) { e->ignore(); @@ -549,7 +549,7 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const QByteArray value; ei->_wallet->readEntry(i->text(0), value); ds << value; - sd->setData("application/x-kwallet-entry", a); + sd->setData(QStringLiteral("application/x-kwallet-entry"), a); } else if (i->type() == KWalletFolderItemClass) { const KWalletFolderItem *fi = dynamic_cast(i); if (!fi) { @@ -563,7 +563,7 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const ds << KWALLETFOLDERMAGIC; ds << *fi; - sd->setData("application/x-kwallet-folder", a); + sd->setData(QStringLiteral("application/x-kwallet-folder"), a); } return sd; } @@ -615,14 +615,14 @@ void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e) QTreeWidgetItem *i = itemAt(e->pos()); e->ignore(); if (i) { - if (e->mimeData()->hasFormat("application/x-kwallet-entry") || - e->mimeData()->hasFormat("text/uri-list")) { + if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-entry")) || + e->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) { e->accept(); } } - if ((e->mimeData()->hasFormat("application/x-kwallet-folder") && + if ((e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-folder")) && e->source() != viewport()) || - e->mimeData()->hasFormat("text/uri-list")) { + e->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) { e->accept(); } } diff --git a/src/manager/authorizedappmodel.cpp b/src/manager/authorizedappmodel.cpp index 64af206..d0be6d1 100644 --- a/src/manager/authorizedappmodel.cpp +++ b/src/manager/authorizedappmodel.cpp @@ -26,7 +26,7 @@ AuthorizedAppModel::AuthorizedAppModel(KWallet::Wallet *wallet): QStandardItemModel(), - _cfg(KSharedConfig::openConfig(QLatin1String("kwalletrc"), KConfig::NoGlobals)), + _cfg(KSharedConfig::openConfig(QStringLiteral("kwalletrc"), KConfig::NoGlobals)), _wallet(wallet) { // TODO: handle "Auto Deny" applications @@ -41,7 +41,7 @@ AuthorizedAppModel::AuthorizedAppModel(KWallet::Wallet *wallet): int row = 0; Q_FOREACH(QString appName, apps) { setItem(row, 0, new QStandardItem(appName)); - setItem(row, 1, new QStandardItem("dummy")); // this item will be hidden by the disconnect button, see below setIndexWidget call + setItem(row, 1, new QStandardItem(QStringLiteral("dummy"))); // this item will be hidden by the disconnect button, see below setIndexWidget call _authorizedAppsIndexMap.insert(appName, QPersistentModelIndex(index(row, 0))); row++; } diff --git a/src/manager/connectedappmodel.cpp b/src/manager/connectedappmodel.cpp index ca90000..34542a5 100644 --- a/src/manager/connectedappmodel.cpp +++ b/src/manager/connectedappmodel.cpp @@ -44,7 +44,7 @@ void ConnectedAppModel::refresh() item->setEditable(false); setItem(row, 0, item); // this item will be hidden by the disconnect button, see below setIndexWidget call - setItem(row, 1, new QStandardItem("dummy")); + setItem(row, 1, new QStandardItem(QStringLiteral("dummy"))); _connectedAppsIndexMap.insert(appName, QPersistentModelIndex(index(row, 0))); row++; } diff --git a/src/manager/disconnectappbutton.cpp b/src/manager/disconnectappbutton.cpp index 7a5b09b..09a46fd 100644 --- a/src/manager/disconnectappbutton.cpp +++ b/src/manager/disconnectappbutton.cpp @@ -25,7 +25,7 @@ DisconnectAppButton::DisconnectAppButton(const QString &appName, KWallet::Wallet *wallet) : _appName(appName), _wallet(wallet) { - setObjectName(QString("Disconnect_%1").arg(appName)); + setObjectName(QStringLiteral("Disconnect_%1").arg(appName)); setText(i18n("Disconnect")); connect(this, &DisconnectAppButton::clicked, this, &DisconnectAppButton::onClicked); } diff --git a/src/manager/kwalleteditor.cpp b/src/manager/kwalleteditor.cpp index 3547028..739fa42 100644 --- a/src/manager/kwalleteditor.cpp +++ b/src/manager/kwalleteditor.cpp @@ -86,8 +86,8 @@ KWalletEditor::KWalletEditor(QWidget *parent, const char *name) _splitter->setStretchFactor(1, 2); _contextMenu = new QMenu(this); - _undoChanges->setIcon(QIcon::fromTheme(QLatin1String("edit-undo"))); - _saveChanges->setIcon(QIcon::fromTheme(QLatin1String("document-save"))); + _undoChanges->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo"))); + _saveChanges->setIcon(QIcon::fromTheme(QStringLiteral("document-save"))); _hasUnsavedChanges = false; QVBoxLayout *box = new QVBoxLayout(_entryListFrame); @@ -196,47 +196,47 @@ KActionCollection *KWalletEditor::actionCollection() void KWalletEditor::createActions(KActionCollection *actionCollection) { - _newFolderAction = actionCollection->addAction(QLatin1String("create_folder")); + _newFolderAction = actionCollection->addAction(QStringLiteral("create_folder")); _newFolderAction->setText(i18n("&New Folder...")); - _newFolderAction->setIcon(QIcon::fromTheme(QLatin1String("folder-new"))); + _newFolderAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); - _deleteFolderAction = actionCollection->addAction(QLatin1String("delete_folder")); + _deleteFolderAction = actionCollection->addAction(QStringLiteral("delete_folder")); _deleteFolderAction->setText(i18n("&Delete Folder")); - _mergeAction = actionCollection->addAction(QLatin1String("wallet_merge")); + _mergeAction = actionCollection->addAction(QStringLiteral("wallet_merge")); _mergeAction->setText(i18n("&Import a wallet...")); - _importAction = actionCollection->addAction(QLatin1String("wallet_import")); + _importAction = actionCollection->addAction(QStringLiteral("wallet_import")); _importAction->setText(i18n("&Import XML...")); - _exportAction = actionCollection->addAction(QLatin1String("wallet_export")); + _exportAction = actionCollection->addAction(QStringLiteral("wallet_export")); _exportAction->setText(i18n("&Export as XML...")); - _copyPassAction = actionCollection->addAction(QLatin1String("copy_action")); + _copyPassAction = actionCollection->addAction(QStringLiteral("copy_action")); _copyPassAction->setText(i18n("&Copy")); actionCollection->setDefaultShortcut(_copyPassAction, Qt::Key_C + Qt::CTRL); _copyPassAction->setEnabled(false); - _newEntryAction = actionCollection->addAction(QLatin1String("new_entry")); + _newEntryAction = actionCollection->addAction(QStringLiteral("new_entry")); _newEntryAction->setText(i18n("&New...")); actionCollection->setDefaultShortcut(_newEntryAction, Qt::Key_Insert); _newEntryAction->setEnabled(false); - _renameEntryAction = actionCollection->addAction(QLatin1String("rename_entry")); + _renameEntryAction = actionCollection->addAction(QStringLiteral("rename_entry")); _renameEntryAction->setText(i18n("&Rename")); actionCollection->setDefaultShortcut(_renameEntryAction, Qt::Key_F2); _renameEntryAction->setEnabled(false); - _deleteEntryAction = actionCollection->addAction(QLatin1String("delete_entry")); + _deleteEntryAction = actionCollection->addAction(QStringLiteral("delete_entry")); _deleteEntryAction->setText(i18n("&Delete")); actionCollection->setDefaultShortcut(_deleteEntryAction, Qt::Key_Delete); _deleteEntryAction->setEnabled(false); - _alwaysShowContentsAction = actionCollection->addAction(QLatin1String("always_show_contents")); + _alwaysShowContentsAction = actionCollection->addAction(QStringLiteral("always_show_contents")); _alwaysShowContentsAction->setText(i18n("Always show contents")); _alwaysShowContentsAction->setCheckable(true); - _alwaysHideContentsAction = actionCollection->addAction(QLatin1String("always_hide_contents")); + _alwaysHideContentsAction = actionCollection->addAction(QStringLiteral("always_hide_contents")); _alwaysHideContentsAction->setText(i18n("Always hide contents")); _alwaysHideContentsAction->setCheckable(true); } @@ -623,7 +623,7 @@ void KWalletEditor::entrySelectionChanged(QTreeWidgetItem *item) if (fi) { _currentFolder = fi->name(); - _entryTitle->setText(QString::fromLatin1("%1").arg(fi->text(0))); + _entryTitle->setText(QStringLiteral("%1").arg(fi->text(0))); _iconTitle->setPixmap(fi->getFolderIcon(KIconLoader::Toolbar)); } @@ -716,7 +716,7 @@ void KWalletEditor::updateEntries(const QString &folder) } fi->refresh(); if (fi->name() == _currentFolder) { - _entryTitle->setText(QString::fromLatin1("%1").arg(fi->text(0))); + _entryTitle->setText(QStringLiteral("%1").arg(fi->text(0))); } if (!_entryList->currentItem()) { _entryName->clear(); @@ -823,7 +823,7 @@ void KWalletEditor::newEntry() _entryList->scrollToItem(ni); fi->refresh(); - _entryTitle->setText(QString::fromLatin1("%1").arg(fi->text(0))); + _entryTitle->setText(QStringLiteral("%1").arg(fi->text(0))); } } @@ -889,7 +889,7 @@ void KWalletEditor::deleteEntry() delete item; entrySelectionChanged(_entryList->currentItem()); fi->refresh(); - _entryTitle->setText(QString::fromLatin1("%1").arg(fi->text(0))); + _entryTitle->setText(QStringLiteral("%1").arg(fi->text(0))); } } } @@ -937,7 +937,7 @@ enum MergePlan { Prompt = 0, Always = 1, Never = 2, Yes = 3, No = 4 }; void KWalletEditor::importWallet() { - QUrl url = QFileDialog::getOpenFileUrl(this, QString(), QUrl(), QLatin1String("*.kwl")); + QUrl url = QFileDialog::getOpenFileUrl(this, QString(), QUrl(), QStringLiteral("*.kwl")); if (url.isEmpty()) { return; @@ -976,7 +976,7 @@ void KWalletEditor::importWallet() QMap > map; QSet mergedkeys; // prevents re-merging already merged entries. int rc; - rc = w->readMapList(QLatin1String("*"), map); + rc = w->readMapList(QStringLiteral("*"), map); if (rc == 0) { QMap >::ConstIterator me; for (me = map.constBegin(); me != map.constEnd(); ++me) { @@ -1007,7 +1007,7 @@ void KWalletEditor::importWallet() } QMap pwd; - rc = w->readPasswordList(QLatin1String("*"), pwd); + rc = w->readPasswordList(QStringLiteral("*"), pwd); if (rc == 0) { QMap::ConstIterator pe; for (pe = pwd.constBegin(); pe != pwd.constEnd(); ++pe) { @@ -1038,7 +1038,7 @@ void KWalletEditor::importWallet() } QMap ent; - rc = w->readEntryList(QLatin1String("*"), ent); + rc = w->readEntryList(QStringLiteral("*"), ent); if (rc == 0) { QMap::ConstIterator ee; for (ee = ent.constBegin(); ee != ent.constEnd(); ++ee) { @@ -1081,7 +1081,7 @@ void KWalletEditor::importWallet() void KWalletEditor::importXML() { - QUrl url = QFileDialog::getOpenFileUrl(this, QString(), QUrl(), QLatin1String("*.xml")); + QUrl url = QFileDialog::getOpenFileUrl(this, QString(), QUrl(), QStringLiteral("*.xml")); if (url.isEmpty()) { return; @@ -1115,7 +1115,7 @@ void KWalletEditor::importXML() continue; } - QString fname = e.attribute(QLatin1String("name")); + QString fname = e.attribute(QStringLiteral("name")); if (fname.isEmpty()) { n = n.nextSibling(); continue; @@ -1128,7 +1128,7 @@ void KWalletEditor::importXML() while (!enode.isNull()) { e = enode.toElement(); QString type = e.tagName().toLower(); - QString ename = e.attribute(QLatin1String("name")); + QString ename = e.attribute(QStringLiteral("name")); bool hasEntry = _w->hasEntry(ename); if (hasEntry && mp == Prompt) { KBetterThanKDialogBase *bd; @@ -1162,7 +1162,7 @@ void KWalletEditor::importXML() while (!mapNode.isNull()) { QDomElement mape = mapNode.toElement(); if (mape.tagName().toLower() == QLatin1String("mapentry")) { - map[mape.attribute(QLatin1String("name"))] = mape.text(); + map[mape.attribute(QStringLiteral("name"))] = mape.text(); } mapNode = mapNode.nextSibling(); } @@ -1186,11 +1186,11 @@ void KWalletEditor::exportXML() xml.writeStartDocument(); const QStringList fl = _w->folderList(); - xml.writeStartElement(QLatin1String("wallet")); - xml.writeAttribute(QLatin1String("name"), _walletName); + xml.writeStartElement(QStringLiteral("wallet")); + xml.writeAttribute(QStringLiteral("name"), _walletName); for (QStringList::const_iterator i = fl.constBegin(); i != fl.constEnd(); ++i) { - xml.writeStartElement(QLatin1String("folder")); - xml.writeAttribute(QLatin1String("name"), *i); + xml.writeStartElement(QStringLiteral("folder")); + xml.writeAttribute(QStringLiteral("name"), *i); _w->setFolder(*i); QStringList entries = _w->entryList(); for (QStringList::const_iterator j = entries.constBegin(); j != entries.constEnd(); ++j) { @@ -1198,8 +1198,8 @@ void KWalletEditor::exportXML() case KWallet::Wallet::Password: { QString pass; if (_w->readPassword(*j, pass) == 0) { - xml.writeStartElement(QLatin1String("password")); - xml.writeAttribute(QLatin1String("name"), *j); + xml.writeStartElement(QStringLiteral("password")); + xml.writeAttribute(QStringLiteral("name"), *j); xml.writeCharacters(pass); xml.writeEndElement(); } @@ -1208,8 +1208,8 @@ void KWalletEditor::exportXML() case KWallet::Wallet::Stream: { QByteArray ba; if (_w->readEntry(*j, ba) == 0) { - xml.writeStartElement(QLatin1String("stream")); - xml.writeAttribute(QLatin1String("name"), *j); + xml.writeStartElement(QStringLiteral("stream")); + xml.writeAttribute(QStringLiteral("name"), *j); xml.writeCharacters(QLatin1String(KCodecs::base64Encode(ba))); xml.writeEndElement(); } @@ -1218,11 +1218,11 @@ void KWalletEditor::exportXML() case KWallet::Wallet::Map: { QMap map; if (_w->readMap(*j, map) == 0) { - xml.writeStartElement(QLatin1String("map")); - xml.writeAttribute(QLatin1String("name"), *j); + xml.writeStartElement(QStringLiteral("map")); + xml.writeAttribute(QStringLiteral("name"), *j); for (QMap::ConstIterator k = map.constBegin(); k != map.constEnd(); ++k) { - xml.writeStartElement(QLatin1String("mapentry")); - xml.writeAttribute(QLatin1String("name"), k.key()); + xml.writeStartElement(QStringLiteral("mapentry")); + xml.writeAttribute(QStringLiteral("name"), k.key()); xml.writeCharacters(k.value()); xml.writeEndElement(); } @@ -1242,7 +1242,7 @@ void KWalletEditor::exportXML() xml.writeEndDocument(); tf.flush(); - QUrl url = QFileDialog::getSaveFileUrl(this, QString(), QUrl(), QLatin1String("*.xml")); + QUrl url = QFileDialog::getSaveFileUrl(this, QString(), QUrl(), QStringLiteral("*.xml")); if (url.isEmpty()) { return; diff --git a/src/manager/kwalletmanager.cpp b/src/manager/kwalletmanager.cpp index 2fb0df4..1f3a924 100644 --- a/src/manager/kwalletmanager.cpp +++ b/src/manager/kwalletmanager.cpp @@ -62,7 +62,7 @@ KWalletManager::KWalletManager(QWidget *parent, const char *name, Qt::WindowFlag } void KWalletManager::beginConfiguration() { - KConfig cfg(QLatin1String("kwalletrc")); // not sure why this setting isn't in kwalletmanagerrc... + KConfig cfg(QStringLiteral("kwalletrc")); // not sure why this setting isn't in kwalletmanagerrc... KConfigGroup walletConfigGroup(&cfg, "Wallet"); if (walletConfigGroup.readEntry("Enabled", true)){ QTimer::singleShot(0, this, SLOT(configUI())); @@ -79,23 +79,23 @@ void KWalletManager::beginConfiguration() { } void KWalletManager::configUI() { - QDBusConnection::sessionBus().registerObject(QLatin1String("/KWalletManager"), this, QDBusConnection::ExportScriptableSlots); - KConfig cfg(QLatin1String("kwalletrc")); // not sure why this setting isn't in kwalletmanagerrc... + QDBusConnection::sessionBus().registerObject(QStringLiteral("/KWalletManager"), this, QDBusConnection::ExportScriptableSlots); + KConfig cfg(QStringLiteral("kwalletrc")); // not sure why this setting isn't in kwalletmanagerrc... KConfigGroup walletConfigGroup(&cfg, "Wallet"); if (walletConfigGroup.readEntry("Launch Manager", false)) { _tray = new KStatusNotifierItem(this); - _tray->setObjectName(QLatin1String("kwalletmanager tray")); + _tray->setObjectName(QStringLiteral("kwalletmanager tray")); _tray->setCategory(KStatusNotifierItem::SystemServices); _tray->setStatus(KStatusNotifierItem::Passive); - _tray->setIconByName(QLatin1String("wallet-closed")); - _tray->setToolTip(QLatin1String("wallet-closed"), i18n("Wallet"), i18n("No wallets open.")); + _tray->setIconByName(QStringLiteral("wallet-closed")); + _tray->setToolTip(QStringLiteral("wallet-closed"), i18n("Wallet"), i18n("No wallets open.")); //connect(_tray, SIGNAL(quitSelected()), SLOT(shuttingDown())); const QStringList wl = KWallet::Wallet::walletList(); bool isOpen = false; for (QStringList::ConstIterator it = wl.begin(); it != wl.end(); ++it) { if (KWallet::Wallet::isOpen(*it)) { - _tray->setIconByName(QLatin1String("wallet-open")); - _tray->setToolTip(QLatin1String("wallet-open"), i18n("Wallet"), i18n("A wallet is open.")); + _tray->setIconByName(QStringLiteral("wallet-open")); + _tray->setToolTip(QStringLiteral("wallet-open"), i18n("Wallet"), i18n("A wallet is open.")); isOpen = true; break; } @@ -114,11 +114,11 @@ void KWalletManager::configUI() { updateWalletDisplay(); setCentralWidget(_managerWidget); - setAutoSaveSettings(QLatin1String("MainWindow"), true); + setAutoSaveSettings(QStringLiteral("MainWindow"), true); QFontMetrics fm = fontMetrics(); _managerWidget->setMinimumSize(16*fm.height(), 18*fm.height()); - m_kwalletdModule = new org::kde::KWallet(QLatin1String("org.kde.kwalletd5"), QLatin1String("/modules/kwalletd5"), QDBusConnection::sessionBus()); + m_kwalletdModule = new org::kde::KWallet(QStringLiteral("org.kde.kwalletd5"), QStringLiteral("/modules/kwalletd5"), QDBusConnection::sessionBus()); connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), this, SLOT(possiblyRescan(QString,QString,QString))); connect(m_kwalletdModule, &OrgKdeKWalletInterface::allWalletsClosed, this, &KWalletManager::allWalletsClosed); @@ -133,39 +133,39 @@ void KWalletManager::configUI() { // wallet closes before we are done opening. We will then stay // open. Must check that a wallet is still open here. - QAction *action = actionCollection()->addAction(QLatin1String("wallet_create")); + QAction *action = actionCollection()->addAction(QStringLiteral("wallet_create")); action->setText(i18n("&New Wallet...")); - action->setIcon(QIcon::fromTheme(QLatin1String("kwalletmanager"))); + action->setIcon(QIcon::fromTheme(QStringLiteral("kwalletmanager"))); connect(action, SIGNAL(triggered()), SLOT(createWallet())); - action = actionCollection()->addAction(QLatin1String("wallet_open")); + action = actionCollection()->addAction(QStringLiteral("wallet_open")); action->setText(i18n("Open Wallet...")); connect(action, SIGNAL(triggered()), this, SLOT(openWallet())); - action = actionCollection()->addAction(QLatin1String("wallet_delete")); + action = actionCollection()->addAction(QStringLiteral("wallet_delete")); action->setText(i18n("&Delete Wallet...")); - action->setIcon(QIcon::fromTheme(QLatin1String("trash-empty"))); + action->setIcon(QIcon::fromTheme(QStringLiteral("trash-empty"))); connect(action, &QAction::triggered, this, &KWalletManager::deleteWallet); - _walletsExportAction = actionCollection()->addAction("wallet_export_encrypted"); + _walletsExportAction = actionCollection()->addAction(QStringLiteral("wallet_export_encrypted")); _walletsExportAction->setText(i18n("Export as encrypted")); - _walletsExportAction->setIcon(QIcon::fromTheme("document-export")); + _walletsExportAction->setIcon(QIcon::fromTheme(QStringLiteral("document-export"))); connect(_walletsExportAction, &QAction::triggered, this, &KWalletManager::exportWallets); - action = actionCollection()->addAction("wallet_import_encrypted"); + action = actionCollection()->addAction(QStringLiteral("wallet_import_encrypted")); action->setText(i18n("&Import encrypted")); - action->setIcon(QIcon::fromTheme("document-import")); + action->setIcon(QIcon::fromTheme(QStringLiteral("document-import"))); connect(action, &QAction::triggered, this, &KWalletManager::importWallets); - QAction *act = actionCollection()->addAction(QLatin1String("wallet_settings")); + QAction *act = actionCollection()->addAction(QStringLiteral("wallet_settings")); act->setText(i18n("Configure &Wallet...")); - act->setIcon(QIcon::fromTheme(QLatin1String("configure"))); + act->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); connect(act, &QAction::triggered, this, &KWalletManager::setupWallet); if (_tray) { _tray->contextMenu()->addAction(act); } - act = actionCollection()->addAction(QLatin1String("close_all_wallets")); + act = actionCollection()->addAction(QStringLiteral("close_all_wallets")); act->setText(i18n("Close &All Wallets")); connect(act, &QAction::triggered, this, &KWalletManager::closeAllWallets); if (_tray) { @@ -175,7 +175,7 @@ void KWalletManager::configUI() { KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); - setupGUI(Keys | Save | Create, QLatin1String("kwalletmanager.rc")); + setupGUI(Keys | Save | Create, QStringLiteral("kwalletmanager.rc")); setStandardToolBarMenuEnabled(false); if (_tray) { @@ -185,7 +185,7 @@ void KWalletManager::configUI() { } _walletsExportAction->setDisabled(KWallet::Wallet::walletList().isEmpty()); - qApp->setObjectName(QLatin1String("kwallet")); // hack to fix docs + qApp->setObjectName(QStringLiteral("kwallet")); // hack to fix docs } KWalletManager::~KWalletManager() @@ -220,12 +220,12 @@ bool KWalletManager::queryClose() void KWalletManager::aWalletWasOpened() { if (_tray) { - _tray->setIconByName(QLatin1String("wallet-open")); - _tray->setToolTip(QLatin1String("wallet-open"), i18n("Wallet"), i18n("A wallet is open.")); + _tray->setIconByName(QStringLiteral("wallet-open")); + _tray->setToolTip(QStringLiteral("wallet-open"), i18n("Wallet"), i18n("A wallet is open.")); _tray->setStatus(KStatusNotifierItem::Active); } updateWalletDisplay(); - createGUI(QLatin1String("kwalletmanager.rc")); + createGUI(QStringLiteral("kwalletmanager.rc")); } void KWalletManager::updateWalletDisplay() @@ -280,8 +280,8 @@ void KWalletManager::openWalletFile(const QString &path) void KWalletManager::allWalletsClosed() { if (_tray) { - _tray->setIconByName(QLatin1String("wallet-closed")); - _tray->setToolTip(QLatin1String("wallet-closed"), i18n("Wallet"), i18n("No wallets open.")); + _tray->setIconByName(QStringLiteral("wallet-closed")); + _tray->setToolTip(QStringLiteral("wallet-closed"), i18n("Wallet"), i18n("No wallets open.")); _tray->setStatus(KStatusNotifierItem::Passive); } possiblyQuit(); @@ -289,7 +289,7 @@ void KWalletManager::allWalletsClosed() void KWalletManager::possiblyQuit() { - KConfig _cfg(QLatin1String("kwalletrc")); + KConfig _cfg(QStringLiteral("kwalletrc")); KConfigGroup cfg(&_cfg, "Wallet"); if (_windows.isEmpty() && !isVisible() && @@ -405,7 +405,7 @@ void KWalletManager::shuttingDown() void KWalletManager::setupWallet() { - KToolInvocation::startServiceByDesktopName(QLatin1String("kwalletconfig5")); + KToolInvocation::startServiceByDesktopName(QStringLiteral("kwalletconfig5")); } void KWalletManager::closeAllWallets() @@ -426,7 +426,7 @@ void KWalletManager::exportWallets() Q_ASSERT(dir.exists()); - const QStringList filesList = dir.entryList(QStringList() << "*.kwl" << "*.salt", + const QStringList filesList = dir.entryList(QStringList() << QStringLiteral("*.kwl") << QStringLiteral("*.salt"), QDir::Files | QDir::Readable | QDir::NoSymLinks); Q_ASSERT(!filesList.isEmpty()); @@ -468,7 +468,7 @@ void KWalletManager::importWallets() for (int i = 0; i < archiveEntries.size(); i++) { if (QFile::exists(destinationDir + archiveEntries.at(i)) - && archiveEntries.at(i).endsWith(".kwl")) { + && archiveEntries.at(i).endsWith(QLatin1String(".kwl"))) { QString walletName = archiveEntries.at(i); // remove ".kwl" walletName.chop(4); diff --git a/src/manager/kwalletmanagerwidget.cpp b/src/manager/kwalletmanagerwidget.cpp index 460c19f..868429e 100644 --- a/src/manager/kwalletmanagerwidget.cpp +++ b/src/manager/kwalletmanagerwidget.cpp @@ -127,7 +127,7 @@ QString KWalletManagerWidget::activeWalletName() const void KWalletManagerWidget::dragEnterEvent(QDragEnterEvent *e) { - if (e->mimeData()->hasFormat("application/x-kwallet-wallet")) { + if (e->mimeData()->hasFormat(QStringLiteral("application/x-kwallet-wallet"))) { e->accept(); } else { e->ignore(); diff --git a/src/manager/kwalletmanagerwidgetitem.cpp b/src/manager/kwalletmanagerwidgetitem.cpp index b01809a..7fb56a3 100644 --- a/src/manager/kwalletmanagerwidgetitem.cpp +++ b/src/manager/kwalletmanagerwidgetitem.cpp @@ -34,9 +34,9 @@ KWalletManagerWidgetItem::KWalletManagerWidgetItem(QWidget *widgetParent, const void KWalletManagerWidgetItem::updateWalletDisplay() { if (KWallet::Wallet::isOpen(_walletName)) { - setIcon(QIcon::fromTheme(QLatin1String("wallet-open"))); + setIcon(QIcon::fromTheme(QStringLiteral("wallet-open"))); } else { - setIcon(QIcon::fromTheme(QLatin1String("wallet-closed"))); + setIcon(QIcon::fromTheme(QStringLiteral("wallet-closed"))); } _controlWidget->updateWalletDisplay(); } diff --git a/src/manager/kwalletpopup.cpp b/src/manager/kwalletpopup.cpp index c9d55cf..12cd540 100644 --- a/src/manager/kwalletpopup.cpp +++ b/src/manager/kwalletpopup.cpp @@ -33,21 +33,21 @@ KWalletPopup::KWalletPopup(const QString &wallet, QWidget *parent, const char *n addSection(wallet); setObjectName(QLatin1String(name)); KActionCollection *ac = new KActionCollection(this/*, "kwallet context actions"*/); - ac->setObjectName(QLatin1String("kwallet context actions")); + ac->setObjectName(QStringLiteral("kwallet context actions")); QAction *act; - act = ac->addAction(QLatin1String("wallet_create")); + act = ac->addAction(QStringLiteral("wallet_create")); act->setText(i18n("&New Wallet...")); connect(act, &QAction::triggered, this, &KWalletPopup::createWallet); addAction(act); - act = ac->addAction(QLatin1String("wallet-open")); + act = ac->addAction(QStringLiteral("wallet-open")); act->setText(i18n("&Open...")); connect(act, &QAction::triggered, this, &KWalletPopup::openWallet); act->setShortcut(QKeySequence(Qt::Key_Return)); addAction(act); - act = ac->addAction(QLatin1String("wallet_password")); + act = ac->addAction(QStringLiteral("wallet_password")); act->setText(i18n("Change &Password...")); connect(act, &QAction::triggered, this, &KWalletPopup::changeWalletPassword); addAction(act); @@ -55,7 +55,7 @@ KWalletPopup::KWalletPopup(const QString &wallet, QWidget *parent, const char *n const QStringList ul = KWallet::Wallet::users(wallet); if (!ul.isEmpty()) { QMenu *pm = new QMenu(this); - pm->setObjectName(QLatin1String("Disconnect Apps")); + pm->setObjectName(QStringLiteral("Disconnect Apps")); int id = 7000; for (QStringList::const_iterator it = ul.begin(); it != ul.end(); ++it) { QAction *a = pm->addAction(*it, this, SLOT(disconnectApp())); @@ -68,13 +68,13 @@ KWalletPopup::KWalletPopup(const QString &wallet, QWidget *parent, const char *n act = KStandardAction::close(this, SLOT(closeWallet()), ac); - ac->addAction(QLatin1String("wallet_close"), act); + ac->addAction(QStringLiteral("wallet_close"), act); // FIXME: let's track this inside the manager so we don't need a dcop // roundtrip here. act->setEnabled(KWallet::Wallet::isOpen(wallet)); addAction(act); - act = ac->addAction(QLatin1String("wallet_delete")); + act = ac->addAction(QStringLiteral("wallet_delete")); act->setText(i18n("&Delete")); connect(act, &QAction::triggered, this, &KWalletPopup::deleteWallet); diff --git a/src/manager/kwmapeditor.cpp b/src/manager/kwmapeditor.cpp index fdff921..fed8e93 100644 --- a/src/manager/kwmapeditor.cpp +++ b/src/manager/kwmapeditor.cpp @@ -156,7 +156,7 @@ void KWMapEditor::reload() setRowCount(_map.count()); for (int x = row; x < rowCount(); ++x) { QToolButton *b = new QToolButton(this); - b->setIcon(QIcon::fromTheme("edit-delete")); + b->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); b->setToolTip(i18n("Delete Entry")); connect(b, &QToolButton::clicked, this, &KWMapEditor::erase); setCellWidget(x, 0, b); @@ -207,7 +207,7 @@ void KWMapEditor::addEntry() int x = rowCount(); insertRow(x); QToolButton *b = new QToolButton(this); - b->setIcon(QIcon::fromTheme("edit-delete")); + b->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); b->setToolTip(i18n("Delete Entry")); connect(b, &QToolButton::clicked, this, &KWMapEditor::erase); setCellWidget(x, 0, b); diff --git a/src/manager/main.cpp b/src/manager/main.cpp index a87162b..c2b6957 100644 --- a/src/manager/main.cpp +++ b/src/manager/main.cpp @@ -78,19 +78,19 @@ int main(int argc, char **argv) parser.addHelpOption(); parser.addVersionOption(); - parser.addOption(QCommandLineOption("show", i18n("Show window on startup"))); - parser.addOption(QCommandLineOption("kwalletd", i18n("For use by kwalletd only"))); - parser.addOption(QCommandLineOption("name", i18n("A wallet name"))); + parser.addOption(QCommandLineOption(QStringLiteral("show"), i18n("Show window on startup"))); + parser.addOption(QCommandLineOption(QStringLiteral("kwalletd"), i18n("For use by kwalletd only"))); + parser.addOption(QCommandLineOption(QStringLiteral("name"), i18n("A wallet name"))); parser.process(a); KWalletManager wm; QObject::connect(&dbssvc, &KDBusService::activateRequested, &wm, &QWidget::activateWindow); - if (parser.isSet("show")) { + if (parser.isSet(QStringLiteral("show"))) { wm.show(); } - if (parser.isSet("kwalletd")) { + if (parser.isSet(QStringLiteral("kwalletd"))) { wm.kwalletdLaunch(); } @@ -101,7 +101,7 @@ int main(int argc, char **argv) QMimeDatabase mimeDb; QMimeType mt = mimeDb.mimeTypeForFile(fn, QMimeDatabase::MatchContent); - if (mt.isValid() && mt.inherits(QLatin1String("application/x-kwallet"))) { + if (mt.isValid() && mt.inherits(QStringLiteral("application/x-kwallet"))) { wm.openWalletFile(fn); } } else { diff --git a/src/manager/revokeauthbutton.cpp b/src/manager/revokeauthbutton.cpp index 95c8bb8..f6f90d8 100644 --- a/src/manager/revokeauthbutton.cpp +++ b/src/manager/revokeauthbutton.cpp @@ -25,7 +25,7 @@ RevokeAuthButton::RevokeAuthButton(const QString &appName, KWallet::Wallet *wall _appName(appName), _wallet(wallet) { - setObjectName(QString("Revoke_%1").arg(appName)); + setObjectName(QStringLiteral("Revoke_%1").arg(appName)); setText(i18n("Revoke Authorization")); connect(this, &RevokeAuthButton::clicked, this, &RevokeAuthButton::onClicked); } -- GitLab