Changeset View
Changeset View
Standalone View
Standalone View
treeview.cpp
Show All 30 Lines | |||||
31 | #include <QDir> | 31 | #include <QDir> | ||
32 | #include <QDrag> | 32 | #include <QDrag> | ||
33 | #include <QDropEvent> | 33 | #include <QDropEvent> | ||
34 | #include <QHeaderView> | 34 | #include <QHeaderView> | ||
35 | #include <QIcon> | 35 | #include <QIcon> | ||
36 | #include <QInputDialog> | 36 | #include <QInputDialog> | ||
37 | #include <QMenu> | 37 | #include <QMenu> | ||
38 | #include <QPainter> | 38 | #include <QPainter> | ||
39 | #include <QRegExp> | 39 | #include <QRegularExpressionMatch> | ||
40 | #include <QUrl> | 40 | #include <QUrl> | ||
41 | 41 | | |||
42 | #include <KActionCollection> | 42 | #include <KActionCollection> | ||
43 | #include <KBuildSycocaProgressDialog> | 43 | #include <KBuildSycocaProgressDialog> | ||
44 | #include "kmenuedit_debug.h" | 44 | #include "kmenuedit_debug.h" | ||
45 | #include <KDesktopFile> | 45 | #include <KDesktopFile> | ||
46 | #include <KIconLoader> | 46 | #include <KIconLoader> | ||
47 | #include <KLocalizedString> | 47 | #include <KLocalizedString> | ||
▲ Show 20 Lines • Show All 674 Lines • ▼ Show 20 Line(s) | 717 | { | |||
722 | return new MenuItemMimeData(dynamic_cast<TreeItem *>(items.first())); | 722 | return new MenuItemMimeData(dynamic_cast<TreeItem *>(items.first())); | ||
723 | } | 723 | } | ||
724 | 724 | | |||
725 | static QString createDesktopFile(const QString &file, QString *menuId, QStringList *excludeList) | 725 | static QString createDesktopFile(const QString &file, QString *menuId, QStringList *excludeList) | ||
726 | { | 726 | { | ||
727 | QString base = file.mid(file.lastIndexOf(QLatin1Char('/'))+1); | 727 | QString base = file.mid(file.lastIndexOf(QLatin1Char('/'))+1); | ||
728 | base = base.left(base.lastIndexOf(QLatin1Char('.'))); | 728 | base = base.left(base.lastIndexOf(QLatin1Char('.'))); | ||
729 | 729 | | |||
730 | QRegExp r(QStringLiteral("(.*)(?=-\\d+)")); | 730 | const QRegularExpression re(QStringLiteral("(.*)(?=-\\d+)")); | ||
731 | base = (r.indexIn(base) > -1) ? r.cap(1) : base; | 731 | const QRegularExpressionMatch match = re.match(base); | ||
732 | base = match.hasMatch() ? match.captured(1) : base; | ||||
732 | 733 | | |||
733 | QString result = KService::newServicePath(true, base, menuId, excludeList); | 734 | QString result = KService::newServicePath(true, base, menuId, excludeList); | ||
734 | excludeList->append(*menuId); | 735 | excludeList->append(*menuId); | ||
735 | // Todo for Undo-support: Undo menuId allocation: | 736 | // Todo for Undo-support: Undo menuId allocation: | ||
736 | 737 | | |||
737 | return result; | 738 | return result; | ||
738 | } | 739 | } | ||
739 | 740 | | |||
▲ Show 20 Lines • Show All 1153 Lines • Show Last 20 Lines |