本文整理汇总了C++中UserList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ UserList::count方法的具体用法?C++ UserList::count怎么用?C++ UserList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSelectedUser
bool KaduExtInfo::getSelectedUser(QString &user)
{
kdebugf();
#if defined(KADU_0_4_x)
UserBox *activeUserBox = kadu->userbox()->getActiveUserBox();
#elif defined(KADU_0_5_0)
UserBox *activeUserBox = kadu->userbox()->activeUserBox();
#endif
if (activeUserBox == NULL)//to siê zdarza...
{
kdebugf2();
return false;
}
#if defined(KADU_0_4_x)
UserList users = activeUserBox->getSelectedUsers();
#elif defined(KADU_0_5_0)
UserListElements users = activeUserBox->selectedUsers();
#endif
if (users.count() == 1)
{
user = (*users.begin()).altNick();
kdebugf2();
return true;
}
return false;
kdebugf2();
}
示例2: runDCOP
/**
* Do the actual DCOP call
*/
int runDCOP(KStringList args, UserList users, Session session, const QString sessionName, bool readStdin, bool updateUserTime)
{
bool DCOPrefmode = false;
QCString app;
QCString objid;
QCString function;
KStringList params;
DCOPClient *client = 0L;
int retval = 0;
if(!args.isEmpty() && args[0].find("DCOPRef(") == 0)
{
int delimPos = args[0].findRev(',');
if(delimPos == -1)
{
cerr_ << "Error: '" << args[0] << "' is not a valid DCOP reference." << endl;
exit(-1);
}
app = args[0].mid(8, delimPos - 8);
delimPos++;
objid = args[0].mid(delimPos, args[0].length() - delimPos - 1);
if(args.count() > 1)
function = args[1];
if(args.count() > 2)
{
params = args;
params.remove(params.begin());
params.remove(params.begin());
}
DCOPrefmode = true;
}
else
{
if(!args.isEmpty())
app = args[0];
if(args.count() > 1)
objid = args[1];
if(args.count() > 2)
function = args[2];
if(args.count() > 3)
{
params = args;
params.remove(params.begin());
params.remove(params.begin());
params.remove(params.begin());
}
}
bool firstRun = true;
UserList::Iterator it;
QStringList sessions;
bool presetDCOPServer = false;
// char *dcopStr = 0L;
QString dcopServer;
for(it = users.begin(); it != users.end() || firstRun; ++it)
{
firstRun = false;
// cout_ << "Iterating '" << it.key() << "'" << endl;
if(session == QuerySessions)
{
QStringList sessions = dcopSessionList(it.key(), it.data());
if(sessions.isEmpty())
{
if(users.count() <= 1)
{
cout_ << "No active sessions";
if(!(*it).isEmpty())
cout_ << " for user " << *it;
cout_ << endl;
}
}
else
{
cout_ << "Active sessions ";
if(!(*it).isEmpty())
cout_ << "for user " << *it << " ";
cout_ << ":" << endl;
QStringList::Iterator sIt = sessions.begin();
for(; sIt != sessions.end(); ++sIt)
cout_ << " " << *sIt << endl;
cout_ << endl;
}
continue;
}
if(getenv("DCOPSERVER"))
{
sessions.append(getenv("DCOPSERVER"));
presetDCOPServer = true;
}
if(users.count() > 1 || (users.count() == 1 && (getenv("DCOPSERVER") == 0 /*&& getenv( "DISPLAY" ) == 0*/)))
{
//.........这里部分代码省略.........