File indexing completed on 2024-06-02 05:40:28
0001 /* 0002 This file is part of LightDM-KDE. 0003 0004 Copyright 2012 David Edmundson <kde@davidedmundson.co.uk> 0005 0006 LightDM-KDE is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU General Public License as published by 0008 the Free Software Foundation, either version 3 of the License, or 0009 (at your option) any later version. 0010 0011 LightDM-KDE is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with LightDM-KDE. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "sessionsmodel.h" 0021 0022 #include <QLightDM/SessionsModel> 0023 0024 #include <KLocalizedString> 0025 0026 SessionsModel::SessionsModel(QObject *parent) : 0027 ExtraRowProxyModel(parent), 0028 m_showLastUsedSession(false) 0029 { 0030 setSourceModel(new QLightDM::SessionsModel(this)); 0031 0032 0033 } 0034 0035 void SessionsModel::setShowLastUsedSession(bool showLastUsedSession) 0036 { 0037 if (showLastUsedSession == m_showLastUsedSession) { 0038 return; 0039 } 0040 m_showLastUsedSession = showLastUsedSession; 0041 0042 if (m_showLastUsedSession) { 0043 QStandardItem *guest = new QStandardItem(i18n("Previously Used Session")); 0044 guest->setData("", QLightDM::SessionsModel::KeyRole); 0045 extraRowModel()->appendRow(guest); 0046 } else { 0047 extraRowModel()->removeRow(0); 0048 } 0049 } 0050 0051 bool SessionsModel::showLastUsedSession() const 0052 { 0053 return m_showLastUsedSession; 0054 }