コード例 #1
0
ファイル: llgrouplist.cpp プロジェクト: otwstephanie/hpa2oar
bool LLGroupList::onContextMenuItemClick(const LLSD& userdata)
{
	std::string action = userdata.asString();
	LLUUID selected_group = getSelectedUUID();

	if (action == "view_info")
	{
		LLGroupActions::show(selected_group);
	}
	else if (action == "chat")
	{
		LLGroupActions::startIM(selected_group);
	}
	else if (action == "call")
	{
		LLGroupActions::startCall(selected_group);
	}
	else if (action == "activate")
	{
		LLGroupActions::activate(selected_group);
	}
	else if (action == "leave")
	{
		LLGroupActions::leave(selected_group);
	}

	return true;
}
コード例 #2
0
ファイル: llgrouplist.cpp プロジェクト: otwstephanie/hpa2oar
bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
{
	LLUUID selected_group_id = getSelectedUUID();
	bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected

	// each group including "none" can be activated
	if (userdata.asString() == "activate")
		return gAgent.getGroupID() != selected_group_id;

	if (userdata.asString() == "call")
	  return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();

	return real_group_selected;
}
コード例 #3
0
bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
{
	LLUUID selected_group_id = getSelectedUUID();
	bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected

	// each group including "none" can be activated
//	if (userdata.asString() == "activate")
//		return gAgent.getGroupID() != selected_group_id;
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f
	if (userdata.asString() == "activate")
		return (gAgent.getGroupID() != selected_group_id) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP));
	else if (userdata.asString() == "leave")
		return (real_group_selected) && ((gAgent.getGroupID() != selected_group_id) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP)));
