Commit 0f779598 authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Run clang-format

If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
parent 7841f0c6
......@@ -46,7 +46,7 @@ static QSharedPointer<KConfig> openConfig(const QString &filePath)
QDir().mkpath(dir.path());
}
QFile file(filePath);
if(!file.exists()) {
if (!file.exists()) {
// If we are creating the config file, ensure it is world-readable: if
// we don't do that, KConfig will create a file which is only readable
// by root
......@@ -71,7 +71,7 @@ void SddmAuthHelper::copyFile(const QString &source, const QString &destination)
}
QFile::copy(source, destination);
const char* destinationConverted = destination.toLocal8Bit().data();
const char *destinationConverted = destination.toLocal8Bit().data();
if (chown(destinationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId())) {
return;
}
......@@ -97,8 +97,8 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
// copy fontconfig (font, font rendering)
if (!args[QStringLiteral("fontconfig")].isNull()) {
QDir fontconfigSource(args[QStringLiteral("fontconfig")].toString());
QStringList sourceFileEntries = fontconfigSource.entryList (QDir::Files);
QStringList sourceDirEntries = fontconfigSource.entryList (QDir::AllDirs);
QStringList sourceFileEntries = fontconfigSource.entryList(QDir::Files);
QStringList sourceDirEntries = fontconfigSource.entryList(QDir::AllDirs);
QDir fontconfigDestination(sddmConfigLocation.path() + QStringLiteral("/fontconfig"));
if (!fontconfigDestination.exists()) {
......@@ -106,7 +106,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
}
if (sourceDirEntries.count() != 0) {
for (int i = 0; i<sourceDirEntries.count(); i++) {
for (int i = 0; i < sourceDirEntries.count(); i++) {
QString directoriesSource = fontconfigSource.path() + QDir::separator() + sourceDirEntries[i];
QString directoriesDestination = fontconfigDestination.path() + QDir::separator() + sourceDirEntries[i];
fontconfigSource.mkpath(directoriesDestination);
......@@ -115,7 +115,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
}
if (sourceFileEntries.count() != 0) {
for (int i = 0; i<sourceFileEntries.count(); i++) {
for (int i = 0; i < sourceFileEntries.count(); i++) {
QString filesSource = fontconfigSource.path() + QDir::separator() + sourceFileEntries[i];
QString filesDestination = fontconfigDestination.path() + QDir::separator() + sourceFileEntries[i];
copyFile(filesSource, filesDestination);
......@@ -144,7 +144,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) {
for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf"))
continue;
......@@ -195,7 +195,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) {
for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf"))
continue;
......@@ -224,7 +224,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args)
ActionReply SddmAuthHelper::save(const QVariantMap &args)
{
ActionReply reply = ActionReply::HelperErrorReply();
QSharedPointer<KConfig> sddmConfig = openConfig(QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")});
QSharedPointer<KConfig> sddmConfig = openConfig(QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")});
QSharedPointer<KConfig> sddmOldConfig = openConfig(QStringLiteral(SDDM_CONFIG_FILE));
QSharedPointer<KConfig> themeConfig;
QString themeConfigFile = args[QStringLiteral("theme.conf.user")].toString();
......@@ -235,7 +235,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) {
for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf") || iterator.key() == QLatin1String("theme.conf.user"))
continue;
......@@ -274,7 +274,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args)
if (newBackgroundFileInfo.exists()) {
QString newBackgroundPath = configRootDirectory.filePath(newBackgroundFileInfo.fileName());
qDebug() << "Copying background from " << newBackgroundFileInfo.absoluteFilePath() << " to " << newBackgroundPath;
qDebug() << "Copying background from " << newBackgroundFileInfo.absoluteFilePath() << " to " << newBackgroundPath;
if (QFile::copy(newBackgroundFileInfo.absoluteFilePath(), newBackgroundPath)) {
QFile::setPermissions(newBackgroundPath, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther);
themeConfig->group(groupName).writeEntry(keyName, newBackgroundFileInfo.fileName());
......@@ -323,23 +323,21 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args)
QScopedPointer<KArchive> archive;
//there must be a better way to do this? If not, make a static bool KZip::supportsMimeType(const QMimeType &type); ?
//or even a factory class in KArchive
// there must be a better way to do this? If not, make a static bool KZip::supportsMimeType(const QMimeType &type); ?
// or even a factory class in KArchive
if (mimeType.inherits(QStringLiteral("application/zip"))) {
archive.reset(new KZip(filePath));
} else if (mimeType.inherits(QStringLiteral("application/tar"))
|| mimeType.inherits(QStringLiteral("application/x-gzip"))
|| mimeType.inherits(QStringLiteral("application/x-bzip"))
|| mimeType.inherits(QStringLiteral("application/x-lzma"))
|| mimeType.inherits(QStringLiteral("application/x-xz"))
|| mimeType.inherits(QStringLiteral("application/x-bzip-compressed-tar"))
|| mimeType.inherits(QStringLiteral("application/x-compressed-tar"))) {
} else if (mimeType.inherits(QStringLiteral("application/tar")) || mimeType.inherits(QStringLiteral("application/x-gzip"))
|| mimeType.inherits(QStringLiteral("application/x-bzip")) || mimeType.inherits(QStringLiteral("application/x-lzma"))
|| mimeType.inherits(QStringLiteral("application/x-xz")) || mimeType.inherits(QStringLiteral("application/x-bzip-compressed-tar"))
|| mimeType.inherits(QStringLiteral("application/x-compressed-tar"))) {
archive.reset(new KTar(filePath));
} else {
auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package"));
return e; }
return e;
}
if (!archive->open(QIODevice::ReadOnly)) {
auto e = ActionReply::HelperErrorReply();
......@@ -351,20 +349,20 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args)
QStringList installedPaths;
//some basic validation
//the top level should only have folders, and those folders should contain a valid metadata.desktop file
//if we get anything else, abort everything before copying
// some basic validation
// the top level should only have folders, and those folders should contain a valid metadata.desktop file
// if we get anything else, abort everything before copying
const auto entries = directory->entries();
for (const QString &name: entries) {
for (const QString &name : entries) {
auto entry = directory->entry(name);
if (!entry->isDirectory()) {
auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package"));
return e;
}
auto subDirectory = static_cast<const KArchiveDirectory*>(entry);
auto subDirectory = static_cast<const KArchiveDirectory *>(entry);
auto metadataFile = subDirectory->file(QStringLiteral("metadata.desktop"));
if(!metadataFile || !metadataFile->data().contains("[SddmGreeterTheme]")) {
if (!metadataFile || !metadataFile->data().contains("[SddmGreeterTheme]")) {
auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package"));
return e;
......@@ -393,9 +391,9 @@ ActionReply SddmAuthHelper::uninstalltheme(const QVariantMap &args)
return ActionReply::HelperErrorReply();
}
//validate the themePath is directly inside the themesBaseDir
// validate the themePath is directly inside the themesBaseDir
QDir baseDir(themesBaseDir);
if(baseDir.absoluteFilePath(dir.dirName()) != dir.absolutePath()) {
if (baseDir.absoluteFilePath(dir.dirName()) != dir.absolutePath()) {
return ActionReply::HelperErrorReply();
}
......
......@@ -22,7 +22,7 @@
using namespace KAuth;
class SddmAuthHelper: public QObject
class SddmAuthHelper : public QObject
{
Q_OBJECT
......@@ -34,7 +34,7 @@ public Q_SLOTS:
ActionReply uninstalltheme(const QVariantMap &args);
public:
void copyFile (const QString &source, const QString &destination);
void copyFile(const QString &source, const QString &destination);
};
#endif //SDDMAUTHHELPER_H
#endif // SDDMAUTHHELPER_H
......@@ -20,8 +20,8 @@
#include <QApplication>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QDir>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QProcess>
......@@ -35,7 +35,7 @@
int main(int argc, char **argv)
{
QCommandLineParser parser;
QApplication app(argc, argv); //because GHNS doesn't do it's own error reporting on installation failing..
QApplication app(argc, argv); // because GHNS doesn't do it's own error reporting on installation failing..
const QString description = i18n("SDDM theme installer");
const char version[] = "1.0";
......@@ -85,7 +85,7 @@ int main(int argc, char **argv)
if (parser.isSet(QStringLiteral("uninstall"))) {
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("sddmthemeinstallerrc"), KConfig::SimpleConfig), "DownloadedThemes");
const QStringList installed = cg.readEntry(args.first(), QStringList());
for (const QString &installedTheme: installed) {
for (const QString &installedTheme : installed) {
KAuth::Action action(QStringLiteral("org.kde.kcontrol.kcmsddm.uninstalltheme"));
action.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm"));
action.addArgument(QStringLiteral("filePath"), installedTheme);
......
......@@ -28,7 +28,7 @@ SddmData::SddmData(QObject *parent, const QVariantList &args)
{
auto config = KSharedConfig::openConfig(QStringLiteral(SDDM_CONFIG_FILE), KConfig::CascadeConfig);
QStringList configFiles = QDir(QStringLiteral(SDDM_CONFIG_DIR)).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware);
std::transform(configFiles.begin(), configFiles.end(), configFiles.begin(), [] (const QString &filename) -> QString {
std::transform(configFiles.begin(), configFiles.end(), configFiles.begin(), [](const QString &filename) -> QString {
return QStringLiteral(SDDM_CONFIG_DIR "/") + filename;
});
config->addConfigSources(configFiles);
......
......@@ -26,6 +26,7 @@ class SddmData : public KCModuleData
public:
SddmData(QObject *parent = nullptr, const QVariantList &args = QVariantList());
SddmSettings *sddmSettings() const;
private:
SddmSettings *m_settings;
};
......
......@@ -17,7 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sddmkcm.h"
#include "config.h"
......@@ -42,7 +41,7 @@ SddmKcm::SddmKcm(QObject *parent, const QVariantList &args)
, m_data(new SddmData(this))
, m_themesModel(new ThemesModel(this))
{
KAboutData* aboutData = new KAboutData(QStringLiteral("kcm_sddm"), i18n("Login Screen (SDDM)"), QStringLiteral(PROJECT_VERSION));
KAboutData *aboutData = new KAboutData(QStringLiteral("kcm_sddm"), i18n("Login Screen (SDDM)"), QStringLiteral(PROJECT_VERSION));
aboutData->setShortDescription(i18n("Login screen using the SDDM"));
aboutData->setLicense(KAboutLicense::GPL_V2);
......@@ -69,17 +68,17 @@ SddmKcm::~SddmKcm()
{
}
SddmSettings* SddmKcm::sddmSettings() const
SddmSettings *SddmKcm::sddmSettings() const
{
return m_data->sddmSettings();
}
ThemesModel* SddmKcm::themesModel() const
ThemesModel *SddmKcm::themesModel() const
{
return m_themesModel;
}
QString SddmKcm::toLocalFile(const QUrl& url)
QString SddmKcm::toLocalFile(const QUrl &url)
{
return url.toLocalFile();
}
......@@ -131,7 +130,7 @@ void SddmKcm::save()
args[QStringLiteral("theme.conf.user/General/background")] = backgroundPath;
args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("image");
} else {
args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("color");
args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("color");
}
}
args[QStringLiteral("kde_settings.conf/Theme/Current")] = currentThemeIndex.data(ThemesModel::IdRole);
......@@ -141,7 +140,7 @@ void SddmKcm::save()
args[QStringLiteral("kde_settings.conf/Users/MinimumUid")] = m_data->sddmSettings()->minimumUid();
args[QStringLiteral("kde_settings.conf/Users/MaximumUid")] = m_data->sddmSettings()->maximumUid();
args[QStringLiteral("kde_settings.conf/General/HaltCommand")] = m_data->sddmSettings()->haltCommand();
args[QStringLiteral("kde_settings.conf/General/RebootCommand")] = m_data->sddmSettings()->rebootCommand();
args[QStringLiteral("kde_settings.conf/General/RebootCommand")] = m_data->sddmSettings()->rebootCommand();
KAuth::Action saveAction(authActionName());
saveAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm"));
......@@ -160,7 +159,7 @@ void SddmKcm::save()
void SddmKcm::synchronizeSettings()
{
// initial check for sddm user; abort if user not present
// initial check for sddm user; abort if user not present
// we have to check with QString and isEmpty() instead of QDir and exists() because
// QDir returns "." and true for exists() in the case of a non-existent user;
QString sddmHomeDirPath = KUser("sddm").homeDir();
......@@ -191,57 +190,49 @@ void SddmKcm::synchronizeSettings()
// send values and paths to helper, debug if it fails
QVariantMap args;
args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("kde_settings.conf")] = QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE);
if (!cursorTheme.isNull()) {
args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = cursorTheme;
}
else {
} else {
qDebug() << "Cannot find cursor theme value.";
}
if (!dpiValue.isEmpty()) {
args[QStringLiteral("kde_settings.conf/X11/ServerArguments")] = dpiArgument;
}
else {
} else {
qDebug() << "Cannot find scaling DPI value.";
}
if (!numLock.isEmpty()) {
if (numLock == QStringLiteral("0")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("on");
}
else if (numLock == QStringLiteral("1")) {
} else if (numLock == QStringLiteral("1")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("off");
}
else if (numLock == QStringLiteral("2")) {
} else if (numLock == QStringLiteral("2")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("none");
}
}
else {
} else {
qDebug() << "Cannot find NumLock value.";
}
if (!fontconfigPath.isEmpty()) {
args[QStringLiteral("fontconfig")] = fontconfigPath;
}
else {
} else {
qDebug() << "Cannot find fontconfig folder.";
}
if (!kdeglobalsPath.isEmpty()) {
args[QStringLiteral("kdeglobals")] = kdeglobalsPath;
}
else {
} else {
qDebug() << "Cannot find kdeglobals file.";
}
if (!plasmarcPath.isEmpty()) {
args[QStringLiteral("plasmarc")] = plasmarcPath;
}
else {
} else {
qDebug() << "Cannot find plasmarc file.";
}
......@@ -251,7 +242,7 @@ void SddmKcm::synchronizeSettings()
auto job = syncAction.execute();
connect(job, &KJob::result, this, [this, job] {
if (job->error()){
if (job->error()) {
qDebug() << "Synchronization failed";
qDebug() << job->errorString();
qDebug() << job->errorText();
......@@ -279,7 +270,7 @@ void SddmKcm::resetSyncronizedSettings()
// send paths to helper
QVariantMap args;
args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("kde_settings.conf")] = QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE);
......@@ -296,7 +287,7 @@ void SddmKcm::resetSyncronizedSettings()
auto job = resetAction.execute();
connect(job, &KJob::result, this, [this, job] {
if (job->error()){
if (job->error()) {
qDebug() << "Reset failed";
qDebug() << job->errorString();
qDebug() << job->errorText();
......@@ -310,5 +301,4 @@ void SddmKcm::resetSyncronizedSettings()
job->start();
}
#include "sddmkcm.moc"
......@@ -40,8 +40,8 @@ public:
Q_INVOKABLE void synchronizeSettings();
Q_INVOKABLE void resetSyncronizedSettings();
SddmSettings* sddmSettings() const;
ThemesModel* themesModel() const;
SddmSettings *sddmSettings() const;
ThemesModel *themesModel() const;
public Q_SLOTS:
void save() override;
Q_SIGNALS:
......
......@@ -19,16 +19,16 @@
#include "config.h"
#include <QDir>
#include <QDebug>
#include <QDir>
#include <algorithm>
SddmSettingsBase::SddmSettingsBase(KSharedConfigPtr config, QObject* parent)
SddmSettingsBase::SddmSettingsBase(KSharedConfigPtr config, QObject *parent)
: KConfigSkeleton(config, parent)
{
auto defaultFiles = QDir(QStringLiteral(SDDM_SYSTEM_CONFIG_DIR)).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware);
std::transform(defaultFiles.begin(), defaultFiles.end(), defaultFiles.begin(), [] (const QString &filename) -> QString {
std::transform(defaultFiles.begin(), defaultFiles.end(), defaultFiles.begin(), [](const QString &filename) -> QString {
return QStringLiteral(SDDM_SYSTEM_CONFIG_DIR "/") + filename;
});
// If no filename is set, KConfig will not parse any file
......@@ -75,7 +75,7 @@ QString SddmSettingsBase::defaultHaltCommand() const
return m_defaultConfig->group("General").readEntry("HaltCommand");
}
QString SddmSettingsBase::defaultRebootCommand() const
QString SddmSettingsBase::defaultRebootCommand() const
{
return m_defaultConfig->group("General").readEntry("RebootCommand");
}
......@@ -44,6 +44,7 @@ protected:
bool defaultRelogin() const;
QString defaultHaltCommand() const;
QString defaultRebootCommand() const;
private:
KSharedConfigPtr m_defaultConfig;
};
......
/***************************************************************************
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
*
* 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 "config.h"
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
*
* 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 "sessionmodel.h"
#include "config.h"
#include <memory>
......@@ -28,7 +28,8 @@
#include <KLocalizedString>
class Session {
class Session
{
public:
QString file;
QString name;
......@@ -38,18 +39,23 @@ public:
typedef std::shared_ptr<Session> SessionPtr;
class SessionModelPrivate {
class SessionModelPrivate
{
public:
int lastIndex { 0 };
int lastIndex{0};
QList<SessionPtr> sessions;
};
SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) {
SessionModel::SessionModel(QObject *parent)
: QAbstractListModel(parent)
, d(new SessionModelPrivate())
{
loadDir(QStringLiteral(XSESSIONS_DIR), SessionTypeX);
loadDir(QStringLiteral(WAYLAND_SESSIONS_DIR), SessionTypeWayland);
}
SessionModel::~SessionModel() {
SessionModel::~SessionModel()
{
delete d;
}
......@@ -59,11 +65,11 @@ void SessionModel::loadDir(const QString &path, SessionType type)
dir.setNameFilters(QStringList() << QStringLiteral("*.desktop"));
dir.setFilter(QDir::Files);
// read session
foreach(const QString &session, dir.entryList()) {
foreach (const QString &session, dir.entryList()) {
QFile inputFile(dir.absoluteFilePath(session));
if (!inputFile.open(QIODevice::ReadOnly))
continue;
SessionPtr si { new Session { session.chopped(strlen(".desktop")), QString(), QString(), QString() } };
SessionPtr si{new Session{session.chopped(strlen(".desktop")), QString(), QString(), QString()}};
bool isHidden = false;
QString current_section;
QTextStream in(&inputFile);
......@@ -107,7 +113,8 @@ void SessionModel::loadDir(const QString &path, SessionType type)
}
}
QHash<int, QByteArray> SessionModel::roleNames() const {
QHash<int, QByteArray> SessionModel::roleNames() const
{
// set role names
QHash<int, QByteArray> roleNames;
roleNames[FileRole] = "file";
......@@ -118,12 +125,14 @@ QHash<int, QByteArray> SessionModel::roleNames() const {
return roleNames;
}
int SessionModel::rowCount(const QModelIndex &parent) const {
int SessionModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return d->sessions.length();
}
QVariant SessionModel::data(const QModelIndex &index, int role) const {
QVariant SessionModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= d->sessions.count())
return QVariant();
......@@ -153,5 +162,3 @@ int SessionModel::indexOf(const QString &sessionId) const
}
return 0;
}
/***************************************************************************
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
*
* 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.
***************************************************************************/
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
*
* 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 SDDM_SESSIONMODEL_H
#define SDDM_SESSIONMODEL_H
......@@ -24,13 +24,14 @@
class SessionModelPrivate;
class SessionModel : public QAbstractListModel {
class SessionModel : public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(SessionModel)
enum SessionType {
SessionTypeX,
SessionTypeWayland
SessionTypeWayland,
};
public:
......@@ -38,7 +39,7 @@ public:
NameRole = Qt::DisplayRole,
FileRole = Qt::UserRole,
ExecRole,
CommentRole
CommentRole,
};