1 /* 2 * %kadu copyright begin% 3 * Copyright 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 4 * %kadu copyright end% 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "status-configuration-holder.h" 21 22 #include "configuration/configuration.h" 23 #include "configuration/deprecated-configuration-api.h" 24 #include "core/core.h" 25 #include "misc/paths-provider.h" 26 StatusConfigurationHolder(QObject * parent)27StatusConfigurationHolder::StatusConfigurationHolder(QObject *parent) : 28 ConfigurationHolder{parent}, 29 SetStatus{SetStatusPerIdentity} 30 { 31 } 32 ~StatusConfigurationHolder()33StatusConfigurationHolder::~StatusConfigurationHolder() 34 { 35 } 36 setConfiguration(Configuration * configuration)37void StatusConfigurationHolder::setConfiguration(Configuration *configuration) 38 { 39 m_configuration = configuration; 40 } 41 init()42void StatusConfigurationHolder::init() 43 { 44 configurationUpdated(); 45 } 46 configurationUpdated()47void StatusConfigurationHolder::configurationUpdated() 48 { 49 auto statusContainerType = m_configuration->deprecatedApi()->readEntry("General", "StatusContainerType", "Identity"); 50 51 auto newStatus = SetStatusPerIdentity; 52 if (statusContainerType == "Account") 53 newStatus = SetStatusPerAccount; 54 else if (statusContainerType == "All") 55 newStatus = SetStatusForAll; 56 57 if (SetStatus != newStatus) 58 { 59 SetStatus = newStatus; 60 emit setStatusModeChanged(); 61 } 62 } 63 64 #include "moc_status-configuration-holder.cpp" 65