Changeset View
Changeset View
Standalone View
Standalone View
tests/kmoretools/kmoretoolstest_interactive.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | void KMoreToolsTestInteractive::cleanup() | 68 | void KMoreToolsTestInteractive::cleanup() | ||
69 | { | 69 | { | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | bool menuAtLeastOneActionWithText(const QMenu* menu, const QString& text) | 72 | bool menuAtLeastOneActionWithText(const QMenu* menu, const QString& text) | ||
73 | { | 73 | { | ||
74 | Q_FOREACH(auto a, menu->actions()) | 74 | const auto lstActions = menu->actions(); | ||
75 | for (auto a : lstActions) | ||||
75 | { | 76 | { | ||
76 | if (a->text() == text) { | 77 | if (a->text() == text) { | ||
77 | return true; | 78 | return true; | ||
78 | } | 79 | } | ||
79 | } | 80 | } | ||
80 | 81 | | |||
81 | return false; | 82 | return false; | ||
82 | } | 83 | } | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 176 | { | |||
178 | auto labelInfo = new QLabel(_("First, select a URL (leave the URL box empty to give no URL; don't forget to add file:// or http://). Then, select a grouping name. => A menu will be created that you can try out. KDE4/KF5: If an application does not start even there is the launch indicator, try: $ eval `dbus-launch`"), dlg); | 179 | auto labelInfo = new QLabel(_("First, select a URL (leave the URL box empty to give no URL; don't forget to add file:// or http://). Then, select a grouping name. => A menu will be created that you can try out. KDE4/KF5: If an application does not start even there is the launch indicator, try: $ eval `dbus-launch`"), dlg); | ||
179 | labelInfo->setWordWrap(true); | 180 | labelInfo->setWordWrap(true); | ||
180 | auto selectButton = new QPushButton(_("Select grouping name..."), dlg); | 181 | auto selectButton = new QPushButton(_("Select grouping name..."), dlg); | ||
181 | auto labelLineEdit = new QLabel(_("URL 1 (file://..., http://...)"), dlg); | 182 | auto labelLineEdit = new QLabel(_("URL 1 (file://..., http://...)"), dlg); | ||
182 | auto urlLineEdit = new QLineEdit(dlg); | 183 | auto urlLineEdit = new QLineEdit(dlg); | ||
183 | urlLineEdit->setText(_("file:///etc/bash.bashrc")); | 184 | urlLineEdit->setText(_("file:///etc/bash.bashrc")); | ||
184 | auto menuButton = new QPushButton(_("<wait for selection>"), dlg); | 185 | auto menuButton = new QPushButton(_("<wait for selection>"), dlg); | ||
185 | 186 | | |||
186 | auto groupingNamesList = { | 187 | const auto groupingNamesList = { | ||
187 | _("disk-usage"), | 188 | _("disk-usage"), | ||
188 | _("disk-partitions"), | 189 | _("disk-partitions"), | ||
189 | _("files-find"), | 190 | _("files-find"), | ||
190 | _("font-tools"), | 191 | _("font-tools"), | ||
191 | _("git-clients-for-folder"), | 192 | _("git-clients-for-folder"), | ||
192 | _("git-clients-and-actions"), | 193 | _("git-clients-and-actions"), | ||
193 | _("icon-browser"), | 194 | _("icon-browser"), | ||
194 | _("language-dictionary"), | 195 | _("language-dictionary"), | ||
195 | _("mouse-tools"), | 196 | _("mouse-tools"), | ||
196 | _("screenrecorder"), | 197 | _("screenrecorder"), | ||
197 | _("screenshot-take"), | 198 | _("screenshot-take"), | ||
198 | _("system-monitor-processes"), | 199 | _("system-monitor-processes"), | ||
199 | _("system-monitor-logs"), | 200 | _("system-monitor-logs"), | ||
200 | _("time-countdown") | 201 | _("time-countdown") | ||
201 | }; | 202 | }; | ||
202 | 203 | | |||
203 | KMoreToolsMenuFactory menuFactory(_("unittest-kmoretools/3")); | 204 | KMoreToolsMenuFactory menuFactory(_("unittest-kmoretools/3")); | ||
204 | 205 | | |||
205 | auto groupingNamesMenu = new QMenu(dlg); | 206 | auto groupingNamesMenu = new QMenu(dlg); | ||
206 | QMenu* moreToolsMenu = nullptr; | 207 | QMenu* moreToolsMenu = nullptr; | ||
207 | Q_FOREACH(auto groupingName, groupingNamesList) { | 208 | for (auto groupingName : groupingNamesList) { | ||
208 | auto action = new QAction(groupingName, groupingNamesMenu); | 209 | auto action = new QAction(groupingName, groupingNamesMenu); | ||
209 | action->setData(groupingName); | 210 | action->setData(groupingName); | ||
210 | groupingNamesMenu->addAction(action); | 211 | groupingNamesMenu->addAction(action); | ||
211 | 212 | | |||
212 | QObject::connect(action, &QAction::triggered, action, | 213 | QObject::connect(action, &QAction::triggered, action, | ||
213 | [action, &menuFactory, &moreToolsMenu, urlLineEdit, menuButton]() { | 214 | [action, &menuFactory, &moreToolsMenu, urlLineEdit, menuButton]() { | ||
214 | auto groupingName = action->data().toString(); | 215 | auto groupingName = action->data().toString(); | ||
215 | QUrl url; | 216 | QUrl url; | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |