示例#1
0
void PrivateStorage::stanzaRequestResult(const Jid &AStreamJid, const Stanza &AStanza)
{
	if (FSaveRequests.contains(AStanza.id()))
	{
		QDomElement dataElem = FSaveRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			LOG_STRM_INFO(AStreamJid,QString("Private data saved on server, ns=%1, id=%2").arg(dataElem.namespaceURI(),AStanza.id()));
			notifyDataChanged(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data saved in local storage, ns=%1, id=%2: %3").arg(dataElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		saveOptionsElement(AStreamJid,dataElem);
		emit dataSaved(AStanza.id(),AStreamJid,dataElem);
	}
	else if (FLoadRequests.contains(AStanza.id()))
	{
		QDomElement dataElem; 
		QDomElement loadElem = FLoadRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			dataElem = AStanza.firstElement("query",NS_JABBER_PRIVATE).firstChildElement(loadElem.tagName());
			LOG_STRM_INFO(AStreamJid,QString("Private data loaded from server, ns=%1, id=%2").arg(loadElem.namespaceURI(),AStanza.id()));
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data loaded from local storage, ns=%1, id=%2: %3").arg(loadElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		if (dataElem.isNull())
			dataElem = loadOptionsElement(AStreamJid,loadElem.tagName(),loadElem.namespaceURI());
		emit dataLoaded(AStanza.id(),AStreamJid,insertElement(AStreamJid,dataElem));
	}
	else if (FRemoveRequests.contains(AStanza.id()))
	{
		QDomElement dataElem = FRemoveRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			LOG_STRM_INFO(AStreamJid,QString("Private data removed from server, ns=%1, id=%2").arg(dataElem.namespaceURI(),AStanza.id()));
			notifyDataChanged(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data removed from local storage, ns=%1, id=%2: %3").arg(dataElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		removeElement(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		removeOptionsElement(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		emit dataRemoved(AStanza.id(),AStreamJid,dataElem);
	}
}
bool GCF::Components::ClipboardComponent::removeDataAt(int index)
{
    if(d->activeContext.isEmpty())
        activateDefaultContext();

    ClipboardDataList& dataList = d->contextStore[d->activeContext];
    if(index < 0 || index >= dataList.count())
        return false;

    dataList.removeAt(index);
    d->clipboardModel->setClipboardDataList(dataList);

    emit dataRemoved(index);
    return true;
}
示例#3
0
SearchTrackWidget::SearchTrackWidget( Database *database, QWidget *parent )
: QWidget( parent )
, mpDatabase( database )
, mpParent( parent )
, mpResults( new PlaylistContentWidget( database, false, this ) )
, mpInput( new SearchLineEdit( this ) )
, mpFound( new QLabel( this ) )
{
   QVBoxLayout *mainLayout = new QVBoxLayout( this );
   QHBoxLayout *lineLayout = new QHBoxLayout;
   mainLayout->setContentsMargins( 1, 1, 1, 1 );
   lineLayout->setContentsMargins( 0, 0, 0, 0 );
   lineLayout->addWidget( mpInput );
   lineLayout->addWidget( mpFound );
   mpFound->setHidden( true );

   mainLayout->setSpacing( 2 );
   mainLayout->addWidget( mpResults );
   mainLayout->addLayout( lineLayout );
   setLayout( mainLayout );
   mpInput->setMouseTracking( true );

   connect( mpInput, SIGNAL(returnPressed()),
            this, SLOT(search()) );
   connect( mpResults, SIGNAL(context(QModelIndex,int)),
            this, SLOT(selectedEntries(QModelIndex,int)) );
   connect( mpFound, SIGNAL(customContextMenuRequested(QPoint)),
            mpInput, SLOT(clear()) );
   connect( mpResults, SIGNAL(dataRemoved()),
            this, SLOT(updateCounter()) );

   mpInput->setText( Settings::value( Settings::PartymanSearch ) );
   Settings::setValue( Settings::PartymanSearch, QString() );
   mpInput->selectAll();
   mpInput->setFocus();
}