Commit 27f8d32a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent e5c61dbf
......@@ -26,7 +26,7 @@
#include <KLocalizedString>
#include <KService>
void GlobalAccel::changeMenuEntryShortcut(const KService::Ptr service, const QKeySequence &shortcut)
void GlobalAccel::changeMenuEntryShortcut(const KService::Ptr &service, const QKeySequence &shortcut)
{
const QString desktopFile = QStringLiteral("%1.desktop").arg(service->desktopEntryName());
......@@ -46,7 +46,7 @@ void GlobalAccel::changeMenuEntryShortcut(const KService::Ptr service, const QKe
}
QKeySequence GlobalAccel::getMenuEntryShortcut(const KService::Ptr service)
QKeySequence GlobalAccel::getMenuEntryShortcut(const KService::Ptr &service)
{
const QString desktopFile = QStringLiteral("%1.desktop").arg(service->desktopEntryName());
const QList<QKeySequence> shortcut = KGlobalAccel::self()->globalShortcut(desktopFile, QStringLiteral("_launch"));
......
......@@ -24,8 +24,8 @@
class GlobalAccel
{
public:
static QKeySequence getMenuEntryShortcut(const KService::Ptr service);
static void changeMenuEntryShortcut(const KService::Ptr service, const QKeySequence &shortcut);
static QKeySequence getMenuEntryShortcut(const KService::Ptr &service);
static void changeMenuEntryShortcut(const KService::Ptr &service, const QKeySequence &shortcut);
};
#endif // GLOBALACCEL_H
......@@ -39,7 +39,7 @@ public:
: QApplication(argc, argv)
{
QCoreApplication::setApplicationName(QStringLiteral("kmenuedit"));
QCoreApplication::setApplicationVersion(QLatin1String(PROJECT_VERSION));
QCoreApplication::setApplicationVersion(QStringLiteral(PROJECT_VERSION));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QApplication::setApplicationDisplayName(i18n("KDE Menu Editor"));
}
......@@ -57,7 +57,7 @@ int main(int argc, char **argv)
KLocalizedString::setApplicationDomain("kmenuedit");
KAboutData aboutData(QStringLiteral("kmenuedit"), i18n("KDE Menu Editor"),
QLatin1String(PROJECT_VERSION), i18n(description), KAboutLicense::GPL,
QStringLiteral(PROJECT_VERSION), i18n(description), KAboutLicense::GPL,
i18n("(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter"));
aboutData.addAuthor(i18n("Waldo Bastian"), i18n("Maintainer"), QStringLiteral("bastian@kde.org"));
aboutData.addAuthor(i18n("Raffaele Sandrini"), i18n("Previous Maintainer"), QStringLiteral("sandrini@kde.org"));
......
......@@ -194,7 +194,7 @@ static QString relativeToDesktopDirsLocation(const QString &file)
const QString canonical = QFileInfo(file).canonicalFilePath();
const QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString &dir : dirs) {
const QString base = dir + QLatin1String("/desktop-directories");
const QString base = dir + QStringLiteral("/desktop-directories");
if (canonical.startsWith(base))
return canonical.mid(base.length()+1);
}
......@@ -218,7 +218,7 @@ static QString entryToDirId(const QString &path)
return local;
}
static void purgeIncludesExcludes(QDomElement elem, const QString &appId, QDomElement &excludeNode, QDomElement &includeNode)
static void purgeIncludesExcludes(const QDomElement &elem, const QString &appId, QDomElement &excludeNode, QDomElement &includeNode)
{
// Remove any previous includes/excludes of appId
QDomNode n = elem.firstChild();
......
......@@ -277,7 +277,7 @@ TreeView::TreeView(KActionCollection *ac, QWidget *parent)
connect(this, &QTreeWidget::currentItemChanged,
this, &TreeView::itemSelected);
m_menuFile = new MenuFile(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/menus/") + QStringLiteral("applications-kmenuedit.menu"));
m_menuFile = new MenuFile(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QStringLiteral("/menus/") + QStringLiteral("applications-kmenuedit.menu"));
m_rootFolder = new MenuFolderInfo;
m_separator = new MenuSeparatorInfo;
}
......@@ -436,9 +436,9 @@ TreeItem *TreeView::createTreeItem(TreeItem *parent, QTreeWidgetItem *after, Men
if (m_detailedMenuEntries && entryInfo->description.length() != 0) {
if (m_detailedEntriesNamesFirst) {
name = entryInfo->caption + QLatin1String(" (") + entryInfo->description + QLatin1Char(')');
name = entryInfo->caption + QStringLiteral(" (") + entryInfo->description + QLatin1Char(')');
} else {
name = entryInfo->description + QLatin1String(" (") + entryInfo->caption + QLatin1Char(')');
name = entryInfo->description + QStringLiteral(" (") + entryInfo->caption + QLatin1Char(')');
}
} else {
name = entryInfo->caption;
......@@ -675,9 +675,9 @@ void TreeView::currentDataChanged(MenuEntryInfo *entryInfo)
if (m_detailedMenuEntries && !entryInfo->description.isEmpty()) {
if (m_detailedEntriesNamesFirst) {
name = entryInfo->caption + QLatin1String(" (") + entryInfo->description + QLatin1Char(')');
name = entryInfo->caption + QStringLiteral(" (") + entryInfo->description + QLatin1Char(')');
} else {
name = entryInfo->description + QLatin1String(" (") + entryInfo->caption + QLatin1Char(')');
name = entryInfo->description + QStringLiteral(" (") + entryInfo->caption + QLatin1Char(')');
}
} else {
name = entryInfo->caption;
......@@ -763,14 +763,14 @@ static QString createDirectoryFile(const QString &file, QStringList *excludeList
}
if (!excludeList->contains(result)) {
if (QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("desktop-directories/") + result).isEmpty()) {
if (QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("desktop-directories/") + result).isEmpty()) {
break;
}
}
i++;
}
excludeList->append(result);
result = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/desktop-directories/") + result;
result = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/desktop-directories/") + result;
return result;
}
......@@ -1053,7 +1053,7 @@ void TreeView::newsubmenu()
folderInfo->caption = parentFolderInfo->uniqueMenuCaption(caption);
folderInfo->id = m_menuFile->uniqueMenuName(folder, caption, parentFolderInfo->existingMenuIds());
folderInfo->directoryFile = file;
folderInfo->icon = QLatin1String("package");
folderInfo->icon = QStringLiteral("package");
folderInfo->hidden = false;
folderInfo->setDirty();
......@@ -1396,7 +1396,7 @@ void TreeView::sort(const int sortCmd)
* @param item Item to sort.
* @param sortType Sort type.
*/
void TreeView::sortItem(TreeItem *item, const SortType &sortType)
void TreeView::sortItem(TreeItem *item, SortType sortType)
{
// sort the selected item only if contains children
if ((!item->isDirectory()) || (item->childCount() == 0)) {
......@@ -1450,7 +1450,7 @@ void TreeView::sortItem(TreeItem *item, const SortType &sortType)
* @param end Last child iterator (exclusive, pointed child won't be affected).
* @param sortType Sort type.
*/
void TreeView::sortItemChildren(const QList<QTreeWidgetItem *>::iterator &begin, const QList<QTreeWidgetItem *>::iterator &end, const SortType &sortType)
void TreeView::sortItemChildren(const QList<QTreeWidgetItem *>::iterator &begin, const QList<QTreeWidgetItem *>::iterator &end, SortType sortType)
{
// sort by name
if (sortType == SortByName) {
......@@ -1773,20 +1773,20 @@ void TreeView::restoreMenuSystem()
if (KMessageBox::warningYesNo(this, i18n("Do you want to restore the system menu? Warning: This will remove all custom menus.")) == KMessageBox::No) {
return;
}
const QString kmenueditfile = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/menus/applications-kmenuedit.menu");
const QString kmenueditfile = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QStringLiteral("/menus/applications-kmenuedit.menu");
if (QFile::exists(kmenueditfile)) {
if (!QFile::remove(kmenueditfile)) {
qCWarning(KMENUEDIT_LOG)<<"Could not delete "<<kmenueditfile;
}
}
const QString xdgappsdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/applications");
const QString xdgappsdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/applications");
if (QFileInfo(xdgappsdir).isDir()) {
if (!QDir(xdgappsdir).removeRecursively()) {
qCWarning(KMENUEDIT_LOG)<<"Could not delete dir :" << xdgappsdir;
}
}
const QString xdgdesktopdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/desktop-directories");
const QString xdgdesktopdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/desktop-directories");
if (QFileInfo(xdgdesktopdir).isDir()) {
if (!QDir(xdgdesktopdir).removeRecursively()) {
qCWarning(KMENUEDIT_LOG)<<"Could not delete dir :" << xdgdesktopdir;
......
......@@ -224,8 +224,8 @@ protected:
void fill();
void fillBranch(MenuFolderInfo *folderInfo, TreeItem *parent);
QString findName(KDesktopFile *df, bool deleted);
void sortItem(TreeItem *item, const SortType &sortType);
void sortItemChildren(const QList<QTreeWidgetItem *>::iterator &begin, const QList<QTreeWidgetItem *>::iterator &end, const SortType &sortType);
void sortItem(TreeItem *item, SortType sortType);
void sortItemChildren(const QList<QTreeWidgetItem *>::iterator &begin, const QList<QTreeWidgetItem *>::iterator &end, SortType sortType);
TreeItem *getParentItem(QTreeWidgetItem *item) const;
void moveUpOrDownItem(bool isMovingUpAction);
......@@ -266,6 +266,7 @@ private:
class MenuItemMimeData : public QMimeData
{
Q_OBJECT
public:
explicit MenuItemMimeData(TreeItem *item);
QStringList formats() const override;
......
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