chat-edit-box-size-manager.cpp 2.01 KB
Newer Older
1 2
/*
 * %kadu copyright begin%
Rafał Malinowski's avatar
Rafał Malinowski committed
3 4 5
 * Copyright 2008 Piotr Galiszewski (piotr.galiszewski@kadu.im)
 * Copyright 2009 Wojciech Treter (juzefwt@gmail.com)
 * Copyright 2007, 2008, 2009, 2010, 2011 Rafał Malinowski (rafal.przemyslaw.malinowski@gmail.com)
6
 * Copyright 2013 Bartosz Brachaczek (b.brachaczek@gmail.com)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 * %kadu copyright end%
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

23
#include "configuration/deprecated-configuration-api.h"
24
#include "kadu-application.h"
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include "chat-edit-box-size-manager.h"

ChatEditBoxSizeManager * ChatEditBoxSizeManager::Instance = 0;

ChatEditBoxSizeManager * ChatEditBoxSizeManager::instance()
{
	if (!Instance)
		Instance = new ChatEditBoxSizeManager();

	return Instance;
}

ChatEditBoxSizeManager::ChatEditBoxSizeManager() :
		CommonHeight(0)
{
41
	configurationUpdated();
42 43 44 45 46 47
}

ChatEditBoxSizeManager::~ChatEditBoxSizeManager()
{
}

48 49
void ChatEditBoxSizeManager::configurationUpdated()
{
50
	setCommonHeight(KaduApplication::instance()->deprecatedConfigurationApi()->readNumEntry("Chat", "ChatEditBoxHeight", 0));
51 52
}

53 54 55 56 57
void ChatEditBoxSizeManager::setCommonHeight(int height)
{
	if (height != CommonHeight)
	{
		CommonHeight = height;
58
		KaduApplication::instance()->deprecatedConfigurationApi()->writeEntry("Chat", "ChatEditBoxHeight", CommonHeight);
59 60 61
		emit commonHeightChanged(CommonHeight);
	}
}
62 63 64 65 66

bool ChatEditBoxSizeManager::initialized()
{
	return 0 != CommonHeight;
}
Bartosz Brachaczek's avatar
Bartosz Brachaczek committed
67 68

#include "moc_chat-edit-box-size-manager.cpp"