本文整理汇总了C++中ConnectionSettings::clearOneShotChannelList方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionSettings::clearOneShotChannelList方法的具体用法?C++ ConnectionSettings::clearOneShotChannelList怎么用?C++ ConnectionSettings::clearOneShotChannelList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionSettings
的用法示例。
在下文中一共展示了ConnectionSettings::clearOneShotChannelList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reuseExistingConnection
bool ConnectionManager::reuseExistingConnection(ConnectionSettings& settings, bool interactive)
{
Server* dupe = 0;
ConnectionDupe dupeType;
bool doReuse = true;
Application* konvApp = static_cast<Application *>(kapp);
MainWindow* mainWindow = konvApp->getMainWindow();
QMap<int, Server*>::ConstIterator it;
for (it = m_connectionList.constBegin(); it != m_connectionList.constEnd(); ++it)
{
if (it.value()->getServerGroup() && settings.serverGroup()
&& it.value()->getServerGroup() == settings.serverGroup())
{
dupe = it.value();
dupeType = SameServerGroup;
break;
}
}
if (!dupe)
{
for (it = m_connectionList.constBegin(); it != m_connectionList.constEnd(); ++it)
{
if (it.value()->getConnectionSettings().server() == settings.server())
{
dupe = it.value();
dupeType = SameServer;
break;
}
}
}
if (dupe && interactive)
{
int result = KMessageBox::warningContinueCancel(
mainWindow,
i18n("You are already connected to %1. Do you want to open another connection?", dupe->getDisplayName()),
i18n("Already connected to %1", dupe->getDisplayName()),
KGuiItem(i18n("Create connection")),
KStandardGuiItem::cancel(),
QString("ReuseExistingConnection"));
if (result == KMessageBox::Continue) doReuse = false;
}
if (dupe && doReuse)
{
if (interactive && dupeType == SameServerGroup
&& !(dupe->getConnectionSettings().server() == settings.server()))
{
int result = KMessageBox::warningContinueCancel(
mainWindow,
i18n("You are presently connected to %1 via '%2' (port <numid>%3</numid>). Do you want to switch to '%4' (port <numid>%5</numid>) instead?",
dupe->getDisplayName(),
dupe->getServerName(),
dupe->getPort(),
settings.server().host(),
settings.server().port()),
i18n("Already connected to %1", dupe->getDisplayName()),
KGuiItem(i18n("Switch Server")),
KStandardGuiItem::cancel(),
"ReconnectWithDifferentServer");
if (result == KMessageBox::Continue)
{
dupe->disconnectServer();
dupe->setConnectionSettings(settings);
}
}
if (!dupe->isConnected())
{
if (!settings.oneShotChannelList().isEmpty())
dupe->updateAutoJoin(settings.oneShotChannelList());
if (!dupe->isConnecting())
dupe->reconnectServer();
}
else
{
if (!settings.oneShotChannelList().isEmpty())
{
Konversation::ChannelList::ConstIterator it = settings.oneShotChannelList().constBegin();
Konversation::ChannelList::ConstIterator itend = settings.oneShotChannelList().constEnd();
for ( ; it != itend; ++it )
{
dupe->sendJoinCommand((*it).name(), (*it).password());
}
settings.clearOneShotChannelList();
}
}
}
//.........这里部分代码省略.........