// [/RLVa:KB]

	if (userdata.asString() == "call")
	  return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();

	return real_group_selected;
}
コード例 #4
0
ファイル: ls3datastorexml.cpp プロジェクト: jkriege2/LitSoz3
bool LS3DatastoreXML::dbSave(const QString &fileName, QProgressBar* progress) {
    LS3ElapsedAutoTimer timer("LS3DatastoreXML::dbSave");
    QFile file(fileName);
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
        emit dbError(tr("Error when writing database '%1': Could not open file!").arg(fileName));
        return false;
    }

    QXmlStreamWriter writer(&file);
    writer.writeStartDocument();
    writer.writeStartElement("litsoz3database");

    writer.writeStartElement("metadata");
    writer.writeStartElement("item");
    writer.writeAttribute("type", "keywords");
    writer.writeCDATA(keywordsdata->stringList().join("\n"));
    writer.writeEndElement();
    writer.writeStartElement("item");
    writer.writeAttribute("type", "topics");
    writer.writeCDATA(topicsdata->stringList().join("\n"));
    writer.writeEndElement();
    writer.writeEndElement();

    writer.writeStartElement("records");
    data->saveToXML(&writer, progress);
    writer.writeEndElement();

    // write the list of selected records
    writer.writeStartElement("selection_list");
    for (int i=0; i<selectionCount(); i++) {
        writer.writeStartElement("item");
        writer.writeAttribute("uuid", getSelectedUUID(i));
        writer.writeEndElement();
    }
    writer.writeEndElement();

    writer.writeStartElement("litsoz3_reference_tree");
    getReferencTreeModel()->writeToXML(writer);
    writer.writeEndElement();

    writer.writeEndElement();
    writer.writeEndDocument();

    file.close();

    QFile f(settings->GetConfigDirectory()+"/completers/authors.lst");
    if (f.open(QIODevice::WriteOnly|QIODevice::Text)) {
        //std::cout<<"OK\n";
        QStringList sl=authorsdata->stringList();
        QFile f1(f.fileName());
        if (f1.open(QIODevice::ReadOnly|QIODevice::Text)) {
            //std::cout<<"OK\n";
            QString s=QString::fromUtf8(f1.readAll());
            sl.append(s.split('\n', QString::SkipEmptyParts));
        } //else std::cout<<"ERROR\n";
        sl.removeDuplicates();
        sl.sort();
        for (int i=0; i<sl.size(); i++) {
            f.write(QString(sl[i]+"\n").toUtf8());
            //std::cout<<"   writing "<<itemText(i).toStdString()<<std::endl;
        }
    }

    if (m_currentFile!=fileName) emit filenameChanged(fileName);
    m_currentFile=fileName;

    return true;
}
コード例 #5
0
//////////////////////////////////////////////////////////////////////////
// PROTECTED SECTION
//////////////////////////////////////////////////////////////////////////
void LLAvatarList::refresh()
{
	bool have_names			= TRUE;
	bool add_limit_exceeded	= false;
	bool modified			= false;
	bool have_filter		= !mNameFilter.empty();

	// Save selection.	
	uuid_vec_t selected_ids;
	getSelectedUUIDs(selected_ids);
	LLUUID current_id = getSelectedUUID();

	// Determine what to add and what to remove.
	uuid_vec_t added, removed;
	LLAvatarList::computeDifference(getIDs(), added, removed);

	// Handle added items.
	unsigned nadded = 0;
	const std::string waiting_str = LLTrans::getString("AvatarNameWaiting");

	for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++)
	{
		const LLUUID& buddy_id = *it;
		LLAvatarName av_name;
		have_names &= LLAvatarNameCache::get(buddy_id, &av_name);

		if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter))
		{
			if (nadded >= ADD_LIMIT)
			{
				add_limit_exceeded = true;
				break;
			}
			else
			{
				// *NOTE: If you change the UI to show a different string,
				// be sure to change the filter code below.
				if (LLRecentPeople::instance().isAvalineCaller(buddy_id))
				{
					const LLSD& call_data = LLRecentPeople::instance().getData(buddy_id);
					addAvalineItem(buddy_id, call_data["session_id"].asUUID(), call_data["call_number"].asString());
				}
				else
				{
					addNewItem(buddy_id, 
						av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, 
						LLAvatarTracker::instance().isBuddyOnline(buddy_id));
				}
				
				modified = true;
				nadded++;
			}
		}
	}

	// Handle removed items.
	for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++)
	{
		removeItemByUUID(*it);
		modified = true;
	}

	// Handle filter.
	if (have_filter)
	{
		std::vector<LLSD> cur_values;
		getValues(cur_values);

		for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
		{
			const LLUUID& buddy_id = it->asUUID();
			LLAvatarName av_name;
			have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
			if (!findInsensitive(av_name.mDisplayName, mNameFilter))
			{
				removeItemByUUID(buddy_id);
				modified = true;
			}
		}
	}

	// Changed item in place, need to request sort and update columns
	// because we might have changed data in a column on which the user
	// has already sorted. JC
	sort();

	// re-select items
	//	selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
	selectItemByUUID(current_id);

	// If the name filter is specified and the names are incomplete,
	// we need to re-update when the names are complete so that
	// the filter can be applied correctly.
	//
	// Otherwise, if we have no filter then no need to update again
	// because the items will update their names.
	bool dirty = add_limit_exceeded || (have_filter && !have_names);
	setDirty(dirty);

	// Refreshed all items.
	if(!dirty)
	{
		// Highlight items matching the filter.
		std::vector<LLPanel*> items;
		getItems(items);
		for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
		{
			static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
		}

		// Send refresh_complete signal.
		mRefreshCompleteSignal(this, LLSD((S32)size(false)));
	}

	// Commit if we've added/removed items.
	if (modified)
		onCommit();
}
コード例 #6
0
void LLAvatarList::refresh()
{
	bool have_names			= TRUE;
	bool add_limit_exceeded	= false;
	bool modified			= false;
	bool have_filter		= !mNameFilter.empty();

	// Save selection.	
	std::vector<LLUUID> selected_ids;
	getSelectedUUIDs(selected_ids);
	LLUUID current_id = getSelectedUUID();

	// Determine what to add and what to remove.
	std::vector<LLUUID> added, removed;
	LLAvatarList::computeDifference(getIDs(), added, removed);

	// Handle added items.
	unsigned nadded = 0;
	for (std::vector<LLUUID>::const_iterator it=added.begin(); it != added.end(); it++)
	{
		std::string name;
		const LLUUID& buddy_id = *it;
		have_names &= (bool)gCacheName->getFullName(buddy_id, name);
		if (!have_filter || findInsensitive(name, mNameFilter))
		{
			if (nadded >= ADD_LIMIT)
			{
				add_limit_exceeded = true;
				break;
			}
			else
			{
				addNewItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id));
				modified = true;
				nadded++;
			}
		}
	}

	// Handle removed items.
	for (std::vector<LLUUID>::const_iterator it=removed.begin(); it != removed.end(); it++)
	{
		removeItemByUUID(*it);
		modified = true;
	}

	// Handle filter.
	if (have_filter)
	{
		std::vector<LLSD> cur_values;
		getValues(cur_values);

		for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
		{
			std::string name;
			const LLUUID& buddy_id = it->asUUID();
			have_names &= (bool)gCacheName->getFullName(buddy_id, name);
			if (!findInsensitive(name, mNameFilter))
			{
				removeItemByUUID(buddy_id);
				modified = true;
			}
		}
	}

	// Changed item in place, need to request sort and update columns
	// because we might have changed data in a column on which the user
	// has already sorted. JC
	sort();

	// re-select items
	//	selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
	selectItemByUUID(current_id);

	// If the name filter is specified and the names are incomplete,
	// we need to re-update when the names are complete so that
	// the filter can be applied correctly.
	//
	// Otherwise, if we have no filter then no need to update again
	// because the items will update their names.
	bool dirty = add_limit_exceeded || (have_filter && !have_names);
	setDirty(dirty);

	// Refreshed all items.
	if(!dirty)
	{
		// Highlight items matching the filter.
		std::vector<LLPanel*> items;
		getItems(items);
		for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
		{
			static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
		}

		// Send refresh_complete signal.
		std::vector<LLSD> cur_values;
		getValues(cur_values);
		mRefreshCompleteSignal(this, LLSD((S32)cur_values.size()));
	}

	// Commit if we've added/removed items.
	if (modified)
		onCommit();
}