Example #1
0
bool KviSharedFilesManager::removeSharedFile(const QString &szName,KviSharedFile * off)
{
	KviSharedFileList * l = m_pSharedListDict->find(szName);
	if(!l)return false;
	for(KviSharedFile * o = l->first();o;o = l->next())
	{
		if(off == o)
		{
			QString save = szName; // <-- szName MAY Be a pointer to o->name()
			l->removeRef(o);
			if(l->count() == 0)m_pSharedListDict->remove(save);
			emit sharedFileRemoved(off);
			return true;
		}
	}
	return false;
}
Example #2
0
bool KviSharedFilesManager::removeSharedFile(const QString &szName,const QString &szMask,unsigned int uFileSize)
{
	KviSharedFileList * l = m_pSharedListDict->find(szName);
	if(!l)return false;
	for(KviSharedFile * o = l->first();o;o = l->next())
	{
		if(KviQString::equalCI(szMask,o->userMask()))
		{
			bool bMatch = uFileSize > 0 ? uFileSize == o->fileSize() : true;
			if(bMatch)
			{
				QString save = szName; // <-- szName MAY Be a pointer to o->name()
				l->removeRef(o);
				if(l->count() == 0)m_pSharedListDict->remove(save);
				emit sharedFileRemoved(o);
				return true;
			}
		}
	}
	return false;
}