Commit e4f4d768 authored by Bhushan Shah's avatar Bhushan Shah

Remove the outdated and unused kcms

Reviewed and Acked by : Marco Martin
parent 86ad8f25
Pipeline #837 passed with stage
in 7 minutes and 45 seconds
# Install the packages, also make it known to the system
add_subdirectory(theme)
add_subdirectory(development)
if (${KF5KDELibs4Support_FOUND})
add_subdirectory(time)
endif()
# Web
#install(DIRECTORY web/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.web)
#install(FILES web/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.web.desktop)
# Power
add_subdirectory(powermanagement)
......
project(kcm_settings_devel)
set(developmentsettings_SRCS
develsettings.cpp
)
add_library(kcm_settings_devel MODULE ${developmentsettings_SRCS})
target_link_libraries(kcm_settings_devel
Qt5::Core
Qt5::Qml
Qt5::Quick
Qt5::DBus
KF5::Auth
KF5::Plasma
KF5::I18n
KF5::QuickAddons
)
kcoreaddons_desktop_to_json(kcm_settings_devel "develsettings.desktop")
install(TARGETS kcm_settings_devel DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/kcms)
install(FILES develsettings.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
kpackage_install_package(package kcm_settings_devel kcms)
###SSH
add_executable(active-sshd-helper sshdhelper.cpp ${helper_mocs})
target_link_libraries(active-sshd-helper
Qt5::Core
KF5::Auth
)
install(TARGETS active-sshd-helper DESTINATION ${KDE_INSTALL_LIBEXECDIR}/kauth)
kauth_install_helper_files(active-sshd-helper org.kde.active.sshdcontrol root)
kauth_install_actions(org.kde.active.sshdcontrol active_dev_sshd.actions)
[Domain]
Name=SSH Remote Access
Name[ca]=Accés remot amb SSH
Name[ca@valencia]=Accés remot amb SSH
Name[cs]=Vzdálený přístup SSH
Name[da]=SSH-fjernadgang
Name[de]=SSH-Zugriff auf Fremdrechner
Name[el]=SSH απομακρυσμένη πρόσβαση
Name[en_GB]=SSH Remote Access
Name[es]=Acceso remoto SSH
Name[fi]=SSH-etäyhteys
Name[fr]=Accès distant SSH
Name[gl]=Acceso remoto por SSH
Name[it]=Accesso remoto SSH
Name[ko]=SSH 원격 접근
Name[nl]=Externe toegang via SSH
Name[nn]=Fjerntilgang via SSH
Name[pl]=Dostęp zdalny przez SSH
Name[pt]=Acesso Remoto por SSH
Name[pt_BR]=Acesso remoto SSH
Name[sl]=Oddaljeni dostop SSH
Name[sv]=SSH-fjärråtkomst
Name[uk]=Віддалений доступ з SSH
Name[x-test]=xxSSH Remote Accessxx
Name[zh_CN]=SSH 远程访问
Name[zh_TW]=SSH 遠端存取
Icon=utilities-terminal
[org.kde.active.sshdcontrol.start]
Name=Activate sshd
Name[ca]=Activa el «sshd»
Name[ca@valencia]=Activa el «sshd»
Name[cs]=Aktivovat sshd
Name[da]=Aktivér sshd
Name[de]=sshd aktivieren
Name[el]=Ενεργοποίηση sshd
Name[en_GB]=Activate sshd
Name[es]=Activar sshd
Name[fi]=Aktivoi sshd
Name[fr]=Activer sshd
Name[gl]=Activar sshd
Name[it]=Attiva sshd
Name[ko]=sshd 활성화
Name[nl]=Sshd activeren
Name[nn]=Slå på «sshd»
Name[pl]=Włącz sshd
Name[pt]=Activar o 'sshd'
Name[pt_BR]=Ativar sshd
Name[sl]=Omogoči sshd
Name[sv]=Aktivera sshd
Name[uk]=Задіяти sshd
Name[x-test]=xxActivate sshdxx
Name[zh_CN]=激活 sshd
Name[zh_TW]=啟用 sshd
Description=Starts sshd on device
Description[ca]=Inicia el «sshd» al dispositiu
Description[ca@valencia]=Inicia el «sshd» al dispositiu
Description[cs]=Spustí na zařízení sshd
Description[da]=Starter sshd på enheden
Description[de]=sshd auf dem Gerät starten
Description[el]=Εκκινεί το sshd στη συσκευή
Description[en_GB]=Starts sshd on device
Description[es]=Iniciar sshd en el dispositivo
Description[fi]=Käynnistää sshd:n laitteella
Description[fr]=Démarre sshd sur le périphérique
Description[gl]=Inicia sshd no dispositivo
Description[it]=Avvia l'sshd del dispositivo
Description[ko]=장치에서 sshd 시작
Description[nl]=Start sshd op apparaat
Description[nn]=Startar «sshd» på eininga
Description[pl]=Rozpoczyna sshd na urządzeniu
Description[pt]=Inicia o 'sshd' no dispositivo
Description[pt_BR]=Inicia o sshd no dispositivo
Description[sl]=Zažene sshd na napravi
Description[sv]=Startar sshd på enheten
Description[uk]=Запустити sshd на пристрої
Description[x-test]=xxStarts sshd on devicexx
Description[zh_CN]=在设备上启动 sshd
Description[zh_TW]=在裝置上啟動 sshd
Policy=yes
[org.kde.active.sshdcontrol.stop]
Name=Deactivate sshd
Name[ca]=Desactiva el «sshd»
Name[ca@valencia]=Desactiva el «sshd»
Name[cs]=Deaktivovat sshd
Name[da]=Deaktivér sshd
Name[de]=sshd deaktivieren
Name[el]=Απενεργοποίηση sshd
Name[en_GB]=Deactivate sshd
Name[es]=Desactivar sshd
Name[fi]=Passivoi sshd
Name[fr]=Désactiver sshd
Name[gl]=Desactivar sshd
Name[it]=Disattiva sshd
Name[ko]=sshd 비활성화
Name[nl]=Sshd deactiveren
Name[nn]=Slå av «sshd»
Name[pl]=Wyłącz sshd
Name[pt]=Desactivar o 'sshd'
Name[pt_BR]=Desativar sshd
Name[sl]=Onemogoči sshd
Name[sv]=Inaktivera sshd
Name[uk]=Вимкнути sshd
Name[x-test]=xxDeactivate sshdxx
Name[zh_CN]=关闭 sshd
Name[zh_TW]=停用 sshd
Description=Stops sshd on device
Description[ca]=Atura el «sshd» al dispositiu
Description[ca@valencia]=Atura el «sshd» al dispositiu
Description[cs]=Zastaví na zařízení sshd
Description[da]=Stopper sshd på enheden
Description[de]=sshd auf dem Gerät anhalten
Description[el]=Διακοπή sshd στη συσκευή
Description[en_GB]=Stops sshd on device
Description[es]=Detener sshd en el dispositivo
Description[fi]=Pysäyttää sshd:n laitteella
Description[fr]=Arrête sshd sur le périphérique
Description[gl]=Detén sshd no dispositivo
Description[it]=Ferma l'sshd del dispositivo
Description[ko]=장치에서 sshd 정지
Description[nl]=Sshd op apparaat stoppen
Description[nn]=Stoppar «sshd» på eininga
Description[pl]=Zatrzymuje sshd na urządzeniu
Description[pt]=Para o 'sshd' no dispositivo
Description[pt_BR]=Para o sshd no dispositivo
Description[sl]=Zaustavi sshd na napravi
Description[sv]=Stoppar sshd på enheten
Description[uk]=Зупинити sshd на пристрої
Description[x-test]=xxStops sshd on devicexx
Description[zh_CN]=停止设备上的 sshd
Description[zh_TW]=在裝置上停用 sshd
Policy=yes
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* Copyright 2015 Sebastian Kügler <sebas@kde.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "develsettings.h"
#include <QDebug>
#include <QDBusInterface>
#include <QFile>
#include <QTimer>
#include <QtQml>
#include <KAuthAction>
#include <KAuthExecuteJob>
#include <KAboutData>
#include <KConfig>
#include <KConfigGroup>
#include <KDesktopFile>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KSharedConfig>
#include <KService>
#include <KSycoca>
K_PLUGIN_FACTORY_WITH_JSON(DevelSettingsFactory, "develsettings.json", registerPlugin<DevelSettings>();)
DevelSettings::DevelSettings(QObject* parent, const QVariantList& args)
: KQuickAddons::ConfigModule(parent, args) {
// TODO: should probably not rely on systemctl, but be put into a platform specific backend?
const int rv = QProcess::execute("systemctl is-enabled sshd.service");
m_sshEnabled = rv == 0;
KAboutData* about = new KAboutData("kcm_settings_devel", i18n("Developer Settings"),
"1.0", QString(), KAboutLicense::LGPL);
about->addAuthor(i18n("Sebastian Kügler"), QString(), "sebas@kde.org");
setAboutData(about);
setButtons(Apply | Default);
}
DevelSettings::~DevelSettings()
{
}
bool DevelSettings::sshEnabled() const
{
return m_sshEnabled;
}
void DevelSettings::enableSsh(bool enable)
{
if (m_sshEnabled != enable) {
const bool was = m_sshEnabled;
m_sshEnabled = enable;
//TODO: this really should be non-blocking ...
KAuth::Action action(m_sshEnabled ? "org.kde.active.sshdcontrol.start"
: "org.kde.active.sshdcontrol.stop");
action.setHelperId("org.kde.active.sshdcontrol");
qDebug() << "Action" << action.name() << action.details() << "valid:" << action.isValid();
auto reply = action.execute();
reply->exec();
if (reply->error()) {
m_sshEnabled = !m_sshEnabled;
qWarning()<< "KAuth returned an error code:" << reply->errorString() << m_sshEnabled;
}
if (was != m_sshEnabled) {
emit enableSshChanged(m_sshEnabled);
}
}
}
#include "develsettings.moc"
[Desktop Entry]
Name=Development
Name[ca]=Desenvolupament
Name[ca@valencia]=Desenvolupament
Name[cs]=Vývoj
Name[da]=Udvikling
Name[de]=Entwicklung
Name[el]=Ανάπτυξη
Name[en_GB]=Development
Name[es]=Desarrollo
Name[fi]=Kehitys
Name[fr]=Développement
Name[gl]=Desenvolvemento
Name[it]=Sviluppo
Name[ko]=개발
Name[nl]=Ontwikkeling
Name[nn]=Utvikling
Name[pl]=Rozwój
Name[pt]=Desenvolvimento
Name[pt_BR]=Desenvolvimento
Name[sk]=Vývoj
Name[sl]=Razvoj
Name[sv]=Utveckling
Name[uk]=Розробка
Name[x-test]=xxDevelopmentxx
Name[zh_CN]=开发
Name[zh_TW]=開發
Comment=Settings for developers
Comment[ca]=Ajustaments per a desenvolupadors
Comment[ca@valencia]=Ajustaments per a desenvolupadors
Comment[cs]=Nastavení pro vývojáře
Comment[da]=Indstillinger for udviklere
Comment[de]=Einstellungen für Entwickler
Comment[el]=Ρυθμίσεις για προγραμματιστές
Comment[en_GB]=Settings for developers
Comment[es]=Preferencias para desarrolladores
Comment[fi]=Kehittäjäasetukset
Comment[fr]=Paramètres pour les développeurs
Comment[gl]=Configuración para desenvolvedores
Comment[it]=Impostazioni per gli sviluppatori
Comment[ko]=개발자 설정
Comment[nl]=Instellingen voor ontwikkelaars
Comment[nn]=Innstillingar for utviklarar
Comment[pl]=Ustawienia dla programistów
Comment[pt]=Definições para programadores
Comment[pt_BR]=Configurações para desenvolvedores
Comment[sl]=Nastavitve za razvijalce
Comment[sv]=Inställningar för utvecklare
Comment[uk]=Параметри для розробників
Comment[x-test]=xxSettings for developersxx
Comment[zh_CN]=开发者设置
Comment[zh_TW]=開發者設定
Icon=applications-development
Encoding=UTF-8
Exec=plasma-settings -m kcm_settings_devel
Type=Service
X-KDE-Library=kcm_settings_devel
X-KDE-ParentApp=kcontrol
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_settings_devel
X-KDE-PluginInfo-Author=Aaron Seigo
X-KDE-PluginInfo-Email=aseigo@kde.org
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=https://plasma-mobile.org
X-KDE-PluginInfo-Category=Development
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-FormFactors=handset,tablet,mediacenter
Categories=Qt;KDE;X-KDE-settings-system;
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* Copyright 2015 Sebastian Kügler <sebas@kde.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DEVELSETTINGS_H
#define DEVELSETTINGS_H
#include <QObject>
#include <QProcess>
#include <QVariantList>
#include <KQuickAddons/ConfigModule>
class DevelSettings : public KQuickAddons::ConfigModule
{
Q_OBJECT
Q_PROPERTY(bool sshEnabled READ sshEnabled WRITE enableSsh NOTIFY enableSshChanged)
public:
DevelSettings(QObject* parent, const QVariantList& args);
~DevelSettings() override;
bool sshEnabled() const;
void enableSsh(bool enable);
Q_SIGNALS:
void enableSshChanged(bool enabled);
void showTerminalChanged(bool shown);
private:
bool m_sshEnabled;
bool m_terminalShown;
bool m_cursorVisible;
QString m_terminalApp;
QProcess m_getpropProcess;
};
#endif
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* Copyright 2011 Sebastian Kügler <sebas@kde.org>
*
* 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 Library 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.
*/
import QtQuick 2.7
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.0 as Controls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kcm 1.2
SimpleKCM {
id: develModule
objectName: "develModule"
ColumnLayout {
id: formLayout
Controls.SwitchDelegate {
id: ssh
text: i18n("Allow remote SSH access:")
checked: kcm.sshEnabled
Layout.fillWidth: true
onClicked: {
kcm.sshEnabled = checked;
// we have to check to se if it failed
checked = kcm.sshEnabled;
}
}
}
}
[Desktop Entry]
Name=Development
Name[ca]=Desenvolupament
Name[ca@valencia]=Desenvolupament
Name[cs]=Vývoj
Name[da]=Udvikling
Name[de]=Entwicklung
Name[el]=Ανάπτυξη
Name[en_GB]=Development
Name[es]=Desarrollo
Name[fi]=Kehitys
Name[fr]=Développement
Name[gl]=Desenvolvemento
Name[it]=Sviluppo
Name[ko]=개발
Name[nl]=Ontwikkeling
Name[nn]=Utvikling
Name[pl]=Rozwój
Name[pt]=Desenvolvimento
Name[pt_BR]=Desenvolvimento
Name[sk]=Vývoj
Name[sl]=Razvoj
Name[sv]=Utveckling
Name[uk]=Розробка
Name[x-test]=xxDevelopmentxx
Name[zh_CN]=开发
Name[zh_TW]=開發
Comment=Settings for developers
Comment[ca]=Ajustaments per a desenvolupadors
Comment[ca@valencia]=Ajustaments per a desenvolupadors
Comment[cs]=Nastavení pro vývojáře
Comment[da]=Indstillinger for udviklere
Comment[de]=Einstellungen für Entwickler
Comment[el]=Ρυθμίσεις για προγραμματιστές
Comment[en_GB]=Settings for developers
Comment[es]=Preferencias para desarrolladores
Comment[fi]=Kehittäjäasetukset
Comment[fr]=Paramètres pour les développeurs
Comment[gl]=Configuración para desenvolvedores
Comment[it]=Impostazioni per gli sviluppatori
Comment[ko]=개발자 설정
Comment[nl]=Instellingen voor ontwikkelaars
Comment[nn]=Innstillingar for utviklarar
Comment[pl]=Ustawienia dla programistów
Comment[pt]=Definições para programadores
Comment[pt_BR]=Configurações para desenvolvedores
Comment[sl]=Nastavitve za razvijalce
Comment[sv]=Inställningar för utvecklare
Comment[uk]=Параметри для розробників
Comment[x-test]=xxSettings for developersxx
Comment[zh_CN]=开发者设置
Comment[zh_TW]=開發者設定
Encoding=UTF-8
Type=Service
Icon=applications-development
X-KDE-ServiceTypes=Active/SettingsModule
X-KDE-Library=active_settings_devel
X-KDE-PluginInfo-Author=Aaron Seigo
X-KDE-PluginInfo-Email=aseigo@kde.org
X-KDE-PluginInfo-Name=kcm_settings_devel
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=https://plasma-mobile.org
X-KDE-PluginInfo-Category=Development
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-Package=kcm_settings_devel
X-KDE-FormFactors=handset,tablet,mediacenter
X-Plasma-MainScript=ui/devel.qml
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "sshdhelper.h"
#include <QProcess>
#include <QFile>
#include <QDebug>
static const QLatin1String startCommand("systemctl start sshd.service");
static const QLatin1String startAtBootCommand("systemctl enable sshd.service");
static const QLatin1String stopCommand("systemctl stop sshd.service");
static const QLatin1String stopAtBootCommand("systemctl disable sshd.service");
SshdHelper::SshdHelper(QObject *parent)
: QObject(parent)
{
}
ActionReply SshdHelper::start(const QVariantMap &args)
{
Q_UNUSED(args)
int rv = QProcess::execute(startCommand);
if (rv == 0) {
rv = QProcess::execute(startAtBootCommand);
}
if (rv == 0) {
return ActionReply::SuccessReply();
} else {
return ActionReply::HelperErrorReply();
}
}
ActionReply SshdHelper::stop(const QVariantMap &args)
{
Q_UNUSED(args)
int rv = QProcess::execute(stopCommand);
if (rv == 0) {
rv = QProcess::execute(stopAtBootCommand);
}
if (rv == 0) {
return ActionReply::SuccessReply();
} else {
return ActionReply::HelperErrorReply();
}
}
KAUTH_HELPER_MAIN("org.kde.active.sshdcontrol", SshdHelper)
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SSHD_HELPER_H
#define SSHD_HELPER_H
#include <kauth.h>
using namespace KAuth;
class SshdHelper : public QObject
{
Q_OBJECT
public:
SshdHelper(QObject *parent = nullptr);
public slots:
ActionReply start(const QVariantMap &map);
ActionReply stop(const QVariantMap &map);
};
#endif // SSHD_HELPER_H
project( active_settings_locale )
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(${KDE4_INCLUDES} ../../../../components/settings)
set(localesettings_SRCS
localesettingsplugin.cpp
localesettings.cpp
languagesmodel.cpp
)
kde4_add_plugin(active_settings_locale ${localesettings_SRCS})
target_link_libraries(active_settings_locale ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY})
install(TARGETS active_settings_locale DESTINATION ${PLUGIN_INSTALL_DIR})
# Locale
install(DIRECTORY package/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.locale)
install(FILES package/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.locale.desktop)
/* Copyright (C) 2012 basysKom GmbH <info@basyskom.com>
*
* 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) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "languagesmodel.h"
LanguagesModel::LanguagesModel(QObject *parent)
: QStandardItemModel(parent)
{
QHash<int, QByteArray> roleNames;
roleNames[Qt::DisplayRole] = "display";
roleNames[Qt::UserRole+1] = "langCode";
setRoleNames(roleNames);
connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged()));
}
QVariantHash LanguagesModel::get(int i) const
{
QModelIndex idx = index(i, 0);
QVariantHash hash;
hash["display"] = data(idx, Qt::DisplayRole);
hash["langCode"] = data(idx, Qt::UserRole+1);
return hash;
}
#include "languagesmodel.moc"
/* Copyright (C) 2012 basysKom GmbH <info@basyskom.com>
*
* 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) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LANGUAGESMODEL_H
#define LANGUAGESMODEL_H
#include <QStandardItemModel>
class LanguagesModel: public QStandardItemModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
LanguagesModel(QObject *parent=0);
Q_INVOKABLE QVariantHash get(int i) const;
int count() const {return rowCount();}
Q_SIGNALS:
void countChanged();
};
#endif
/* Copyright (C) 2012 basysKom GmbH <info@basyskom.com>