Commit cd25c707 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

[konsolesession runner] Rename to konsoleprofiles, no sessions here

Summary:
Possibly because the runner was based on the kate session runner, it used
the term "session" across the place. Though actually it is supporting Konsole
profiles.

Reviewers: broulik, mart

Reviewed By: mart

Subscribers: ltoscano, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10505
parent 6561ed4a
......@@ -7,5 +7,5 @@ add_subdirectory(characters)
add_subdirectory(dictionary)
if(NOT WIN32)
add_subdirectory(konsolesessions)
add_subdirectory(konsoleprofiles)
endif(NOT WIN32)
add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_konsoleprofiles")
set(krunner_konsoleprofiles_SRCS
konsoleprofiles.cpp
)
add_library(krunner_konsoleprofiles MODULE ${krunner_konsoleprofiles_SRCS})
target_link_libraries(krunner_konsoleprofiles
KF5::Runner
KF5::I18n
)
install(TARGETS krunner_konsoleprofiles DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES plasma-runner-konsoleprofiles.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/plasma_runner_konsoleprofiles.pot
......@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "konsolesessions.h"
#include "konsoleprofiles.h"
// KF
#include <KDirWatch>
......@@ -31,54 +31,54 @@
#include <QStandardPaths>
KonsoleSessions::KonsoleSessions(QObject *parent, const QVariantList& args)
KonsoleProfiles::KonsoleProfiles(QObject *parent, const QVariantList& args)
: Plasma::AbstractRunner(parent, args)
{
setObjectName(QStringLiteral("Konsole Sessions"));
setObjectName(QStringLiteral("Konsole Profiles"));
setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | Plasma::RunnerContext::NetworkLocation);
Plasma::RunnerSyntax s(QStringLiteral( ":q:" ), i18n("Finds Konsole sessions matching :q:."));
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 sessions in your account.")));
setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral( "konsole" ), i18n("Lists all the Konsole profiles in your account.")));
connect(this, &Plasma::AbstractRunner::prepare, this, &KonsoleSessions::slotPrepare);
connect(this, &Plasma::AbstractRunner::teardown, this, &KonsoleSessions::slotTeardown);
connect(this, &Plasma::AbstractRunner::prepare, this, &KonsoleProfiles::slotPrepare);
connect(this, &Plasma::AbstractRunner::teardown, this, &KonsoleProfiles::slotTeardown);
}
KonsoleSessions::~KonsoleSessions()
KonsoleProfiles::~KonsoleProfiles()
{
}
void KonsoleSessions::slotPrepare()
void KonsoleProfiles::slotPrepare()
{
loadSessions();
loadProfiles();
if (!m_sessionWatch) {
m_sessionWatch = new KDirWatch(this);
if (!m_profileFilesWatch) {
m_profileFilesWatch = new KDirWatch(this);
const QStringList konsoleDataBaseDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString& konsoleDataBaseDir : konsoleDataBaseDirs) {
m_sessionWatch->addDir(konsoleDataBaseDir + QLatin1String("/konsole"));
m_profileFilesWatch->addDir(konsoleDataBaseDir + QLatin1String("/konsole"));
}
connect(m_sessionWatch, &KDirWatch::dirty, this, &KonsoleSessions::loadSessions);
connect(m_sessionWatch, &KDirWatch::created, this, &KonsoleSessions::loadSessions);
connect(m_sessionWatch, &KDirWatch::deleted, this, &KonsoleSessions::loadSessions);
connect(m_profileFilesWatch, &KDirWatch::dirty, this, &KonsoleProfiles::loadProfiles);
connect(m_profileFilesWatch, &KDirWatch::created, this, &KonsoleProfiles::loadProfiles);
connect(m_profileFilesWatch, &KDirWatch::deleted, this, &KonsoleProfiles::loadProfiles);
}
}
void KonsoleSessions::slotTeardown()
void KonsoleProfiles::slotTeardown()
{
delete m_sessionWatch;
m_sessionWatch = nullptr;
m_sessions.clear();
delete m_profileFilesWatch;
m_profileFilesWatch = nullptr;
m_profiles.clear();
}
void KonsoleSessions::loadSessions()
void KonsoleProfiles::loadProfiles()
{
m_sessions.clear();
m_profiles.clear();
QStringList profilesPaths;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory);
......@@ -102,14 +102,14 @@ void KonsoleSessions::loadSessions()
profileData.displayName = cfg.readEntry("Name", profileName);
profileData.iconName = cfg.readEntry("Icon", QStringLiteral("utilities-terminal"));
m_sessions.insert(profileName, profileData);
m_profiles.insert(profileName, profileData);
}
}
}
void KonsoleSessions::match(Plasma::RunnerContext &context)
void KonsoleProfiles::match(Plasma::RunnerContext &context)
{
if (m_sessions.isEmpty()) {
if (m_profiles.isEmpty()) {
return;
}
......@@ -119,7 +119,7 @@ void KonsoleSessions::match(Plasma::RunnerContext &context)
}
if (term.compare(QLatin1String( "konsole" ), Qt::CaseInsensitive) == 0) {
QHashIterator<QString, KonsoleProfileData> i(m_sessions);
QHashIterator<QString, KonsoleProfileData> i(m_profiles);
while (i.hasNext()) {
i.next();
const auto& profileData = i.value();
......@@ -136,7 +136,7 @@ void KonsoleSessions::match(Plasma::RunnerContext &context)
if (term.startsWith(QLatin1String("konsole "), Qt::CaseInsensitive)) {
term.remove(0, 8);
}
QHashIterator<QString, KonsoleProfileData> i(m_sessions);
QHashIterator<QString, KonsoleProfileData> i(m_profiles);
while (i.hasNext()) {
if (!context.isValid()) {
return;
......@@ -164,23 +164,23 @@ void KonsoleSessions::match(Plasma::RunnerContext &context)
}
}
void KonsoleSessions::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
void KonsoleProfiles::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
const QString session = match.data().toString();
const QString profile = match.data().toString();
if (!session.isEmpty()) {
if (!profile.isEmpty()) {
return;
}
const QStringList args {
QStringLiteral("--profile"),
session
profile
};
KToolInvocation::kdeinitExec(QStringLiteral("konsole"), args);
}
K_EXPORT_PLASMA_RUNNER(konsolesessions, KonsoleSessions)
K_EXPORT_PLASMA_RUNNER(konsoleprofiles, KonsoleProfiles)
#include "konsolesessions.moc"
#include "konsoleprofiles.moc"
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KONSOLESESSIONS_H
#define KONSOLESESSIONS_H
#ifndef KONSOLEPROFILES_H
#define KONSOLEPROFILES_H
#include <KRunner/AbstractRunner>
......@@ -33,25 +33,25 @@ struct KonsoleProfileData
Q_DECLARE_TYPEINFO(KonsoleProfileData, Q_MOVABLE_TYPE);
class KonsoleSessions : public Plasma::AbstractRunner {
class KonsoleProfiles : public Plasma::AbstractRunner {
Q_OBJECT
public:
KonsoleSessions( QObject *parent, const QVariantList& args );
~KonsoleSessions() override;
KonsoleProfiles( QObject *parent, const QVariantList& args );
~KonsoleProfiles() override;
void match(Plasma::RunnerContext &context) override;
void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override;
private Q_SLOTS:
void loadSessions();
void loadProfiles();
void slotPrepare();
void slotTeardown();
private:
KDirWatch* m_sessionWatch = nullptr;
KDirWatch* m_profileFilesWatch = nullptr;
QHash<QString, KonsoleProfileData> m_sessions;
QHash<QString, KonsoleProfileData> m_profiles;
};
#endif
[Desktop Entry]
Name=Konsole Profiles
Comment=Matches Konsole Profiles
Icon=utilities-terminal
X-KDE-ServiceTypes=Plasma/Runner
Type=Service
X-KDE-Library=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
add_definitions(-DTRANSLATION_DOMAIN="plasma_runner_konsolesessions")
set(krunner_konsolesessions_SRCS
konsolesessions.cpp
)
add_library(krunner_konsolesessions MODULE ${krunner_konsolesessions_SRCS})
target_link_libraries(krunner_konsolesessions
KF5::Runner
KF5::I18n
)
install(TARGETS krunner_konsolesessions DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES konsolesessions.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/plasma_runner_konsolesessions.pot
[Desktop Entry]
Name=Konsole Sessions
Name[ar]=جلسات كونسول
Name[bs]=Konzolne sesije
Name[ca]=Sessions del Konsole
Name[ca@valencia]=Sessions del Konsole
Name[cs]=Sezení Konsole
Name[da]=Konsole-sessioner
Name[de]=Konsole-Sitzungen
Name[el]=Συνεδρίες Konsole
Name[en_GB]=Konsole Sessions
Name[es]=Sesiones de Konsole
Name[et]=Konsooli seansid
Name[eu]=Kontsola saioak
Name[fi]=Konsole-istunnot
Name[fr]=Sessions Konsole
Name[ga]=Seisiúin Konsole
Name[gl]=Sesións de Konsole
Name[he]=הפעלות Konsole
Name[hr]=Sesije u Konsoleu
Name[hu]=Konsole munkamenetek
Name[is]=Konsole setur
Name[it]=Sessioni di Konsole
Name[ja]=Konsole セッション
Name[kk]=Konsole сеанстары
Name[km]=សម័យ​របស់​កុងសូល
Name[ko]=Konsole 세션
Name[ku]=Danişînên Konsolê
Name[lt]=Konsole sesijos
Name[lv]=Konsole sesijas
Name[mr]=कंसोल सत्र
Name[nb]=Konsole-økter
Name[nds]=Konsole-Törns
Name[nl]=Konsolesessies
Name[nn]=Konsoll-øktveljar
Name[pa]=ਕਨਸੋਲ ਸ਼ੈਸ਼ਨ
Name[pl]=Sesje konsoli
Name[pt]=Sessões do Konsole
Name[pt_BR]=Sessões do Konsole
Name[ro]=Sesiuni Konsolă
Name[ru]=Konsole: сеансы
Name[sk]=Sedenia Konsole
Name[sl]=Seje Konsole
Name[sr]=Конзолине сесије
Name[sr@ijekavian]=Конзолине сесије
Name[sr@ijekavianlatin]=Konsoline sesije
Name[sr@latin]=Konsoline sesije
Name[sv]=Terminalsessioner
Name[th]=วาระการใช้งานของคอนโซล-K
Name[tr]=Konsole Oturumları
Name[uk]=Сеанси Konsole
Name[wa]=Sessions di Konsole
Name[x-test]=xxKonsole Sessionsxx
Name[zh_CN]=Konsole 会话
Name[zh_TW]=Konsole 工作階段
Comment=Matches Konsole Sessions
Comment[ar]=تطابق جلسات كونسول
Comment[bs]=Odgovarajuće konzolne sesije
Comment[ca]=Correspon amb sessions del Konsole
Comment[ca@valencia]=Correspon amb sessions del Konsole
Comment[cs]=Vyhledávání v sezeních Konsole
Comment[da]=Matcher Konsole-sessioner.
Comment[de]=Findet Konsole-Sitzungen
Comment[el]=Αντιστοίχηση συνεδριών Konsole
Comment[en_GB]=Matches Konsole Sessions
Comment[es]=Busca sesiones de Konsole que coincidan
Comment[et]=Konsooli seansid
Comment[eu]=Bat datozen kontsola saioak
Comment[fi]=Täsmää Konsole-istuntoihin
Comment[fr]=Retrouve des sessions Konsole
Comment[ga]=Comhoiriúnach do Sheisiúin Konsole
Comment[gl]=Equivale ás sesión de Konsole
Comment[he]=מתאים הפעלות Konsole
Comment[hr]=Odgovara sesijama u Konsoleu
Comment[hu]=Konsole munkamenetek listázása
Comment[is]=Samsvarar Konsole setum
Comment[it]=Abbina sessioni di Konsole
Comment[ja]=Konsole のセッションを探します
Comment[kk]=Konsole сеанстарын салыстыру
Comment[km]=ផ្គូផ្គង​សម័យ​របស់កុង​សូល
Comment[ko]=Konsole 세션과 일치
Comment[ku]=Danişînên Konsolê yên Hevgirtî
Comment[lt]=Atitinka Konsole sesijas
Comment[lv]=Meklē Konsole sesijas
Comment[mr]=कंसोल सत्र जुळवितो
Comment[nb]=Treffer Konsole-økter
Comment[nds]=Kiekt na passen Konsole-Törns
Comment[nl]=Zoekt Konsolesessies
Comment[nn]=Start Konsoll-økter
Comment[pa]=ਰਲਦੇ ਕੋਨਸੋਲ ਸ਼ੈਸ਼ਨ
Comment[pl]=Wyszukuje sesji Konsoli
Comment[pt]=Corresponder às Sessões do Konsole
Comment[pt_BR]=Corresponder às sessões do Konsole
Comment[ro]=Potrivește sesiunile consolei
Comment[ru]=Открытие сеансов Konsole
Comment[sk]=Vyhľadávanie v sedeniach Konsole
Comment[sl]=Prikazuje ujemanja s sejami programa Konsole
Comment[sr]=Поклапа Конзолине сесије
Comment[sr@ijekavian]=Поклапа Конзолине сесије
Comment[sr@ijekavianlatin]=Poklapa Konsoline sesije
Comment[sr@latin]=Poklapa Konsoline sesije
Comment[sv]=Matchar terminalsessioner
Comment[th]=จับคู่ให้ตรงกับวาระการใช้งานของคอนโซล-K
Comment[tr]=Konsole Oturumlarını Eşleştirir
Comment[uk]=Порівнює сеанси Konsole
Comment[wa]=Fwait coresponde les sessions d' Konsole
Comment[x-test]=xxMatches Konsole Sessionsxx
Comment[zh_CN]=匹配 Konsole 会话
Comment[zh_TW]=比對 Konsole 工作階段
Icon=utilities-terminal
X-KDE-ServiceTypes=Plasma/Runner
Type=Service
X-KDE-Library=krunner_konsolesessions
X-KDE-PluginInfo-Author=Laurent Montel
X-KDE-PluginInfo-Email=montel@kde.org
X-KDE-PluginInfo-Name=konsolesessions
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-License=LGPL
X-KDE-PluginInfo-EnabledByDefault=true
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment