diff --git a/examples/runner/CMakeLists.txt b/examples/runner/CMakeLists.txt deleted file mode 100644 --- a/examples/runner/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Project Needs a name, of course -project(RunnerExample) - -# We add our source code here -set(example_SRCS homefilesrunner.cpp) - -# Now make sure all files get to the right place -add_library(plasma_runner_example_homefiles MODULE ${example_SRCS}) -target_link_libraries(plasma_runner_example_homefiles KF5::Runner KF5::KIOCore KF5::KIOWidgets) - -# Install the library and .desktop file -install(TARGETS plasma_runner_example_homefiles DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-runner-example-homefiles.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/examples/runner/Messages.sh b/examples/runner/Messages.sh deleted file mode 100755 --- a/examples/runner/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT *.cpp -o $podir/plasma_runner_example_homefiles.pot diff --git a/examples/runner/homefilesrunner.h b/examples/runner/homefilesrunner.h deleted file mode 100644 --- a/examples/runner/homefilesrunner.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2009 Aaron Seigo - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef HOMEFILES_H -#define HOMEFILES_H - -#include - -#include - -#include - -class HomeFilesRunner : public Plasma::AbstractRunner -{ - Q_OBJECT - -public: - HomeFilesRunner(QObject *parent, const QVariantList &args); - - void match(Plasma::RunnerContext &context); - void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match); - void createRunOptions(QWidget *widget); - void reloadConfiguration(); - -protected Q_SLOTS: - void init(); - void prepareForMatchSession(); - void matchSessionFinished(); - -private: - QHash m_iconCache; - QString m_path; - QString m_triggerWord; -}; - -#endif - diff --git a/examples/runner/homefilesrunner.cpp b/examples/runner/homefilesrunner.cpp deleted file mode 100644 --- a/examples/runner/homefilesrunner.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright 2009 Aaron Seigo - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "homefilesrunner.h" - -#include -#include -#include -#include - -#include -#include -#include - -HomeFilesRunner::HomeFilesRunner(QObject *parent, const QVariantList &args) - : AbstractRunner(parent, args) -{ - setIgnoredTypes(Plasma::RunnerContext::NetworkLocation | - Plasma::RunnerContext::Executable | - Plasma::RunnerContext::ShellCommand); - setSpeed(SlowSpeed); - setPriority(LowPriority); - setHasRunOptions(true); -} - -void HomeFilesRunner::init() -{ - reloadConfiguration(); - connect(this, SIGNAL(prepare()), this, SLOT(prepareForMatchSession())); - connect(this, SIGNAL(teardown()), this, SLOT(matchSessionFinished())); -} - -void HomeFilesRunner::reloadConfiguration() -{ - KConfigGroup c = config(); - m_triggerWord = c.readEntry("trigger", QString()); - if (!m_triggerWord.isEmpty()) { - m_triggerWord.append(' '); - } - - m_path = c.readPathEntry("path", QDir::homePath()); - QFileInfo pathInfo(m_path); - if (!pathInfo.isDir()) { - m_path = QDir::homePath(); - } - - QList syntaxes; - Plasma::RunnerSyntax syntax(QString("%1:q:").arg(m_triggerWord), - i18n("Finds files matching :q: in the %1 folder", m_path)); - syntaxes.append(syntax); - setSyntaxes(syntaxes); -} - -void HomeFilesRunner::prepareForMatchSession() -{ - -} - -void HomeFilesRunner::match(Plasma::RunnerContext &context) -{ - QString query = context.query(); - if (query == QChar('.') || query == "..") { - return; - } - - if (!m_triggerWord.isEmpty()) { - if (!query.startsWith(m_triggerWord)) { - return; - } - - query.remove(0, m_triggerWord.length()); - } - - if (query.length() > 2) { - query.prepend('*').append('*'); - } - - QDir dir(m_path); - QList matches; - - foreach (const QString &file, dir.entryList(QStringList(query))) { - const QString path = dir.absoluteFilePath(file); - if (!path.startsWith(m_path)) { - // this file isn't in our directory; looks like we got a query with some - // ..'s in it! - continue; - } - - if (!context.isValid()) { - return; - } - - Plasma::QueryMatch match(this); - match.setText(i18n("Open %1", path)); - match.setData(path); - match.setId(path); - if (m_iconCache.contains(path)) { - match.setIcon(m_iconCache.value(path)); - } else { - KIcon icon(KMimeType::iconNameForUrl(path)); - m_iconCache.insert(path, icon); - match.setIcon(icon); - } - - if (file.compare(query, Qt::CaseInsensitive)) { - match.setRelevance(1.0); - match.setType(Plasma::QueryMatch::ExactMatch); - } else { - match.setRelevance(0.8); - } - - matches.append(match); - } - - context.addMatches(context.query(), matches); -} - -void HomeFilesRunner::matchSessionFinished() -{ - m_iconCache.clear(); -} - -void HomeFilesRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) -{ - Q_UNUSED(context) - // KRun autodeletes itself, so we can just create it and forget it! - KRun *opener = new KRun(match.data().toString(), 0); - opener->setRunExecutables(false); -} - -void HomeFilesRunner::createRunOptions(QWidget *widget) -{ - QVBoxLayout *layout = new QVBoxLayout(widget); - QCheckBox *cb = new QCheckBox(widget); - cb->setText(i18n("This is just for show")); - layout->addWidget(cb); -} - -K_EXPORT_PLASMA_RUNNER(example-homefiles, HomeFilesRunner) - diff --git a/examples/runner/plasma-runner-example-homefiles.desktop b/examples/runner/plasma-runner-example-homefiles.desktop deleted file mode 100644 --- a/examples/runner/plasma-runner-example-homefiles.desktop +++ /dev/null @@ -1,104 +0,0 @@ -[Desktop Entry] -Name=Home Files -Name[ar]=ملفّات المنزل -Name[ast]=Ficheros d'aniciu -Name[bs]=Lične datoteke -Name[ca]=Fitxers personals -Name[ca@valencia]=Fitxers personals -Name[cs]=Soubory domovské složky -Name[da]=Filer i hjem -Name[de]=Persönliche Dateien -Name[el]=Προσωπικά αρχεία -Name[en_GB]=Home Files -Name[es]=Archivos personales -Name[et]=Kodu failid -Name[eu]=Etxeko fitxategiak -Name[fi]=Kodin tiedostot -Name[fr]=Fichiers personnels -Name[gd]=Faidhlichean dachaigh -Name[gl]=Ficheiros persoais -Name[hu]=Saját fájlok -Name[ia]=Files de domo -Name[it]=File della home -Name[ko]=홈 파일 -Name[lt]=Namų failai -Name[nb]=Hjemmefiler -Name[nds]=Tohuus-Dateien -Name[nl]=Persoonlijke bestanden -Name[nn]=Heimefiler -Name[pa]=ਘਰ ਫਾਈਲਾਂ -Name[pl]=Pliki domowe -Name[pt]=Ficheiros Pessoais -Name[pt_BR]=Arquivos pessoais -Name[ro]=Fișiere de acasă -Name[ru]=Файлы в домашней папке -Name[sk]=Domáce súbory -Name[sl]=Domače datoteke -Name[sr]=Домаћи фајлови -Name[sr@ijekavian]=Домаћи фајлови -Name[sr@ijekavianlatin]=Domaći fajlovi -Name[sr@latin]=Domaći fajlovi -Name[sv]=Hemfiler -Name[tr]=Ev Dosyaları -Name[uk]=Файли у домашній теці -Name[x-test]=xxHome Filesxx -Name[zh_CN]=主文件 -Name[zh_TW]=家目錄檔案 -Comment=Part of a tutorial demonstrating how to create Runner plugins -Comment[ar]=جزء من درس تعليميّ لإنشاء ملحقات لتطبيق «المشغّل» -Comment[ast]=Perte d'un tutorial pa demostrar cómo crear complementos de Runner -Comment[bs]=Dio tutorijala demonstrira kako se kreiraju Runner priključci -Comment[ca]=Part d'un programa d'aprenentatge que mostra com crear connectors Runner -Comment[ca@valencia]=Part d'un programa d'aprenentatge que mostra com crear connectors Runner -Comment[cs]=Část ukázky demonstrující vytváření modulů pro Runner -Comment[da]=Del af vejledning til demonstration af hvordan man laver Runner-plugins -Comment[de]=Teil einer Anleitung zur Demonstration, wie Runner-Module erstellt werden -Comment[el]=Τμήμα ενός οδηγού εκμάθησης που παρουσιάζει τη δημιουργία προσθέτων εκτελεστή -Comment[en_GB]=Part of a tutorial demonstrating how to create Runner plugins -Comment[es]=Parte de un tutorial que demuestra cómo crear complementos de Runner -Comment[et]=Õppematerjal käivitamispluginate loomise kohta -Comment[eu]=Runner pluginak nola sortu erakusten duen tutorial baten zatia -Comment[fi]=Osa tutoriaalia, joka näyttää, miten suoritusohjelmaliitännäisiä tehdään -Comment[fr]=Éléments d'un tutoriel montrant comment créer des modules « Runner » -Comment[gd]=Seo pàirt dhe dh'oideachadh gus sealltainn dhut mar a chruthaicheas tu plugan Runner -Comment[gl]=Parte dun tutorial que demostra como crear complementos de Runner -Comment[hu]=Egy ismertető része, amely bemutatja, hogyan hozzunk létre Runner bővítményeket -Comment[ia]=Parte de un tutorial demonstrante como crear Plugin de Runner -Comment[it]=Partedi una guida che dimostra come creare estensioni di KRunner -Comment[ko]=실행기 플러그인을 만드는 튜토리얼의 일부 -Comment[lt]=Dalis mokymo programos demonstruojanti kaip kurti Runner papildinius -Comment[nb]=Del av en veiledning som viser hvordan Runner-moduler kan lages -Comment[nds]=Deel vun en Lehrprogramm dat wiest, wodennig een KRunner-Modulen schrifft. -Comment[nl]=Deel van een inleiding die demonstreert hoe Runner-plug-ins te maken -Comment[nn]=Del av ei rettleiing som viser korleis ein lagar Runner-tillegg -Comment[pl]=Część samouczka wyjaśniająca sposób tworzenia wtyczek Runnera -Comment[pt]=Parte de um tutorial que demonstra como criar 'plugins' do Runner -Comment[pt_BR]=Parte de um tutorial que demonstra como criar plugins do Runner -Comment[ro]=Parte dintr-un îndrumar care demonstrează cum să creați extensii pentru Lansator -Comment[ru]=Часть руководства по созданию расширений для KRunner -Comment[sk]=Časť kurzu demonštrujúceho ako vytvoriť pluginy Runnera -Comment[sl]=Del vodnika za ustvarjanje vstavkov za Zaganjalnik -Comment[sr]=Део туторијала који објашњава како правити прикључке К‑извођача -Comment[sr@ijekavian]=Део туторијала који објашњава како правити прикључке К‑извођача -Comment[sr@ijekavianlatin]=Deo tutorijala koji objašnjava kako praviti priključke K‑izvođača -Comment[sr@latin]=Deo tutorijala koji objašnjava kako praviti priključke K‑izvođača -Comment[sv]=Del av en handledning som demonstrerar hur insticksprogram till Kör program skapas -Comment[tr]=Runner eklentileri oluşturma adımlarını gösteren bir öğretici parçası -Comment[uk]=Частина підручника, який демонструє створення додатків до засобу запуску -Comment[x-test]=xxPart of a tutorial demonstrating how to create Runner pluginsxx -Comment[zh_CN]=演示如何创建 Runner 插件的教程的一部分 -Comment[zh_TW]=如何建立 Runner 外掛程式的教學示範 -Icon=user-home -Type=Service -X-KDE-ServiceTypes=Plasma/Runner - -X-KDE-Library=plasma_runner_example_homefiles -X-KDE-PluginInfo-Author=Aaron Seigo -X-KDE-PluginInfo-Email=aseigo@kde.org -X-KDE-PluginInfo-Name=example-homefiles -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://plasma.kde.org/ -X-KDE-PluginInfo-Category=Examples -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true