diff --git a/CMakeLists.txt b/CMakeLists.txt index f883698ef..75f89f1dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,94 +1,94 @@ cmake_minimum_required(VERSION 3.0) project(kdeplasma-addons) set(PROJECT_VERSION "5.19.80") set(PROJECT_VERSION_MAJOR 5) ################# Disallow in-source build ################# if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "plasma requires an out of source build. Please create a separate build directory and run 'cmake path_to_plasma [options]' there.") endif() set(QT_MIN_VERSION 5.12.0) -set(KF5_MIN_VERSION 5.71.0) +set(KF5_MIN_VERSION 5.72.0) include(FeatureSummary) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMInstallIcons) include(KDEPackageAppTemplates) include(GenerateExportHeader) include(CMakePackageConfigHelpers) include(KDEClangFormat) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Gui DBus Quick Qml Widgets Test ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Archive Config CoreAddons Declarative Holidays I18n IconThemes KIO KCMUtils Kross Notifications Plasma Runner Service Sonnet UnitConversion WindowSystem NewStuff ) find_package(KF5Purpose CONFIG QUIET) set_package_properties(KF5Purpose PROPERTIES DESCRIPTION "Framework for cross-application services and actions" PURPOSE "Needed for QuickShare applet" URL "https://commits.kde.org/purpose" TYPE RUNTIME ) add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_NO_URL_CAST_FROM_STRING ) ######################################################################### ################# list the subdirectories ################# add_subdirectory(applets) add_subdirectory(dataengines) add_subdirectory(runners) add_subdirectory(wallpapers) add_subdirectory(windowswitchers) add_subdirectory(desktopswitchers) add_subdirectory(plasmacalendarplugins) add_subdirectory(templates) # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/runners/characters/CMakeLists.txt b/runners/characters/CMakeLists.txt index f711ac33d..34641e8a7 100644 --- a/runners/characters/CMakeLists.txt +++ b/runners/characters/CMakeLists.txt @@ -1,24 +1,26 @@ add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_CharacterRunner") set(krunner_charrunner_SRCS charrunner.cpp) set(kcm_krunner_charrunner_SRCS charrunner_config.cpp) ki18n_wrap_ui(kcm_krunner_charrunner_SRCS charrunner_config.ui) add_library(kcm_krunner_charrunner MODULE ${kcm_krunner_charrunner_SRCS}) target_link_libraries(kcm_krunner_charrunner KF5::Runner KF5::KCMUtils KF5::I18n ) # Now make sure all files get to the right place add_library(krunner_charrunner MODULE ${krunner_charrunner_SRCS}) +kcoreaddons_desktop_to_json(krunner_charrunner plasma-runner-character.desktop ) target_link_libraries(krunner_charrunner KF5::Runner KF5::I18n ) add_dependencies(krunner_charrunner kcm_krunner_charrunner) # Install the library and .desktop file -install(TARGETS krunner_charrunner kcm_krunner_charrunner DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-character.desktop plasma-runner-character_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_charrunner DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) +install(TARGETS kcm_krunner_charrunner DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES plasma-runner-character_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/runners/characters/charrunner.cpp b/runners/characters/charrunner.cpp index b304c3fbd..e2e6b2623 100644 --- a/runners/characters/charrunner.cpp +++ b/runners/characters/charrunner.cpp @@ -1,102 +1,102 @@ /* Copyright 2010 Anton Kreuzkamp * Copyright 2020 Alexander Lohnau * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "charrunner.h" #include "config_keys.h" // KF #include #include // Qt #include #include #include CharacterRunner::CharacterRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args) setObjectName(QStringLiteral("CharacterRunner")); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::Executable | Plasma::RunnerContext::ShellCommand); } CharacterRunner::~CharacterRunner() { } void CharacterRunner::reloadConfiguration() { const KConfigGroup grp = config(); m_triggerWord = grp.readEntry(CONFIG_TRIGGERWORD, DEFAULT_TRIGGERWORD.toString()); m_aliases = grp.readEntry(CONFIG_ALIASES, QStringList()); m_codes = grp.readEntry(CONFIG_CODES, QStringList()); if (m_codes.size() != m_aliases.size()) { m_aliases.clear(); m_codes.clear(); qWarning() << "Config entries for alias list and code list have different sizes, ignoring all."; } addSyntax(Plasma::RunnerSyntax(m_triggerWord + QStringLiteral(":q:"), i18n("Creates Characters from :q: if it is a hexadecimal code or defined alias."))); } void CharacterRunner::match(Plasma::RunnerContext &context) { QString term = context.query().remove(QLatin1Char(' ')); if (term.length() < 2 || !term.startsWith(m_triggerWord) || !context.isValid()) { return; } term = term.remove(0, m_triggerWord.length()); //remove the triggerword //replace aliases by their hex.-code if (m_aliases.contains(term)) { term = m_codes[m_aliases.indexOf(term)]; } bool ok; int hex = term.toInt(&ok, 16); //convert query into int if (!ok) { return; } //make special character out of the hex.-code const QString specChar = QChar(hex); Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::ExactMatch); match.setIconName(QStringLiteral("accessories-character-map")); match.setText(specChar); match.setData(specChar); context.addMatch(match); } void CharacterRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) { Q_UNUSED(context) QGuiApplication::clipboard()->setText(match.data().toString()); } -K_EXPORT_PLASMA_RUNNER(CharacterRunner, CharacterRunner) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(CharacterRunner, "plasma-runner-character.json") #include "charrunner.moc" diff --git a/runners/characters/plasma-runner-character.desktop b/runners/characters/plasma-runner-character.desktop index 89e51af83..37d146115 100644 --- a/runners/characters/plasma-runner-character.desktop +++ b/runners/characters/plasma-runner-character.desktop @@ -1,117 +1,117 @@ [Desktop Entry] Name=Special Characters Name[ar]=محارف خاصة Name[ast]=Caráuteres especiales Name[bs]=Posebni znakovi Name[ca]=Caràcters especials Name[ca@valencia]=Caràcters especials Name[cs]=Zvláštní znaky Name[da]=Specialtegn Name[de]=Sonderzeichen Name[el]=Ειδικοί χαρακτήρες Name[en_GB]=Special Characters Name[es]=Caracteres especiales Name[et]=Erimärgid Name[eu]=Karaktere bereziak Name[fi]=Erikoismerkit Name[fr]=Caractères spéciaux Name[ga]=Carachtair Speisialta Name[gl]=Caracteres especiais Name[he]=תווים מיוחדים Name[hr]=Posebni znakovi Name[hu]=Speciális karakterek Name[id]=Karakter Spesial Name[it]=Caratteri speciali Name[ja]=特殊文字 Name[kk]=Арнаулы таңбалар Name[km]=តួអក្សរ​ពិសេស Name[ko]=특수 문자 Name[lt]=Specialūs simboliai Name[lv]=Speciālās rakstzīmes Name[mr]=विशिष्ठ अक्षरे Name[nb]=Spesialtegn Name[nds]=Besünner Tekens Name[nl]=Speciale tekens Name[nn]=Spesialteikn Name[pa]=ਖਾਸ ਅੱਖਰ Name[pl]=Znaki specjalne Name[pt]=Caracteres Especiais Name[pt_BR]=Caracteres especiais Name[ro]=Caractere speciale Name[ru]=Специальные символы Name[sk]=Špeciálne znaky Name[sl]=Posebni znaki Name[sr]=посебни знакови Name[sr@ijekavian]=посебни знакови Name[sr@ijekavianlatin]=posebni znakovi Name[sr@latin]=posebni znakovi Name[sv]=Specialtecken Name[tg]=Аломатҳои махсус Name[tr]=Özel Karakterler Name[ug]=ئالاھىدە ھەرپلەر Name[uk]=Спеціальні символи Name[wa]=Caracteres sipeciås Name[x-test]=xxSpecial Charactersxx Name[zh_CN]=特殊字符 Name[zh_TW]=特殊字元 Icon=accessories-character-map Comment=Creates special characters from their hexadecimal codes Comment[ar]=يُنشئ محارف خاصة لأكوادهم الست-عشريّة Comment[ast]=Crea caráuteres especiales a partir de los sos códigos hexadecimales Comment[bs]=Stvara posebne znakove iz heksadecimalnih kodova Comment[ca]=Crea caràcters especials a partir dels seus codis hexadecimals Comment[ca@valencia]=Crea caràcters especials a partir dels seus codis hexadecimals Comment[cs]=Vytváří speciální znaky z jejich hexadecimálních kódů Comment[da]=Opretter specialtegn via deres hexadecimal-koder Comment[de]=Erstellt Sonderzeichen aus ihren Hexadezimalwerten Comment[el]=Δημιουργεί ειδικούς χαρακτήρες από τους δεκαεξαδικούς τους κώδικες Comment[en_GB]=Creates special characters from their hexadecimal codes Comment[es]=Crea caracteres especiales a partir de sus códigos hexadecimales Comment[et]=Erimärkide loomine nende 16nd-süsteemis koodide põhjal Comment[eu]=Karaktere bereziak sortzen ditu bere kode hamaseitarretik abiatuta Comment[fi]=Luo erikoismerkkejä niiden heksadesimaalikoodeista Comment[fr]=Crée des caractères spéciaux à partir de leurs codes hexadécimaux Comment[gl]=Crea caracteres especiais a partir dos seus códigos hexadecimais. Comment[he]=צור תווים מהקוד ההקסדצימלי שלהם Comment[hr]=Stvara posebne znakove iz njihovih heksadecimalnih kôdova Comment[hu]=Speciális karakterek létrehozása hexadecimális kód alapján Comment[id]=Menciptakan karakter spesial dari kode hexadecimal-nya Comment[it]=Crea caratteri speciali dal loro codice esadecimale Comment[ja]=十六進コードから特殊文字を作る Comment[kk]=Оналтылық кодымен арнаулы таңбаларды енгізу Comment[km]=បង្កើត​តួអក្សរ​ពិសេស​ពី​កូដ​គោល​ដប់​ប្រាំមួយ​របស់​ពួកវា Comment[ko]=16진 코드를 사용하여 특수 문자 삽입 Comment[lt]=Sukuria specialius simbolius pagal jų šešioliktainius kodus Comment[lv]=Veido speciālās rakstzīmes no to heksadecimālajiem kodiem Comment[mr]=त्यांच्या हेक्साडेसिमल कोड वरून विशिष्ठ अक्षरे तयार करतो Comment[nb]=Lager spesialtegn ut fra deree heksadesimale koder Comment[nds]=Stellt Besünner Tekens ut ehr Hexadezimaalkoden op Comment[nl]=Maakt speciale tekens aan uit hun hexadecimale codes Comment[nn]=Lagar spesialteikn ut frå heksadesimalekodar Comment[pl]=Tworzy znaki specjalne z ich kodów szesnastkowych Comment[pt]=Cria caracteres especiais a partir do seu código hexadecimal Comment[pt_BR]=Cria caracteres especiais de seus códigos hexadecimais Comment[ro]=Creează caractere speciale din codurile hexazecimale ale acestora Comment[ru]=Создаёт специальные символы из их шестнадцатеричных кодов Comment[sk]=Vytváranie špeciálnych znakov z hexadecimálnych kódov Comment[sl]=Ustvari posebne znake iz njihovih šestnajstiških kod Comment[sr]=Испоставља знакове на основу њихових хексадекадних кодова Comment[sr@ijekavian]=Испоставља знакове на основу њихових хексадекадних кодова Comment[sr@ijekavianlatin]=Ispostavlja znakove na osnovu njihovih heksadekadnih kodova Comment[sr@latin]=Ispostavlja znakove na osnovu njihovih heksadekadnih kodova Comment[sv]=Skapar specialtecken från deras hexadecimala koder Comment[tr]=Onaltılık kodlardan özel karakterler oluştur Comment[uk]=Створення спеціальних символів за їхнім шістнадцятковим кодом Comment[x-test]=xxCreates special characters from their hexadecimal codesxx Comment[zh_CN]=从十六进制码创建特殊字符 Comment[zh_TW]=從它們的十六進位碼建立特殊字元 Type=Service X-KDE-ServiceTypes=Plasma/Runner -X-KDE-Library=krunner_charrunner +X-KDE-Library=kf5/krunner/krunner_charrunner X-KDE-PluginInfo-Author=Anton Kreuzkamp X-KDE-PluginInfo-Email=akreuzkamp@web.de X-KDE-PluginInfo-Name=CharacterRunner X-KDE-PluginInfo-Version=1 X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true diff --git a/runners/converter/CMakeLists.txt b/runners/converter/CMakeLists.txt index f0e053ea5..17ac4f58b 100644 --- a/runners/converter/CMakeLists.txt +++ b/runners/converter/CMakeLists.txt @@ -1,21 +1,21 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_runner_converterrunner\") set(krunner_converter_SRCS converterrunner.cpp) add_library(krunner_converter_static STATIC ${krunner_converter_SRCS}) target_link_libraries(krunner_converter_static KF5::I18n KF5::Runner KF5::UnitConversion Qt5::Widgets ) add_library(krunner_converter MODULE plugin.cpp) +kcoreaddons_desktop_to_json(krunner_converter plasma-runner-converter.desktop ) target_link_libraries(krunner_converter krunner_converter_static) -install(TARGETS krunner_converter DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-converter.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_converter DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) if(BUILD_TESTING) add_subdirectory(autotests) endif() diff --git a/runners/converter/plasma-runner-converter.desktop b/runners/converter/plasma-runner-converter.desktop index ee70ed7d9..486464ad1 100644 --- a/runners/converter/plasma-runner-converter.desktop +++ b/runners/converter/plasma-runner-converter.desktop @@ -1,126 +1,126 @@ [Desktop Entry] Name=Unit Converter Name[ar]=محول الوحدات Name[ast]=Convertidor d'unidaes Name[bs]=Pretvarač mjernih jedinica Name[ca]=Convertidor d'unitats Name[ca@valencia]=Convertidor d'unitats Name[cs]=Převod jednotek Name[da]=Enhedskonvertering Name[de]=Einheiten-Umrechner Name[el]=Μετατροπέας μονάδων Name[en_GB]=Unit Converter Name[es]=Conversor de unidades Name[et]=Ühikute teisendaja Name[eu]=Unitate bihurtzailea Name[fi]=Yksikkömuunnin Name[fr]=Convertisseur d'unité Name[ga]=Tiontaire Aonad Name[gl]=Convertedor de unidades Name[he]=ממיר יחידות Name[hr]=Pretvarač jedinica Name[hu]=Mértékegységváltó Name[ia]=Convertitor de unitate Name[id]=Pengkonversi Unit Name[is]=Einingaumbreytir Name[it]=Convertitore di unità Name[ja]=単位コンバータ Name[kk]=Өлшем бірліктерін аудару Name[km]=កម្មវិធី​បម្លែង​ឯកតា Name[ko]=단위 변환기 Name[ku]=Veguherînerê Yeke yê Name[lt]=Vienetų keitiklis Name[lv]=Mērvienību pārveidotājs Name[mr]=एकक परिवर्तक Name[nb]=Enhetskonverterer Name[nds]=Eenheiten ümreken Name[nl]=Eenheden converteren Name[nn]=Einingsomrekning Name[pa]=ਯੂਨਿਟ ਕਨਵਰਟਰ Name[pl]=Przelicznik jednostek Name[pt]=Conversor de Unidades Name[pt_BR]=Conversor de unidades Name[ro]=Convertor de unități Name[ru]=Преобразование величин Name[sk]=Prevod jednotiek Name[sl]=Pretvornik enot Name[sq]=Konvertues Njësish Name[sr]=претварач јединица Name[sr@ijekavian]=претварач јединица Name[sr@ijekavianlatin]=pretvarač jedinica Name[sr@latin]=pretvarač jedinica Name[sv]=Enhetskonvertering Name[th]=เครื่องมือแปลงค่าหน่วย Name[tr]=Birim Dönüştürücü Name[ug]=بىرلىك ئالماشتۇرغۇچ Name[uk]=Перетворювач одиниць Name[wa]=Radapteu d' unité Name[x-test]=xxUnit Converterxx Name[zh_CN]=单位转换器 Name[zh_TW]=單位轉換器 Comment=Convert values to different units Comment[ar]=حول قيمة الى وحدات مختلفة Comment[ast]=Convierte valores a unidaes estremaes Comment[bs]=Pretvara vrijednosti u druge mjerne jedinice Comment[ca]=Converteix valors a diferents unitats Comment[ca@valencia]=Converteix valors a diferents unitats Comment[cs]=Převod jednotek Comment[da]=Konvertér værdier til andre enheder. Comment[de]=Werte in verschiedene Einheiten umrechnen Comment[el]=Μετατρέπει τιμές σε διάφορες μονάδες Comment[en_GB]=Convert values to different units Comment[es]=Convierte valores a diferentes unidades Comment[et]=Väärtuste teisendamine erinevatesse ühikutesse Comment[eu]=Balioak unitate desberdinetara bihurtzen ditu Comment[fi]=Muuntaa lukuja eri yksiköiden välillä Comment[fr]=Convertit des valeurs dans diverses unités Comment[ga]=Tiontaíonn sé seo luach ó aonad amháin go haonad eile Comment[gl]=Converte valores entre distintas unidades Comment[he]=ממיר ערכים ליחידות שונות Comment[hr]=Pretvori vrijednosti u razne jedinice Comment[hu]=Értékek konvertálása más egységekre Comment[id]=Konversi nilai untuk unit yang berbeda Comment[is]=Umbreyta gildum í aðrar einingar Comment[it]=Converte valori tra unità di misura differenti Comment[ja]=数値を他の単位に変換します Comment[kk]=Түрлі өлшем бірліктерге аудару Comment[km]=បម្លែង​តម្លៃ​ទៅ​ជា​ឯកតា​ផ្សេង Comment[ko]=서로 다른 단위간을 전환합니다 Comment[ku]=Nirxan vediguherîne yeke yên cuda Comment[lt]=Konvertuoja dydžius į skirtingus vienetus Comment[lv]=Pārveido vērtības starp dažādām mērvienībām Comment[mr]=मूल्ये वेगळ्या एककात रूपांतरीत करा Comment[nb]=Gjør om verdier til andre enheter Comment[nds]=Weerten na verscheden Eenheiten ümreken Comment[nl]=Converteert waarden naar verschillende eenheden Comment[nn]=Gjer om mellom ulike einingar Comment[pa]=ਮੁੱਖ ਵੱਖਰੇ ਯੂਨਿਟ 'ਚ ਬਦਲੋ Comment[pl]=Przelicza wartości na inne jednostki Comment[pt]=Converte os valores para diferentes unidades Comment[pt_BR]=Converte valores para diferentes unidades Comment[ro]=Convertește valori în diferite unități Comment[ru]=Преобразование величин в другие единицы Comment[sk]=Prevod hodnôt na rôzne jednotky Comment[sl]=Pretvarja vrednosti v različne enote Comment[sr]=Претварање мерних јединица Comment[sr@ijekavian]=Претварање мијерних јединица Comment[sr@ijekavianlatin]=Pretvaranje mijernih jedinica Comment[sr@latin]=Pretvaranje mernih jedinica Comment[sv]=Konverterar värden till andra enheter Comment[th]=แปลงค่าไปเป็นหน่วยต่าง ๆ Comment[tr]=Değerleri başka birimlere dönüştürür Comment[uk]=Перетворення значень у різних одиницях Comment[wa]=Covierti les valixhances viès sacwantès unités Comment[x-test]=xxConvert values to different unitsxx Comment[zh_CN]=将所给值转换为不同的单位 Comment[zh_TW]=將數值轉換不同的單位 X-KDE-ServiceTypes=Plasma/Runner Type=Service Icon=accessories-calculator -X-KDE-Library=krunner_converter +X-KDE-Library=kf5/krunner/krunner_converter X-KDE-PluginInfo-Author=Petri Damstén X-KDE-PluginInfo-Email=damu@iki.fi X-KDE-PluginInfo-Name=unitconverter X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true diff --git a/runners/converter/plugin.cpp b/runners/converter/plugin.cpp index f9c3611c3..0df6c2cff 100644 --- a/runners/converter/plugin.cpp +++ b/runners/converter/plugin.cpp @@ -1,23 +1,23 @@ /* * Copyright (C) 2007,2008 Petri Damstén * Copyright (C) 2020 Alexander Lohnau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "converterrunner.h" -K_EXPORT_PLASMA_RUNNER(converterrunner, ConverterRunner) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(ConverterRunner, "plasma-runner-converter.json") #include "plugin.moc" diff --git a/runners/datetime/CMakeLists.txt b/runners/datetime/CMakeLists.txt index a634cb3d7..c5412be46 100644 --- a/runners/datetime/CMakeLists.txt +++ b/runners/datetime/CMakeLists.txt @@ -1,15 +1,15 @@ add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_datetime") set(krunner_datetime_SRCS datetimerunner.cpp ) add_library(krunner_datetime MODULE ${krunner_datetime_SRCS}) +kcoreaddons_desktop_to_json(krunner_datetime plasma-runner-datetime.desktop ) target_link_libraries(krunner_datetime KF5::Runner KF5::KIOWidgets KF5::I18n ) -install(TARGETS krunner_datetime DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-datetime.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_datetime DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) diff --git a/runners/datetime/datetimerunner.cpp b/runners/datetime/datetimerunner.cpp index d02e48e22..8f7d28b74 100644 --- a/runners/datetime/datetimerunner.cpp +++ b/runners/datetime/datetimerunner.cpp @@ -1,125 +1,125 @@ /* * Copyright (C) 2006 Aaron Seigo * Copyright (C) 2010 Marco Martin * Copyright (C) 2015 Vishesh Handa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License version 2 as * published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "datetimerunner.h" #include #include #include #include static const QString dateWord = i18nc("Note this is a KRunner keyword", "date"); static const QString timeWord = i18nc("Note this is a KRunner keyword", "time"); DateTimeRunner::DateTimeRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { setObjectName(QLatin1String( "DataTimeRunner" )); addSyntax(Plasma::RunnerSyntax(dateWord, i18n("Displays the current date"))); addSyntax(Plasma::RunnerSyntax(dateWord + QLatin1String( " :q:" ), i18n("Displays the current date in a given timezone"))); addSyntax(Plasma::RunnerSyntax(timeWord, i18n("Displays the current time"))); addSyntax(Plasma::RunnerSyntax(timeWord + QLatin1String( " :q:" ), i18n("Displays the current time in a given timezone"))); } DateTimeRunner::~DateTimeRunner() { } void DateTimeRunner::match(Plasma::RunnerContext &context) { const QString term = context.query(); if (term.compare(dateWord, Qt::CaseInsensitive) == 0) { const QString date = QLocale().toString(QDate::currentDate()); addMatch(i18n("Today's date is %1", date), date, context, QStringLiteral("view-calendar-day")); } else if (term.startsWith(dateWord + QLatin1Char( ' ' ), Qt::CaseInsensitive)) { const auto tz = term.rightRef(term.length() - dateWord.length() - 1); const auto dates = datetime(tz); for(auto it = dates.constBegin(), itEnd = dates.constEnd(); it != itEnd; ++it) { const QString date = QLocale().toString(*it); addMatch(QStringLiteral("%1 - %2").arg(it.key(), date), date, context, QStringLiteral("view-calendar-day")); } } else if (term.compare(timeWord, Qt::CaseInsensitive) == 0) { const QString time = QLocale().toString(QTime::currentTime()); addMatch(i18n("Current time is %1", time), time, context, QStringLiteral("clock")); } else if (term.startsWith(timeWord + QLatin1Char( ' ' ), Qt::CaseInsensitive)) { const auto tz = term.rightRef(term.length() - timeWord.length() - 1); const auto times = datetime(tz); for(auto it = times.constBegin(), itEnd = times.constEnd(); it != itEnd; ++it) { const QString time = QLocale().toString(*it, QLocale::ShortFormat); addMatch(QStringLiteral("%1 - %2").arg(it.key(), time), time, context, QStringLiteral("clock")); } } } QHash DateTimeRunner::datetime(const QStringRef& tz) { QHash ret; // // KTimeZone gives us the actual timezone names such as "Asia/Kolkatta" and does // not give us country info. QTimeZone does not give us the actual timezone name // This is why we are using both for now. // const QList timeZoneIds = QTimeZone::availableTimeZoneIds(); for (const QByteArray& zoneId : timeZoneIds) { QTimeZone timeZone(zoneId); const QString zoneName = QString::fromUtf8(zoneId); if (zoneName.contains(tz, Qt::CaseInsensitive)) { ret[zoneName] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone); continue; } const QString country = QLocale::countryToString(timeZone.country()); if (country.contains(tz, Qt::CaseInsensitive)) { ret[country] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone); continue; } // FIXME: This only includes the current abbreviation and not old abbreviation or // other possible names. // Eg - depending on the current date, only CET or CEST will work const QString abbr = timeZone.abbreviation(QDateTime::currentDateTime()); if (abbr.contains(tz, Qt::CaseInsensitive)) { ret[abbr] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone); continue; } } return ret; } void DateTimeRunner::addMatch(const QString &text, const QString &clipboardText, Plasma::RunnerContext &context, const QString& iconName) { Plasma::QueryMatch match(this); match.setText(text); match.setData(clipboardText); match.setType(Plasma::QueryMatch::InformationalMatch); match.setIconName(iconName); context.addMatch(match); } -K_EXPORT_PLASMA_RUNNER(krunner_datetime, DateTimeRunner) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(DateTimeRunner, "plasma-runner-datetime.json") #include "datetimerunner.moc" diff --git a/runners/datetime/plasma-runner-datetime.desktop b/runners/datetime/plasma-runner-datetime.desktop index 7de9da879..2b7d9adee 100644 --- a/runners/datetime/plasma-runner-datetime.desktop +++ b/runners/datetime/plasma-runner-datetime.desktop @@ -1,121 +1,121 @@ [Desktop Entry] Name=Date and Time Name[ar]=التاريخ والوقت Name[ast]=Data y hora Name[bs]=Datum i vrijeme Name[ca]=Data i hora Name[ca@valencia]=Data i hora Name[cs]=Datum a čas Name[da]=Dato og klokkeslæt Name[de]=Datum und Zeit Name[el]=Ημερομηνία και ώρα Name[en_GB]=Date and Time Name[eo]=Dato kaj Tempo Name[es]=Fecha y hora Name[et]=Kuupäev ja kellaaeg Name[eu]=Data eta ordua Name[fi]=Aika ja päiväys Name[fr]=Date et heure Name[ga]=Dáta agus Am Name[gl]=Data e hora Name[he]=שעה ותאריך Name[hr]=Datum i vrijeme Name[hu]=Dátum és idő Name[ia]=Data e Tempore Name[id]=Tanggal dan Waktu Name[it]=Data e ora Name[ja]=日付と時間 Name[kk]=Күні мен уақыты Name[km]=កាលបរិច្ឆេទ និងពេលវេលា Name[ko]=날짜와 시간 Name[lt]=Data ir laikas Name[lv]=Datums un laiks Name[mr]=दिनांक व वेळ Name[nb]=Dato og klokkeslett Name[nds]=Datum un Tiet Name[nl]=Datum en tijd Name[nn]=Dato og klokkeslett Name[pa]=ਮਿਤੀ ਤੇ ਸਮਾਂ Name[pl]=Data i czas Name[pt]=Data e Hora Name[pt_BR]=Data e hora Name[ro]=Data și ora Name[ru]=Дата и время Name[sk]=Dátum a čas Name[sl]=Datum in čas Name[sr]=датум и време Name[sr@ijekavian]=датум и време Name[sr@ijekavianlatin]=datum i vreme Name[sr@latin]=datum i vreme Name[sv]=Datum och tid Name[tr]=Tarih ve Saat Name[ug]=چېسلا ۋە ۋاقىت Name[uk]=Дата і час Name[wa]=Date et eure Name[x-test]=xxDate and Timexx Name[zh_CN]=日期和时间 Name[zh_TW]=日期和時間 Comment=The current date and time, locally or in any timezone Comment[ar]=التاريخ والوقت الحاليين، محلياً أو في أيّ منطقة زمنية Comment[ast]=La data y hora actuales, llocales o de cualesquier fusu horariu Comment[bs]=Trenutni datum i vrijeme, lokalno ili u nekoj drugoj vremenskoj zoni Comment[ca]=La data i l'hora actuals, localment o en qualsevol zona horària Comment[ca@valencia]=La data i l'hora actuals, localment o en qualsevol zona horària Comment[cs]=Aktuální datum a čas, lokální, nebo v libovolné časové zóně Comment[da]=Den nuværende dato og klokkeslæt, lokalt eller i en enhver tidszone Comment[de]=Aktuelles Datum und Zeit; lokal oder in einer anderen Zeitzone Comment[el]=Η τρέχουσα ημερομηνία και ώρα, τοπικά ή σε οποιαδήποτε ωρολογιακή ζώνη Comment[en_GB]=The current date and time, locally or in any timezone Comment[es]=La fecha y hora actual, local o en cualquier zona horaria Comment[et]=Praegune kuupäev ja kellaaeg, kohalik või mis tahes ajavööndi oma Comment[eu]=Uneko data eta ordua, tokikoa edo beste ordu-eremuetakoa Comment[fi]=Paikallinen tai minkä tahansa aikavyöhykkeen nykyinen aika ja päiväys Comment[fr]=La date et l'heure courante, locale ou selon un fuseau horaire Comment[ga]=An dáta agus agus t-am faoi láthair, anseo nó i gcrios ama ar bith Comment[gl]=A data e hora actuais, locais ou de calquera fuso horario. Comment[he]=השעה והתאריך הנוכחיים, כאן או בכל איזור־זמן אחר Comment[hr]=Trenutni datum i vrijeme, lokalno ili u bilo kojoj vremenskoj zoni Comment[hu]=A jelenlegi dátum és idő, helyileg vagy bármelyik időzónában Comment[id]=Tanggal dan waktu saat ini, secara lokal atau dalam zona waktu apa pun Comment[it]=La data e l'ora corrente, localmente o in qualsiasi fuso orario Comment[ja]=現在の日時を任意のタイムゾーンで Comment[kk]=Жергілікті не басқа уақыт белдеуіндегі қазіргі күн мен уақыты Comment[km]=កាលបរិច្ឆេទ និង​ទិន្នន័យ​បច្ចុប្បន្ន​ មូលដ្ឋាន ឬ​តំបន់​ពេលវេលា​ណាមួយ Comment[ko]=오늘 날짜와 시간 Comment[lt]=Dabartinis laikas ir data, vietinė arba pasirinktos laiko juostos Comment[lv]=Pašreizējais datums un laiks lokāli vai jebkurā laika zonā Comment[mr]=कोणत्याही वेळक्षेत्रा प्रमाणे किंवा स्थानिक वर्तमान दिनांक व वेळ Comment[nb]=Dagens dato og tid, lokalt eller i en hver tidssone Comment[nds]=Dat aktuelle Datum un de Tiet, lokaal oder in en anner Tietrebeet Comment[nl]=De huidige datum en tijd, lokaal of in elke tijdzone Comment[nn]=Dagens dato og klokkeslett, lokalt eller i ein annan tidssone Comment[pa]=ਮੌਜੂਦਾ ਮਿਤੀ ਤੇ ਸਮਾਂ, ਸਥਾਨਕ ਜਾਂ ਕੋਈ ਹੋਰ ਸਮਾਂ ਖੇਤਰ ਵਿੱਚ Comment[pl]=Data i czas w dowolnej strefie czasowej Comment[pt]=A data e hora actuais, a nível local ou noutro fuso-horário qualquer Comment[pt_BR]=A data e a hora atual, local ou em qualquer fuso horário Comment[ro]=Data și ora curentă, local sau din orice fus orar Comment[ru]=Текущие дата и время. Местные или для любого часового пояса. Comment[sk]=Aktuálny dátum a čas, lokálny alebo v inom časovom pásme Comment[sl]=Trenutni datum in čas, krajevno ali v kateremkoli časovnem pasu Comment[sr]=Тренутни датум и време, локално или у некој другој временској зони Comment[sr@ijekavian]=Тренутни датум и вријеме, локално или у некој другој временској зони Comment[sr@ijekavianlatin]=Trenutni datum i vrijeme, lokalno ili u nekoj drugoj vremenskoj zoni Comment[sr@latin]=Trenutni datum i vreme, lokalno ili u nekoj drugoj vremenskoj zoni Comment[sv]=Nuvarande datum och tid, lokalt eller i godtycklig tidszon Comment[tr]=Yerel veya herhangi bir zaman dilimindeki tarih ve zaman Comment[uk]=Поточна дата і час, місцевий або час будь-якого часового поясу Comment[x-test]=xxThe current date and time, locally or in any timezonexx Comment[zh_CN]=当前日期和时间,本地或任何时区 Comment[zh_TW]=目前的日期與時間,可以是任何時區 X-KDE-ServiceTypes=Plasma/Runner Type=Service Icon=clock -X-KDE-Library=krunner_datetime +X-KDE-Library=kf5/krunner/krunner_datetime X-KDE-PluginInfo-Author=Plasma Team X-KDE-PluginInfo-Email=plasma-devel@kde.org X-KDE-PluginInfo-Name=org.kde.datetime X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true diff --git a/runners/dictionary/CMakeLists.txt b/runners/dictionary/CMakeLists.txt index 717e6c798..cb39e323a 100644 --- a/runners/dictionary/CMakeLists.txt +++ b/runners/dictionary/CMakeLists.txt @@ -1,13 +1,15 @@ add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_krunner_dictionary") set(dictionaryrunner_SRCS dictionaryrunner.cpp dictionarymatchengine.cpp) set(kcm_dictionaryrunner_SRCS dictionaryrunner_config.cpp) add_library(krunner_dictionary MODULE ${dictionaryrunner_SRCS}) -add_library(kcm_krunner_dictionary MODULE ${kcm_dictionaryrunner_SRCS}) - +kcoreaddons_desktop_to_json(krunner_dictionary plasma-runner-dictionary.desktop ) target_link_libraries(krunner_dictionary KF5::Runner KF5::I18n) + +add_library(kcm_krunner_dictionary MODULE ${kcm_dictionaryrunner_SRCS}) target_link_libraries(kcm_krunner_dictionary KF5::Runner KF5::I18n KF5::KCMUtils) -install(TARGETS krunner_dictionary kcm_krunner_dictionary DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-dictionary.desktop plasma-runner-dictionary_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_dictionary DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) +install(TARGETS kcm_krunner_dictionary DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES plasma-runner-dictionary_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/runners/dictionary/dictionaryrunner.cpp b/runners/dictionary/dictionaryrunner.cpp index 5230cbb2d..304f76985 100644 --- a/runners/dictionary/dictionaryrunner.cpp +++ b/runners/dictionary/dictionaryrunner.cpp @@ -1,88 +1,88 @@ /* * Copyright (C) 2010, 2012 Jason A. Donenfeld */ #include "dictionaryrunner.h" #include #include static const char CONFIG_TRIGGERWORD[] = "triggerWord"; DictionaryRunner::DictionaryRunner(QObject *parent, const QVariantList &args) : AbstractRunner(parent, args) { m_engine = new DictionaryMatchEngine(dataEngine(QStringLiteral("dict")), this); setSpeed(SlowSpeed); setPriority(LowPriority); setObjectName(QLatin1String("Dictionary")); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::Executable | Plasma::RunnerContext::ShellCommand); } void DictionaryRunner::init() { reloadConfiguration(); } void DictionaryRunner::reloadConfiguration() { KConfigGroup c = config(); m_triggerWord = c.readEntry(CONFIG_TRIGGERWORD, i18nc("Trigger word before word to define", "define")); if (!m_triggerWord.isEmpty()) m_triggerWord.append(QLatin1Char(' ')); setSyntaxes(QList() << Plasma::RunnerSyntax(Plasma::RunnerSyntax(i18nc("Dictionary keyword", "%1:q:", m_triggerWord), i18n("Finds the definition of :q:.")))); } void DictionaryRunner::match(Plasma::RunnerContext &context) { QString query = context.query(); if (!query.startsWith(m_triggerWord, Qt::CaseInsensitive)) return; query.remove(0, m_triggerWord.length()); if (query.isEmpty()) return; QString returnedQuery = m_engine->lookupWord(query); if (!context.isValid()) return; static const QRegExp removeHtml(QLatin1String("<[^>]*>")); QString definitions(returnedQuery); definitions.remove(QLatin1Char('\r')).remove(removeHtml); while (definitions.contains(QLatin1String(" "))) definitions.replace(QLatin1String(" "), QLatin1String(" ")); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QStringList lines = definitions.split(QLatin1Char('\n'), QString::SkipEmptyParts); #else QStringList lines = definitions.split(QLatin1Char('\n'), Qt::SkipEmptyParts); #endif if (lines.length() < 2) return; lines.removeFirst(); QList matches; int item = 0; static const QRegExp partOfSpeech(QLatin1String("(?: ([a-z]{1,5})){0,1} [0-9]{1,2}: (.*)")); QString lastPartOfSpeech; foreach (const QString &line, lines) { if (partOfSpeech.indexIn(line) == -1) continue; if (!partOfSpeech.cap(1).isEmpty()) lastPartOfSpeech = partOfSpeech.cap(1); Plasma::QueryMatch match(this); match.setText(query + QLatin1String(": ") + lastPartOfSpeech); match.setRelevance(1 - (static_cast(++item) / static_cast(lines.length()))); match.setType(Plasma::QueryMatch::InformationalMatch); match.setIconName(QStringLiteral("accessories-dictionary")); match.setSubtext(partOfSpeech.cap(2)); matches.append(match); } context.addMatches(matches); } -K_EXPORT_PLASMA_RUNNER(krunner_dictionary, DictionaryRunner) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(DictionaryRunner, "plasma-runner-dictionary.json") #include "dictionaryrunner.moc" diff --git a/runners/dictionary/plasma-runner-dictionary.desktop b/runners/dictionary/plasma-runner-dictionary.desktop index ee2677b78..df26a6881 100644 --- a/runners/dictionary/plasma-runner-dictionary.desktop +++ b/runners/dictionary/plasma-runner-dictionary.desktop @@ -1,121 +1,121 @@ [Desktop Entry] Name=Dictionary Name[ar]=قاموس Name[ast]=Diccionariu Name[bs]=Rječnik Name[ca]=Diccionari Name[ca@valencia]=Diccionari Name[cs]=Slovník Name[csb]=Slowôrz Name[da]=Ordbog Name[de]=Wörterbuch Name[el]=Λεξικό Name[en_GB]=Dictionary Name[eo]=Vortaro Name[es]=Diccionario Name[et]=Sõnaraamat Name[eu]=Hiztegia Name[fi]=Sanakirja Name[fr]=Dictionnaire Name[ga]=Foclóir Name[gl]=Dicionario Name[he]=מילון Name[hr]=Rječnik Name[hu]=Hunspell szótárfájl Name[ia]=Dictionario Name[id]=Kamus Name[is]=Orðabók Name[it]=Dizionario Name[ja]=辞書 Name[kk]=Сөздік Name[km]=វចនានុក្រម Name[ko]=사전 Name[ku]=Ferheng Name[lt]=Žodynas Name[lv]=Vārdnīca Name[mr]=शब्दकोश Name[ms]=Kamus Name[nb]=Ordbok Name[nds]=Wöörbook Name[nl]=Woordenboek Name[nn]=Ordbok Name[pa]=ਡਿਕਸ਼ਨਰੀ Name[pl]=Słownik Name[pt]=Dicionário Name[pt_BR]=Dicionário Name[ro]=Dicționar Name[ru]=Словарь Name[sk]=Slovník Name[sl]=Slovar Name[sq]=Fjalori Name[sr]=речник Name[sr@ijekavian]=рјечник Name[sr@ijekavianlatin]=rječnik Name[sr@latin]=rečnik Name[sv]=Ordlista Name[tg]=Луғат Name[th]=พจนานุกรม Name[tr]=Sözlük Name[ug]=لۇغەت Name[uk]=Словник Name[wa]=Motî Name[x-test]=xxDictionaryxx Name[zh_CN]=词典 Name[zh_TW]=字典 Comment=Define words Comment[ar]=تعريف الكلمات Comment[ast]=Define pallabres Comment[bs]=Definipi riječi Comment[ca]=Defineix mots Comment[ca@valencia]=Defineix mots Comment[cs]=Definujte slova Comment[da]=Definér ord Comment[de]=Wörter definieren Comment[el]=Ορισμός λέξεων Comment[en_GB]=Define words Comment[es]=Definir palabras Comment[et]=Sõnade definitsioonid Comment[eu]=Hitzak definitu Comment[fi]=Määrittele sanoja Comment[fr]=Définir des mots Comment[ga]=Sainmhínigh focail Comment[gl]=Definir palabras. Comment[he]=הגדר מילים Comment[hu]=Szavak meghatározása Comment[id]=Tentukan kata Comment[it]=Definizione delle parole Comment[kk]=Сөздерді анықтау Comment[ko]=단어 정의 Comment[lt]=Apibrėžti žodžius Comment[mr]=शब्दांची व्याख्या करा Comment[nb]=Definer ord Comment[nds]=Wöör fastleggen Comment[nl]=Woorden definiëren Comment[nn]=Definer ord Comment[pl]=Zawiera wyjaśnienia słów Comment[pt]=Definir as palavras Comment[pt_BR]=Definição de palavras Comment[ro]=Definește cuvinte Comment[ru]=Определение слов Comment[sk]=Definovať slová Comment[sl]=Določi besede Comment[sr]=Дефиниције речи Comment[sr@ijekavian]=Дефиниције ријечи Comment[sr@ijekavianlatin]=Definicije riječi Comment[sr@latin]=Definicije reči Comment[sv]=Definiera ord Comment[tr]=Kelime tanımlayın Comment[uk]=Визначення термінів Comment[x-test]=xxDefine wordsxx Comment[zh_CN]=定义单词 Comment[zh_TW]=定義單字 X-KDE-ServiceTypes=Plasma/Runner Type=Service Icon=accessories-dictionary -X-KDE-Library=krunner_dictionary +X-KDE-Library=kf5/krunner/krunner_dictionary X-KDE-PluginInfo-Author=Jason A. Donenfeld X-KDE-PluginInfo-Email=Jason@zx2c4.com X-KDE-PluginInfo-Name=Dictionary X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true diff --git a/runners/katesessions/CMakeLists.txt b/runners/katesessions/CMakeLists.txt index 8f6ed1ca8..dc1ba129d 100644 --- a/runners/katesessions/CMakeLists.txt +++ b/runners/katesessions/CMakeLists.txt @@ -1,8 +1,8 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_runner_katesessions\") set(krunner_katesessions_SRCS katesessions.cpp) add_library(krunner_katesessions MODULE ${krunner_katesessions_SRCS}) +kcoreaddons_desktop_to_json(krunner_katesessions plasma-runner-katesessions.desktop) target_link_libraries(krunner_katesessions KF5::KIOGui KF5::Notifications KF5::I18n KF5::Runner) -install(TARGETS krunner_katesessions DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-katesessions.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_katesessions DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) diff --git a/runners/katesessions/katesessions.cpp b/runners/katesessions/katesessions.cpp index 4bed73ff9..0e7790ca7 100644 --- a/runners/katesessions/katesessions.cpp +++ b/runners/katesessions/katesessions.cpp @@ -1,131 +1,131 @@ /* * Copyright 2008 Sebastian Kügler * Copyright 2017 Kai Uwe Broulik * Copyright 2020 Alexander Lohnau * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "katesessions.h" #include #include #include #include #include #include #include #include -K_EXPORT_PLASMA_RUNNER(katesessionsrunner, KateSessions) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(KateSessions, "plasma-runner-katesessions.json") KateSessions::KateSessions(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { setObjectName(QStringLiteral("Kate Sessions")); setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | Plasma::RunnerContext::NetworkLocation); Plasma::RunnerSyntax s(QStringLiteral("kate :q:"), i18n("Finds Kate sessions matching :q:.")); addSyntax(s); setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("kate"), i18n("Lists all the Kate editor sessions in your account."))); m_sessionsFolderPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kate/sessions"); // Initialize watchers and sessions m_sessionWatch = new KDirWatch(this); m_sessionWatch->addDir(m_sessionsFolderPath); connect(m_sessionWatch, &KDirWatch::dirty, this, &KateSessions::loadSessions); connect(m_sessionWatch, &KDirWatch::created, this, &KateSessions::loadSessions); connect(m_sessionWatch, &KDirWatch::deleted, this, &KateSessions::loadSessions); loadSessions(); } KateSessions::~KateSessions() { } void KateSessions::loadSessions() { QStringList sessions; const QDir sessionsDir(m_sessionsFolderPath); const auto &sessionFiles = sessionsDir.entryInfoList({QStringLiteral("*.katesession")}, QDir::Files, QDir::Name); for (const QFileInfo &sessionFile : sessionFiles) { sessions.append(QUrl::fromPercentEncoding(sessionFile.baseName().toLocal8Bit())); } m_sessions = sessions; } void KateSessions::match(Plasma::RunnerContext &context) { QString term = context.query(); if (term.length() < 3 || m_sessions.isEmpty() || !context.isValid()) { return; } // Kate writes sessions as desktop actions in the local .desktop file => // they are already available from the "Applications" Runner and in the normal launcher if (!term.startsWith(m_triggerWord, Qt::CaseInsensitive)) { return; } bool listAll = false; if (term.trimmed().compare(m_triggerWord, Qt::CaseInsensitive) == 0) { listAll = true; term.clear(); } else if (term.at(4) == QLatin1Char(' ')) { term = term.remove(m_triggerWord, Qt::CaseInsensitive).trimmed(); } else { // Prevent results for queries like "katee" return; } for (const QString &session: qAsConst(m_sessions)) { if (listAll || session.contains(term, Qt::CaseInsensitive)) { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::ExactMatch); match.setRelevance(session.compare(term, Qt::CaseInsensitive) == 0 ? 1 : 0.8); match.setIconName(m_triggerWord); match.setData(session); match.setText(session); match.setSubtext(i18n("Open Kate Session")); context.addMatch(match); } } } void KateSessions::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) { Q_UNUSED(context) auto *job = new KIO::CommandLauncherJob(QStringLiteral("kate"), { QStringLiteral("--start"), match.data().toString(), QStringLiteral("-n") }); job->setDesktopName(QStringLiteral("org.kde.kate")); auto *delegate = new KNotificationJobUiDelegate; delegate->setAutoErrorHandlingEnabled(true); job->setUiDelegate(delegate); job->start(); } #include "katesessions.moc" diff --git a/runners/katesessions/plasma-runner-katesessions.desktop b/runners/katesessions/plasma-runner-katesessions.desktop index 156f20e98..c88148ce9 100644 --- a/runners/katesessions/plasma-runner-katesessions.desktop +++ b/runners/katesessions/plasma-runner-katesessions.desktop @@ -1,126 +1,126 @@ [Desktop Entry] Name=Kate Sessions Name[ar]=جلسات كيت Name[ast]=Sesiones de Kate Name[bs]=Kate sesije Name[ca]=Sessions del Kate Name[ca@valencia]=Sessions de Kate Name[cs]=Sezení Kate Name[da]=Kate-sessioner Name[de]=Kate-Sitzungen Name[el]=Συνεδρίες Kate Name[en_GB]=Kate Sessions Name[es]=Sesiones de Kate Name[et]=Kate seansid Name[eu]=Kate saioak Name[fi]=Kate-istunnot Name[fr]=Sessions Kate Name[ga]=Seisiúin Kate Name[gl]=Sesións de Kate Name[he]=הפעלות Kate Name[hr]=Sesije u Kateu Name[hu]=Kate munkamenetek Name[ia]=Sessiones de Kate Name[id]=Sesi Kate Name[is]=Kate setur Name[it]=Sessioni di Kate Name[ja]=Kate セッション Name[kk]=Kate сеанстары Name[km]=សម័យ​របស់ Kate Name[ko]=Kate 세션 Name[ku]=Danişînên Kate Name[lt]=Kate seansai Name[lv]=Kate sesijas Name[mr]=केट सत्र Name[nb]=Kate-økter Name[nds]=Kate-Törns Name[nl]=Kate-sessies Name[nn]=Kate-øktveljar Name[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ Name[pl]=Sesje Kate Name[pt]=Sessões do Kate Name[pt_BR]=Sessões do Kate Name[ro]=Sesiuni Kate Name[ru]=Kate: сеансы Name[sk]=Sedenia Kate Name[sl]=Seje programa Kate Name[sr]=Кејтине сесије Name[sr@ijekavian]=Кејтине сесије Name[sr@ijekavianlatin]=Kateine sesije Name[sr@latin]=Kateine sesije Name[sv]=Kate-sessioner Name[th]=กลุ่มงานของ Kate Name[tr]=Kate Oturumları Name[uk]=Сеанси Kate Name[wa]=Sessions di Kate Name[x-test]=xxKate Sessionsxx Name[zh_CN]=Kate 会话 Name[zh_TW]=Kate 作業階段 Comment=Matches Kate Sessions Comment[ar]=تطابق جلسات كيت Comment[bs]=Odgovarajuće Kate sesije Comment[ca]=Correspon amb sessions del Kate Comment[ca@valencia]=Correspon amb sessions de Kate Comment[cs]=Vyhledávání v sezeních Kate Comment[da]=Matcher Kate-sessioner. Comment[de]=Findet Kate-Sitzungen Comment[el]=Αντιστοίχηση συνεδριών Kate Comment[en_GB]=Matches Kate Sessions Comment[es]=Busca sesiones de Kate que coincidan Comment[et]=Kate seansid Comment[eu]=Bat datozen Kate saioak Comment[fi]=Täsmää Kate-istuntoihin Comment[fr]=Retrouve des sessions Kate Comment[ga]=Comhoiriúnach do Sheisiúin Kate Comment[gl]=Atopa sesión de Kate. Comment[he]=מתאים הפעלות Kate Comment[hr]=Odgovara sesijama u Kateu Comment[hu]=Kate munkamenetek listázása Comment[id]=Mencocokkan Sesi Kate Comment[is]=Samsvarar Kate setum Comment[it]=Verifica sessioni di Kate Comment[ja]=Kate のセッションを探します Comment[kk]=Kate сеанстарын салыстыру Comment[km]=ផ្គូផ្គង​សម័យ​របស់ Kate Comment[ko]=Kate 세션과 일치 Comment[ku]=Danişînên Kate yên Hevgirtî Comment[lt]=Atitinka Kate seansus Comment[lv]=Meklē Kate sesijas Comment[mr]=केट सत्र जुळवितो Comment[nb]=Treffer Kate-økter Comment[nds]=Kiekt na passen Kate-Törns Comment[nl]=Zoekt Kate-sessies Comment[nn]=Start Kate-økter Comment[pa]=ਰਲਦੇ ਕੇਟ ਸ਼ੈਸ਼ਨ Comment[pl]=Wyszukuje sesji Kate Comment[pt]=Corresponde às Sessões do Kate Comment[pt_BR]=Corresponder às sessões do Kate Comment[ro]=Potrivește sesiuni Kate Comment[ru]=Открытие сеансов Kate Comment[sk]=Vyhľadávanie v sedeniach Kate Comment[sl]=Ujemanja s sejami programa Kate Comment[sr]=Поклапа Кејтине сесије Comment[sr@ijekavian]=Поклапа Кејтине сесије Comment[sr@ijekavianlatin]=Poklapa Kateine sesije Comment[sr@latin]=Poklapa Kateine sesije Comment[sv]=Matchar Kate-sessioner Comment[th]=จับคู่ให้ตรงกับกลุ่มงานของ Kate Comment[tr]=Kate Oturumlarını Eşleştirir Comment[uk]=Шукає сеанси Kate Comment[wa]=Fwait coresponde les sessions d' Kate Comment[x-test]=xxMatches Kate Sessionsxx Comment[zh_CN]=匹配 Kate 会话 Comment[zh_TW]=比對 Kate 工作階段 Icon=kate X-KDE-ServiceTypes=Plasma/Runner Type=Service TryExec=kate -X-KDE-Library=krunner_katesessions +X-KDE-Library=kf5/krunner/krunner_katesessions X-KDE-PluginInfo-Author=Sebastian Kügler X-KDE-PluginInfo-Email=sebas@kde.org X-KDE-PluginInfo-Name=katesessions X-KDE-PluginInfo-Version=1.1 X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true X-Plasma-AdvertiseSingleRunnerQueryMode=true diff --git a/runners/konsoleprofiles/CMakeLists.txt b/runners/konsoleprofiles/CMakeLists.txt index 339721ec7..923756a9d 100644 --- a/runners/konsoleprofiles/CMakeLists.txt +++ b/runners/konsoleprofiles/CMakeLists.txt @@ -1,16 +1,16 @@ add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_konsoleprofiles") set(krunner_konsoleprofiles_SRCS konsoleprofiles.cpp ) add_library(krunner_konsoleprofiles MODULE ${krunner_konsoleprofiles_SRCS}) +kcoreaddons_desktop_to_json(krunner_konsoleprofiles plasma-runner-konsoleprofiles.desktop) target_link_libraries(krunner_konsoleprofiles KF5::Runner KF5::KIOGui KF5::I18n KF5::Notifications ) -install(TARGETS krunner_konsoleprofiles DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-konsoleprofiles.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS krunner_konsoleprofiles DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) diff --git a/runners/konsoleprofiles/konsoleprofiles.cpp b/runners/konsoleprofiles/konsoleprofiles.cpp index 372bec2d1..fdd8f953f 100644 --- a/runners/konsoleprofiles/konsoleprofiles.cpp +++ b/runners/konsoleprofiles/konsoleprofiles.cpp @@ -1,141 +1,141 @@ /* * Copyright 2008 Montel Laurent * based on kate session from sebas * Copyright 2020 Alexander Lohnau * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "konsoleprofiles.h" // KF #include #include #include #include #include // Qt #include #include #include KonsoleProfiles::KonsoleProfiles(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { setObjectName(QStringLiteral("Konsole Profiles")); setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | Plasma::RunnerContext::NetworkLocation); Plasma::RunnerSyntax s(QStringLiteral(":q:"), i18n("Finds Konsole profiles matching :q:.")); s.addExampleQuery(QStringLiteral("konsole :q:")); addSyntax(s); setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("konsole"), i18n("Lists all the Konsole profiles in your account."))); } KonsoleProfiles::~KonsoleProfiles() = default; void KonsoleProfiles::init() { // Initialize profiles and file watcher m_profileFilesWatch = new KDirWatch(this); const QStringList konsoleDataBaseDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); for (const QString &konsoleDataBaseDir : konsoleDataBaseDirs) { m_profileFilesWatch->addDir(konsoleDataBaseDir + QStringLiteral("/konsole")); } connect(m_profileFilesWatch, &KDirWatch::dirty, this, &KonsoleProfiles::loadProfiles); connect(m_profileFilesWatch, &KDirWatch::created, this, &KonsoleProfiles::loadProfiles); connect(m_profileFilesWatch, &KDirWatch::deleted, this, &KonsoleProfiles::loadProfiles); loadProfiles(); } void KonsoleProfiles::loadProfiles() { m_profiles.clear(); QStringList profilesPaths; const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory); for (const auto &dir : dirs) { const QStringList fileNames = QDir(dir).entryList({QStringLiteral("*.profile")}); for (const QString &fileName : fileNames) { profilesPaths.append(dir + QLatin1Char('/') + fileName); } } for (const auto &profilePath : qAsConst(profilesPaths)) { const QString profileName = QFileInfo(profilePath).baseName(); const KConfig _config(profilePath, KConfig::SimpleConfig); if (_config.hasGroup("General")) { KonsoleProfileData profileData; const KConfigGroup cfg = _config.group("General"); profileData.displayName = cfg.readEntry("Name", profileName); profileData.iconName = cfg.readEntry("Icon", QStringLiteral("utilities-terminal")); if (!profileData.displayName.isEmpty()) { m_profiles.append(profileData); } } } suspendMatching(m_profiles.isEmpty()); } void KonsoleProfiles::match(Plasma::RunnerContext &context) { QString term = context.query(); if (term.length() < 3 || !context.isValid()) { return; } term = term.remove(m_triggerWord).simplified(); for (const KonsoleProfileData &data: qAsConst(m_profiles)) { if (data.displayName.contains(term, Qt::CaseInsensitive)) { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::PossibleMatch); match.setIconName(data.iconName); match.setData(data.displayName); match.setText(QStringLiteral("Konsole: ") + data.displayName); match.setRelevance((float) term.length() / (float) data.displayName.length()); context.addMatch(match); } } } void KonsoleProfiles::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) { Q_UNUSED(context) const QString profile = match.data().toString(); auto *job = new KIO::CommandLauncherJob(QStringLiteral("konsole"), { QStringLiteral("--profile"), profile }); job->setDesktopName(QStringLiteral("org.kde.konsole")); auto *delegate = new KNotificationJobUiDelegate; delegate->setAutoErrorHandlingEnabled(true); job->setUiDelegate(delegate); job->start(); } -K_EXPORT_PLASMA_RUNNER(konsoleprofiles, KonsoleProfiles) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(KonsoleProfiles, "plasma-runner-konsoleprofiles.json") #include "konsoleprofiles.moc" diff --git a/runners/konsoleprofiles/plasma-runner-konsoleprofiles.desktop b/runners/konsoleprofiles/plasma-runner-konsoleprofiles.desktop index bd00d6166..43c5665e9 100644 --- a/runners/konsoleprofiles/plasma-runner-konsoleprofiles.desktop +++ b/runners/konsoleprofiles/plasma-runner-konsoleprofiles.desktop @@ -1,101 +1,101 @@ [Desktop Entry] Name=Konsole Profiles Name[ar]=تشكيلات كونسول Name[ast]=Perfiles de Konsole Name[bs]=Konzolini profili Name[ca]=Perfils del Konsole Name[ca@valencia]=Perfils de Konsole Name[cs]=Profily Konsole Name[da]=Konsole-profiler Name[de]=Konsole-Profile Name[el]=Προφίλ Konsole Name[en_GB]=Konsole Profiles Name[es]=Perfiles de Konsole Name[et]=Konsooli profiilid Name[eu]=Kontsolaren profilak Name[fi]=Konsole-profiilit Name[fr]=Profils de Konsole Name[ga]=Próifílí Konsole Name[gl]=Perfís de Konsole Name[he]=הפרופילים של Konsole Name[hr]=Profili u Konsoleu Name[hu]=Konsole profilok Name[ia]=Profilos de Konsole Name[id]=Konsole Profiles Name[is]=Konsole snið Name[it]=Profili di Konsole Name[ja]=Konsole プロファイル Name[kk]=Konsole профильдері Name[km]=ទម្រង់​របស់ Konsole Name[ko]=Konsole 프로필 Name[ku]=Profîlên Konsolê Name[lt]=Konsole profiliai Name[lv]=Konsole profili Name[mr]=कंसोल रूपरेषा Name[nb]=Konsole-profiler Name[nds]=Konsole-Profilen Name[nl]=Konsole-profielen Name[nn]=Konsoll-profilar Name[pa]=ਕਨਸੋਲ ਪਰੋਫਾਇਲ Name[pl]=Profile Konsoli Name[pt]=Perfis do Konsole Name[pt_BR]=Perfis do Konsole Name[ro]=Profiluri konsolă Name[ru]=Konsole: профили Name[sk]=Profily Konsole Name[sl]=Profili za Konsole Name[sr]=Конзолини профили Name[sr@ijekavian]=Конзолини профили Name[sr@ijekavianlatin]=Konsolini profili Name[sr@latin]=Konsolini profili Name[sv]=Terminalprofiler Name[th]=โพรไฟล์คอนโซล-K Name[tr]=Konsole Profilleri Name[uk]=Профілі Konsole Name[wa]=Profils di Konsole Name[x-test]=xxKonsole Profilesxx Name[zh_CN]=Konsole 配置 Name[zh_TW]=Konsole 設定檔 Comment=Matches Konsole Profiles Comment[ca]=Correspon amb perfils del Konsole Comment[ca@valencia]=Correspon amb perfils de Konsole Comment[da]=Matcher Konsole-profiler Comment[de]=Findet Konsole-Profile Comment[el]=Αντιστοιχεί τα προφίλ Konsole Comment[en_GB]=Matches Konsole Profiles Comment[es]=Busca perfiles de Konsole que coincidan Comment[et]=Konsooli profiilide sobitamine Comment[eu]=Bat datozen Konsole profilak Comment[fi]=Vastaa konsole-profiileja Comment[fr]=Retrouve des profils Konsole Comment[gl]=Atopa perfís de Konsole. Comment[hu]=Konsole profilok listázása Comment[ia]=Coincide profilos de Konsole Comment[id]=Mencocokkan Profil Konsole Comment[it]=Verifica profili di Konsole Comment[ko]=Konsole 프로필과 일치 Comment[lt]=Atitinka Konsole profilius Comment[nl]=Komt overeen met Konsole-profielen Comment[nn]=Lik Konsoll-profilar Comment[pl]=Dopasowuje profile Konsoli Comment[pt]=Corresponde aos Perfis do Konsole Comment[pt_BR]=Corresponde aos perfis do Konsole Comment[ru]=Выбор профилей Konsole Comment[sk]=Vyhľadávanie v prifiloch Konsole Comment[sl]=Ujemanja Profilov za Konsole Comment[sv]=Matchar terminalprofiler Comment[uk]=Шукає профілі Konsole Comment[x-test]=xxMatches Konsole Profilesxx Comment[zh_CN]=匹配 Konsole 配置 Comment[zh_TW]=符合的 Konsole 設定檔 Icon=utilities-terminal X-KDE-ServiceTypes=Plasma/Runner Type=Service -X-KDE-Library=krunner_konsoleprofiles +X-KDE-Library=kf5/krunner/krunner_konsoleprofiles X-KDE-PluginInfo-Author=Laurent Montel X-KDE-PluginInfo-Email=montel@kde.org X-KDE-PluginInfo-Name=konsoleprofiles X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true diff --git a/runners/spellchecker/CMakeLists.txt b/runners/spellchecker/CMakeLists.txt index 021af31cc..36a686512 100644 --- a/runners/spellchecker/CMakeLists.txt +++ b/runners/spellchecker/CMakeLists.txt @@ -1,31 +1,34 @@ add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_spellcheckrunner") set(krunner_spellcheckrunner_SRCS spellcheck.cpp ) set(kcm_krunner_spellcheck_SRCS spellcheck_config.cpp ) ki18n_wrap_ui(kcm_krunner_spellcheck_SRCS spellcheck_config.ui) add_library(kcm_krunner_spellcheck MODULE ${kcm_krunner_spellcheck_SRCS}) target_link_libraries(kcm_krunner_spellcheck Qt5::Gui KF5::Runner KF5::KCMUtils KF5::I18n ) add_library(krunner_spellcheck MODULE ${krunner_spellcheckrunner_SRCS}) +kcoreaddons_desktop_to_json(krunner_spellcheck plasma-runner-spellchecker.desktop) target_link_libraries(krunner_spellcheck KF5::Runner KF5::KIOWidgets KF5::I18n KF5::SonnetCore ) -install(TARGETS krunner_spellcheck kcm_krunner_spellcheck +install(TARGETS krunner_spellcheck + DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/krunner) +install(TARGETS kcm_krunner_spellcheck DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES plasma-runner-spellchecker.desktop plasma-runner-spellchecker_config.desktop +install(FILES plasma-runner-spellchecker_config.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/runners/spellchecker/plasma-runner-spellchecker.desktop b/runners/spellchecker/plasma-runner-spellchecker.desktop index e41f33582..d08aff342 100644 --- a/runners/spellchecker/plasma-runner-spellchecker.desktop +++ b/runners/spellchecker/plasma-runner-spellchecker.desktop @@ -1,121 +1,121 @@ [Desktop Entry] Name=Spell Checker Name[ar]=المدقق الإملائي Name[ast]=Correutor ortográficu Name[bs]=Provjera pravopisa Name[ca]=Corrector ortogràfic Name[ca@valencia]=Corrector ortogràfic Name[cs]=Kontrola pravopisu Name[da]=Stavekontrol Name[de]=Rechtschreibprüfung Name[el]=Ορθογραφικός έλεγχος Name[en_GB]=Spell Checker Name[es]=Revisor ortográfico Name[et]=Õigekirja kontroll Name[eu]=Ortografia zuzentzailea Name[fi]=Oikoluku Name[fr]=Correcteur orthographique Name[ga]=Litreoir Name[gl]=Corrector ortográfico Name[he]=בודק האיות Name[hu]=Helyesírás-ellenőrző indító Name[ia]=Controlator Orthographic Name[id]=Pemeriksa Ejaan Name[it]=Controllo ortografico Name[kk]=Емле тексергіші Name[km]=ពិនិត្យ​អក្ខរាវិរុទ្ធ Name[ko]=맞춤법 검사 Name[lt]=Rašybos tikrinimas Name[lv]=Pareizrakstības pārbaudītājs Name[mr]=स्पेलिंग तपासणी Name[nb]=Stavekontroll Name[nds]=Klookschriever Name[nl]=Spellingcontrole Name[nn]=Stavekontroll Name[pa]=ਸਪੈਲ ਚੈਕਰ Name[pl]=Sprawdzanie pisowni Name[pt]=Verificador Ortográfico Name[pt_BR]=Verificador ortográfico Name[ro]=Verificator ortografic Name[ru]=Проверка орфографии Name[sk]=Kontrola pravopisu Name[sl]=Preverjanje črkovanja Name[sr]=правописар Name[sr@ijekavian]=правописар Name[sr@ijekavianlatin]=pravopisar Name[sr@latin]=pravopisar Name[sv]=Stavningskontroll Name[tg]=Санҷиши имло Name[tr]=Yazım Denetleyici Name[ug]=ئىملا تەكشۈرگۈچ Name[uk]=Перевірка правопису Name[wa]=Coridjrece ortografike Name[x-test]=xxSpell Checkerxx Name[zh_CN]=拼写检查 Name[zh_TW]=拼字檢查 Comment=Check the spelling of a word Comment[ar]=تحقق من هجاء الكلمات Comment[ast]=Comprueba la ortografía de pallabres Comment[bs]=Provjeri pravopis riječi Comment[ca]=Comprova l'ortografia d'una paraula Comment[ca@valencia]=Comprova l'ortografia d'una paraula Comment[cs]=Kontrola pravopisu Comment[da]=Tjekker et ords stavning. Comment[de]=Rechtschreibung eines Wortes überprüfen Comment[el]=Ορθογραφικός έλεγχος μιας λέξης Comment[en_GB]=Check the spelling of a word Comment[es]=Comprobar la ortografía de una palabra Comment[et]=Sõnade õigekirja kontroll Comment[eu]=Hitz baten ortografia aztertzen du Comment[fi]=Tarkastaa sanan oikeinkirjotuksen Comment[fr]=Vérifie l'orthographe d'un mot Comment[ga]=Seiceáil litriú focail Comment[gl]=Comproba a ortografía dunha palabra. Comment[he]=בודק איות של מילה Comment[hr]=Provjerite pravopis riječi Comment[hu]=Egy szó helyesírás-ellenőrzése Comment[id]=Periksa ejaan sebuah kata Comment[is]=Athuga stafsetningu orðs Comment[it]=Controlla l'ortografia di una parola Comment[ja]=単語のスペルをチェックします Comment[kk]=Бір сөздің емлесін тексеру Comment[km]=ពិនិត្យ​មើល​កា​រប្រកប​ពាក្យ Comment[ko]=단어의 맞춤법 검사 Comment[ku]=Rastnivîsa peyvekê kontrol dike Comment[lt]=Žodžių rašybos tikrinimas Comment[lv]=Pārbauda vārda pareizrakstību Comment[mr]=शब्दाचे स्पेलिंग तपासा Comment[nb]=Sjekk skrivemåten for et ord Comment[nds]=De Schriefwies vun en Woort pröven Comment[nl]=Controleer de spelling van een woord Comment[nn]=Sjekk om ord er stava rett Comment[pa]=ਸ਼ਬਦਾਂ ਦੇ ਸਪੈਲਿੰਗ ਚੈੱਕ ਕਰੋ Comment[pl]=Sprawdza pisownie słów Comment[pt]=Verificar a ortografia de uma palavra Comment[pt_BR]=Verifica a ortografia de uma palavra Comment[ro]=Verifică ortografia unui cuvânt Comment[ru]=Проверка правописания слова Comment[sk]=Kontrolovanie pravopisu Comment[sl]=Preverite črkovanje besede Comment[sr]=Проверите да ли је реч исправно написана Comment[sr@ijekavian]=Провјерите да ли је ријеч исправно написана Comment[sr@ijekavianlatin]=Provjerite da li je riječ ispravno napisana Comment[sr@latin]=Proverite da li je reč ispravno napisana Comment[sv]=Kontrollera stavning av ett ord Comment[th]=ตรวจสอบการสะกดคำ Comment[tr]=Bir sözcüğün yazımını denetle Comment[uk]=Перевірте правопис слова Comment[wa]=Coridjî l' ortografeye d' on mot Comment[x-test]=xxCheck the spelling of a wordxx Comment[zh_CN]=检查单词拼写 Comment[zh_TW]=檢查拼字 X-KDE-ServiceTypes=Plasma/Runner Type=Service Icon=tools-check-spelling -X-KDE-Library=krunner_spellcheck +X-KDE-Library=kf5/krunner/krunner_spellcheck X-KDE-PluginInfo-Author=Ryan P. Bitanga X-KDE-PluginInfo-Email=ryan.bitanga@gmail.com X-KDE-PluginInfo-Name=Spell Checker X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false diff --git a/runners/spellchecker/spellcheck.cpp b/runners/spellchecker/spellcheck.cpp index 8a7ad2d10..8301bf77a 100644 --- a/runners/spellchecker/spellcheck.cpp +++ b/runners/spellchecker/spellcheck.cpp @@ -1,276 +1,276 @@ /* * Copyright (C) 2007 Ryan P. Bitanga * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License version 2 as * published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "spellcheck.h" #include #include #include #include #include #include #include #include SpellCheckRunner::SpellCheckRunner(QObject* parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args) setObjectName(QStringLiteral("Spell Checker")); setIgnoredTypes(Plasma::RunnerContext::FileSystem | Plasma::RunnerContext::NetworkLocation); setSpeed(AbstractRunner::SlowSpeed); } SpellCheckRunner::~SpellCheckRunner() = default; void SpellCheckRunner::init() { m_actions = {addAction(QStringLiteral("copyToClipboard"), QIcon::fromTheme(QStringLiteral("edit-copy")), i18nc("@action", "Copy to Clipboard"))}; //Connect prepare and teardown signals connect(this, &SpellCheckRunner::prepare, this, &SpellCheckRunner::loadData); connect(this, &SpellCheckRunner::teardown, this, &SpellCheckRunner::destroydata); reloadConfiguration(); } //Load a default dictionary and some locale names void SpellCheckRunner::loadData() { //Load the default speller, with the default language auto defaultSpellerIt = m_spellers.find(QString()); if (defaultSpellerIt == m_spellers.end()) { defaultSpellerIt = m_spellers.insert(QString(), QSharedPointer (new Sonnet::Speller(QString()))); } auto& defaultSpeller = defaultSpellerIt.value(); //store all language names, makes it possible to type "spell german TERM" if english locale is set //Need to construct a map between natual language names and names the spell-check recognises. const QStringList avail = defaultSpeller->availableLanguages(); //We need to filter the available languages so that we associate the natural language //name (eg. 'german') with one sub-code. QSet families; //First get the families for (const QString &code: avail) { families +=code.left(2); } //Now for each family figure out which is the main code. for (const QString &fcode: qAsConst(families)) { const QStringList family = avail.filter(fcode); QString code; //If we only have one code, use it. //If a string is the default language, use it if (family.contains(defaultSpeller->language())) { code = defaultSpeller->language(); } else if (fcode == QLatin1String("en")) { //If the family is english, default to en_US. const auto enUS = QStringLiteral("en_US"); if (family.contains(enUS)) { code = enUS; } } else if (family.contains(fcode+QLatin1Char('_')+fcode.toUpper())) { //If we have a speller of the form xx_XX, try that. //This gets us most European languages with more than one spelling. code = fcode+QLatin1Char('_')+fcode.toUpper(); } else { //Otherwise, pick the first value as it is highest priority. code = family.first(); } //Finally, add code to the map. // FIXME: We need someway to map languageCodeToName const QString name;// = locale->languageCodeToName(fcode); if (!name.isEmpty()) { m_languages[name.toLower()] = code; } } } void SpellCheckRunner::destroydata() { //Clear the data arrays to save memory m_spellers.clear(); } void SpellCheckRunner::reloadConfiguration() { const KConfigGroup cfg = config(); m_triggerWord = cfg.readEntry("trigger", i18n("spell")); //Processing will be triggered by "keyword " m_requireTriggerWord = cfg.readEntry("requireTriggerWord", true) && !m_triggerWord.isEmpty(); m_triggerWord += QLatin1Char( ' ' ); Plasma::RunnerSyntax s(i18nc("Spelling checking runner syntax, first word is trigger word, e.g. \"spell\".", "%1:q:", m_triggerWord), i18n("Checks the spelling of :q:.")); if (!m_requireTriggerWord) { s.addExampleQuery(QStringLiteral(":q:")); } setSyntaxes({s}); } /* Take the input query, split into a list, and see if it contains a language to spell in. * Return the empty string if we can't match a language. */ QString SpellCheckRunner::findLang(const QStringList& terms) { const auto &defaultSpeller = m_spellers[QString()]; //If first term is a language code (like en_GB), set it as the spell-check language if (!terms.isEmpty() && defaultSpeller->availableLanguages().contains(terms[0])) { return terms[0]; } //If we have two terms and the first is a language name (eg 'french'), //set it as the available language else if (terms.count() >=2) { QString code; { //Is this a descriptive language name? QMap::const_iterator it = m_languages.constFind(terms[0].toLower()); if (it != m_languages.constEnd()) { code = *it; } //Maybe it is a subset of a language code? else { QStringList codes = QStringList(m_languages.values()).filter(terms[0]); if (!codes.isEmpty()) { code = codes.first(); } } } if (!code.isEmpty()) { //We found a valid language! Check still available const QStringList avail = defaultSpeller->availableLanguages(); //Does the spell-checker like it? if (avail.contains(code)) { return code; } } //FIXME: Support things like 'british english' or 'canadian french' } return QString(); } void SpellCheckRunner::match(Plasma::RunnerContext &context) { if (!context.isValid()) { return; } const QString term = context.query(); QString query = term; if (m_requireTriggerWord) { int len = m_triggerWord.length(); if (query.left(len) != m_triggerWord) { return; } query = query.mid(len).trimmed(); } //Pointer to speller object with our chosen language QSharedPointer speller = m_spellers[QString()]; if (speller->isValid()) { #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QStringList terms = query.split(QLatin1Char(' '), QString::SkipEmptyParts); #else QStringList terms = query.split(QLatin1Char(' '), Qt::SkipEmptyParts); #endif const QString lang = findLang(terms); //If we found a language, create a new speller object using it. if (!lang.isEmpty()) { //First term is the language terms.removeFirst(); //New speller object if we don't already have one if (!m_spellers.contains(lang)) { QMutexLocker lock (&m_spellLock); //Check nothing happened while we were acquiring the lock if (!m_spellers.contains(lang)) { m_spellers[lang] = QSharedPointer(new Sonnet::Speller(lang)); } } speller = m_spellers[lang]; //Rejoin the strings query = terms.join(QLatin1Char(' ')); } } if (query.size() < 2) { return; } if (speller->isValid()) { QStringList suggestions; const bool correct = speller->checkAndSuggest(query,suggestions); if (correct) { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::InformationalMatch); match.setIconName(QStringLiteral("checkbox")); match.setText(query); match.setSubtext(i18nc("Term is spelled correctly", "Correct")); match.setData(query); context.addMatch(match); } else { for (const auto& suggestion : qAsConst(suggestions)) { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::InformationalMatch); match.setIconName(QStringLiteral("edit-rename")); match.setText(suggestion); match.setSubtext(i18n("Suggested term")); match.setData(suggestion); context.addMatch(match); } } } else { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::InformationalMatch); match.setIconName(QStringLiteral("task-attention")); match.setText(i18n("Could not find a dictionary.")); context.addMatch(match); } } void SpellCheckRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) { Q_UNUSED(context) QGuiApplication::clipboard()->setText(match.data().toString()); } QList SpellCheckRunner::actionsForMatch(const Plasma::QueryMatch &match) { Q_UNUSED(match) return m_actions; } QMimeData * SpellCheckRunner::mimeDataForMatch(const Plasma::QueryMatch &match) { QMimeData *result = new QMimeData(); const QString text = match.data().toString(); result->setText(text); return result; } -K_EXPORT_PLASMA_RUNNER(krunner_spellcheck, SpellCheckRunner) +K_EXPORT_PLASMA_RUNNER_WITH_JSON(SpellCheckRunner, "plasma-runner-spellchecker.json") #include "spellcheck.moc"