コード例 #1
0
ファイル: group-manager.cpp プロジェクト: partition/kadu
// TODO: move some of this to %like-encoding, so we don't block normal names
bool GroupManager::acceptableGroupName(const QString &groupName, bool acceptExistingGroupName)
{
	kdebugf();
	if (groupName.isEmpty())
	{
		kdebugf2();
		return false;
	}

	if (groupName.contains(","))
	{
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("'%1' is prohibited").arg(','));
		kdebugf2();
		return false;
	}

	if (groupName.contains(";"))
	{
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("'%1' is prohibited").arg(';'));
		kdebugf2();
		return false;
	}

	bool number;
	groupName.toLong(&number);
	if (number)
	{
		// because of gadu-gadu contact list format...
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("Numbers are prohibited"));
		kdebugf2();
		return false;
	}

	// TODO All translations
 	if (groupName == tr("All"))
	{
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("Group name %1 is prohibited").arg(groupName));
 		kdebugf2();
 		return false;
	}

	if (!acceptExistingGroupName && byName(groupName, false))
 	{
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("Group of that name already exists!"));
 		kdebugf2();
 		return false;
 	}

	kdebugf2();
	return true;
}
コード例 #2
0
ファイル: group-manager.cpp プロジェクト: partition/kadu
void GroupManager::importConfiguration()
{
	QMutexLocker(&mutex());

	QSharedPointer<StoragePoint> sp(storage());
	if (!sp || !sp->storage())
		return;

	QSet<QString> groups;
	XmlConfigFile *configurationStorage = sp->storage();

	QDomElement contactsNode = configurationStorage->getNode("Contacts", XmlConfigFile::ModeFind);
	if (contactsNode.isNull())
		return;

	QList<QDomElement> contactsElements = configurationStorage->getNodes(contactsNode, "Contact");
	foreach (const QDomElement &contactElement, contactsElements)
		foreach (const QString &newGroup, contactElement.attribute("groups").split(',', QString::SkipEmptyParts))
			groups << newGroup;

	foreach (const QString &groupName, groups)
		byName(groupName); // it can do import, too
}
コード例 #3
0
ファイル: TextEncoding.cpp プロジェクト: as2120/ZPoco
TextEncoding& TextEncoding::global()
{
    return byName(GLOBAL);
}
コード例 #4
0
ファイル: tile.cpp プロジェクト: Ancurio/keeperrl
Tile Tile::empty() {
  return byName("empty");
}