Changeset View
Changeset View
Standalone View
Standalone View
src/kmoretools/kmoretoolsmenufactory.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | 175 | if (url.isLocalFile()) { // 2015-01-12: Filelight can handle FTP connections | |||
---|---|---|---|---|---|
177 | // don't offer it in this case | 177 | // don't offer it in this case | ||
178 | 178 | | |||
179 | const auto filelight1Item = menuBuilder->addMenuItem(filelightApp); | 179 | const auto filelight1Item = menuBuilder->addMenuItem(filelightApp); | ||
180 | 180 | | |||
181 | if (filelightApp->isInstalled()) { | 181 | if (filelightApp->isInstalled()) { | ||
182 | const auto filelightService = filelightApp->installedService(); | 182 | const auto filelightService = filelightApp->installedService(); | ||
183 | 183 | | |||
184 | filelight1Item->action()->setText(filelightApp->formatString( | 184 | filelight1Item->action()->setText(filelightApp->formatString( | ||
185 | i18nc("@action:inmenu", "$GenericName - current folder"))); | 185 | i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current folder", QStringLiteral("$GenericName")))); | ||
186 | menu->connect(filelight1Item->action(), &QAction::triggered, menu, | 186 | menu->connect(filelight1Item->action(), &QAction::triggered, menu, | ||
187 | [filelightService, url](bool) { | 187 | [filelightService, url](bool) { | ||
188 | KRun::runApplication(*filelightService, { url }, nullptr); | 188 | KRun::runApplication(*filelightService, { url }, nullptr); | ||
189 | }); | 189 | }); | ||
190 | 190 | | |||
191 | const auto filelight2Item = menuBuilder->addMenuItem(filelightApp); | 191 | const auto filelight2Item = menuBuilder->addMenuItem(filelightApp); | ||
192 | filelight2Item->action()->setText(filelightApp->formatString( | 192 | filelight2Item->action()->setText(filelightApp->formatString( | ||
193 | i18nc("@action:inmenu", "$GenericName - current device"))); | 193 | i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current device", QStringLiteral("$GenericName")))); | ||
194 | menu->connect(filelight2Item->action(), &QAction::triggered, menu, | 194 | menu->connect(filelight2Item->action(), &QAction::triggered, menu, | ||
195 | [filelightService, url](bool) { | 195 | [filelightService, url](bool) { | ||
196 | KMountPoint::Ptr mountPoint | 196 | KMountPoint::Ptr mountPoint | ||
197 | = KMountPoint::currentMountPoints().findByPath(url.toLocalFile()); | 197 | = KMountPoint::currentMountPoints().findByPath(url.toLocalFile()); | ||
198 | KRun::runApplication(*filelightService, | 198 | KRun::runApplication(*filelightService, | ||
199 | { QUrl::fromLocalFile(mountPoint->mountPoint()) }, | 199 | { QUrl::fromLocalFile(mountPoint->mountPoint()) }, | ||
200 | nullptr); | 200 | nullptr); | ||
201 | }); | 201 | }); | ||
202 | } | 202 | } | ||
203 | } | 203 | } | ||
204 | 204 | | |||
205 | auto filelight3Item = menuBuilder->addMenuItem(filelightApp, KMoreTools::MenuSection_More); | 205 | auto filelight3Item = menuBuilder->addMenuItem(filelightApp, KMoreTools::MenuSection_More); | ||
206 | if (filelightApp->isInstalled()) { | 206 | if (filelightApp->isInstalled()) { | ||
207 | filelight3Item->action()->setText(filelightApp->formatString( | 207 | filelight3Item->action()->setText(filelightApp->formatString( | ||
208 | i18nc("@action:inmenu", "$GenericName - all devices"))); | 208 | i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - all devices", QStringLiteral("$GenericName")))); | ||
209 | const auto filelightService = filelightApp->installedService(); | 209 | const auto filelightService = filelightApp->installedService(); | ||
210 | menu->connect(filelight3Item->action(), &QAction::triggered, menu, | 210 | menu->connect(filelight3Item->action(), &QAction::triggered, menu, | ||
211 | [filelightService](bool) { | 211 | [filelightService](bool) { | ||
212 | KRun::runApplication(*filelightService, { }, nullptr); | 212 | KRun::runApplication(*filelightService, { }, nullptr); | ||
213 | }); | 213 | }); | ||
214 | } | 214 | } | ||
215 | } else { | 215 | } else { | ||
216 | qWarning() << "org.kde.filelight should be present in KMoreTools but it is not!"; | 216 | qWarning() << "org.kde.filelight should be present in KMoreTools but it is not!"; | ||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |