示例#1
0
void UserItem::onUpdateHosts (const HostInfoMap & hosts) {
	bool changed = false; // host list changed (added or removed)
	for (HostInfoMap::const_iterator i = hosts.begin(); i != hosts.end(); i++) {
		sf::HostId id (i->first);
		HostItemMap::iterator j = mHosts.find (id);
		if (j == mHosts.end()) {
			// Generate a new Host
			HostItem * item = new HostItem (i->second);
			mHosts[id] = item;
			appendRow (item);
			changed = true;
		} else {
			// Update a host
			HostItem * item = j->second;
			item->set (i->second);
		}
	}
	{
		HostItemMap::iterator i = mHosts.begin();
		while (i != mHosts.end()){
			if (hosts.count(i->first) == 0) { 
				// remove host
				removeRow (i->second->row()); // will delete all descendants by Qt
				mHosts.erase(i++);
				changed = true;
			} else {
				i++;
			}
		}
	}
	if (changed)
		updatePresentation ();
}
示例#2
0
CreateTransitionDialog::CreateTransitionDialog(CreateDialogCommandWidget *creator, QWidget *parent) : 
  KDialog(parent),
  m_creator(creator)
{
  setCaption(i18n("Dialog Option"));

  QWidget *mainWidget = new QWidget(this);
  ui.setupUi(mainWidget);
  setMainWidget(mainWidget);

  static_cast<QVBoxLayout*>(mainWidget->layout())->insertWidget(1, creator);
  connect(ui.leTrigger, SIGNAL(textChanged(QString)), creator, SLOT(updatePresentation(QString)));
}
示例#3
0
void QtHistory::mementoRemovedEvent(unsigned id) {
	int firstRow = _mementoIdList.indexOf(id);
	if (firstRow == -1) {
		updatePresentation();//VOXOX CHANGE by Rolando - 2009.10.07 
		return;
	}
	LOG_WARN("We should not reach this code");
	// We should not reach this code because the memento has probably been
	// removed by removeItem, which should have removed the id from our list
	beginRemoveRows(QModelIndex(), firstRow, firstRow);
	_mementoIdList.removeAll(id);
	endRemoveRows();

}
示例#4
0
QtHistory::QtHistory(CHistory & cHistory)
	: QAbstractTableModel(NULL),
	_cHistory(cHistory) {

	_chatLogViewer = NULL;
	_mutex = new QMutex(QMutex::Recursive);

	_stateFilter = HistoryMemento::Any;

	QtWengoPhone * qtWengoPhone = (QtWengoPhone *) _cHistory.getCWengoPhone().getPresentation();
	_historyWidget = new QtHistoryWidget(qtWengoPhone->getWidget(), this);
	SAFE_CONNECT(_historyWidget,
		SIGNAL(replayItemRequested(int)),
		SLOT(replayItem(int))
	);
	SAFE_CONNECT(_historyWidget,
		SIGNAL(showChatLogRequested(int)),
		SLOT(showChatLog(int))
	);
	SAFE_CONNECT(_historyWidget,
		SIGNAL(removeItemRequested(int)),
		SLOT(removeItem(int))
	);
	SAFE_CONNECT(_historyWidget,
		SIGNAL(missedCallsSeen()),
		SLOT(resetUnseenMissedCalls())
	);

	SAFE_CONNECT(_historyWidget,
		SIGNAL(showOnlyItemOfType(int)),
		SLOT(showOnlyItemOfTypeSlot(int))
	);
	qtWengoPhone->setQtHistoryWidget(_historyWidget);
	
	// define user use a Wengo or a SIP account
	UserProfile * userProfile = _cHistory.getCWengoPhone().getCUserProfileHandler().getUserProfileHandler().getCurrentUserProfile();
	if (userProfile) {
		_isWengoAccountConnected = userProfile->hasWengoAccount();
	} else {
		_isWengoAccountConnected = false;
	}
	////

	updatePresentation();
}
示例#5
0
//VOXOX - SEMR - 2009.05.08 
void QtHistory::showOnlyItemOfTypeSlot(int state) {
	_stateFilter = (HistoryMemento::State)state;
	updatePresentation();
}
示例#6
0
void UserItem::set (const UserInfo & info) {
	setEditable (false);
	mUserInfo = info;
	updatePresentation ();
}