1
/****************************************************************************
2
* Copyright (C) 2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
* This library is free software; you can redistribute it and/or *
6
* modify it under the terms of the GNU Lesser General Public *
7
* License as published by the Free Software Foundation; either *
8
* version 2.1 of the License, or (at your option) any later version. *
10
* This library is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13
* Lesser General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17
***************************************************************************/
18
#include "itemmodelserialization.h"
20
#include "../lib/abstractitembackend.h"
21
#include "kcfg_settings.h"
23
ItemModelStateSerialization::~ItemModelStateSerialization()
28
bool ItemModelStateSerialization::save()
30
//FIXME this is too tied to the contact backend, it need to support roles for
31
//other collection types (aka: bookmarks)
33
for (QHash<QByteArray,bool>::iterator i = m_hChecked.begin(); i != m_hChecked.end(); ++i) {
37
// digg(QModelIndex());
38
ConfigurationSkeleton::setDisabledCollectionList(ret);
42
bool ItemModelStateSerialization::load()
45
const QStringList disabled = ConfigurationSkeleton::disabledCollectionList();
46
foreach(const QString& str, disabled) {
47
m_hChecked[str.toAscii()] = true; //Disabled == true, enabled == false
52
bool ItemModelStateSerialization::isChecked(AbstractItemBackendBase* backend) const
54
return !(m_hChecked[backend->id()]);
57
bool ItemModelStateSerialization::setChecked(AbstractItemBackendBase* backend, bool enabled)
59
m_hChecked[backend->id()] = ! enabled;