mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Disabled completer in private chat.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6484 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e9db631f8f
commit
dc29793da6
@ -70,6 +70,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||||||
isChatLobby = false;
|
isChatLobby = false;
|
||||||
firstShow = true;
|
firstShow = true;
|
||||||
inChatCharFormatChanged = false;
|
inChatCharFormatChanged = false;
|
||||||
|
completer = NULL;
|
||||||
|
|
||||||
lastStatusSendTime = 0 ;
|
lastStatusSendTime = 0 ;
|
||||||
|
|
||||||
@ -128,16 +129,6 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
resetStatusBar();
|
resetStatusBar();
|
||||||
|
|
||||||
completer = new QCompleter(this);
|
|
||||||
completer->setModel(modelFromPeers());
|
|
||||||
completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
|
|
||||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
completer->setWrapAround(false);
|
|
||||||
ui->chatTextEdit->setCompleter(completer);
|
|
||||||
ui->chatTextEdit->setCompleterKeyModifiers(Qt::ControlModifier);
|
|
||||||
ui->chatTextEdit->setCompleterKey(Qt::Key_Space);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidget::~ChatWidget()
|
ChatWidget::~ChatWidget()
|
||||||
@ -197,6 +188,15 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
|||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
|
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
|
||||||
updatePeersCustomStateString(QString::fromStdString(peerId), customStateString);
|
updatePeersCustomStateString(QString::fromStdString(peerId), customStateString);
|
||||||
} else {
|
} else {
|
||||||
|
completer = new QCompleter(this);
|
||||||
|
completer->setModel(modelFromPeers());
|
||||||
|
completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
|
||||||
|
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
completer->setWrapAround(false);
|
||||||
|
ui->chatTextEdit->setCompleter(completer);
|
||||||
|
ui->chatTextEdit->setCompleterKeyModifiers(Qt::ControlModifier);
|
||||||
|
ui->chatTextEdit->setCompleterKey(Qt::Key_Space);
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,13 +256,17 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
completionWord.clear();
|
completionWord.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((keyEvent->modifiers() & ui->chatTextEdit->getCompleterKeyModifiers()) && keyEvent->key() == ui->chatTextEdit->getCompleterKey()) {
|
|
||||||
completer->setModel(modelFromPeers());
|
if (completer) {
|
||||||
}
|
if ((keyEvent->modifiers() & ui->chatTextEdit->getCompleterKeyModifiers()) && keyEvent->key() == ui->chatTextEdit->getCompleterKey()) {
|
||||||
if (keyEvent->text()=="@") {
|
completer->setModel(modelFromPeers());
|
||||||
ui->chatTextEdit->forceCompleterShowNextKeyEvent("@");
|
}
|
||||||
completer->setModel(modelFromPeers());
|
if (keyEvent->text()=="@") {
|
||||||
}
|
ui->chatTextEdit->forceCompleterShowNextKeyEvent("@");
|
||||||
|
completer->setModel(modelFromPeers());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
|
if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
|
||||||
// Enter pressed
|
// Enter pressed
|
||||||
if (Settings->getChatSendMessageWithCtrlReturn()) {
|
if (Settings->getChatSendMessageWithCtrlReturn()) {
|
||||||
@ -417,41 +421,40 @@ void ChatWidget::completeNickname(bool reverse)
|
|||||||
|
|
||||||
QAbstractItemModel *ChatWidget::modelFromPeers()
|
QAbstractItemModel *ChatWidget::modelFromPeers()
|
||||||
{
|
{
|
||||||
// Find lobby we belong to
|
// Find lobby we belong to
|
||||||
const ChatLobbyInfo *lobby = NULL;
|
const ChatLobbyInfo *lobby = NULL;
|
||||||
std::list<ChatLobbyInfo> lobbies;
|
std::list<ChatLobbyInfo> lobbies;
|
||||||
rsMsgs->getChatLobbyList(lobbies);
|
rsMsgs->getChatLobbyList(lobbies);
|
||||||
|
|
||||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||||
std::string vpid;
|
std::string vpid;
|
||||||
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
||||||
if (vpid == peerId) {
|
if (vpid == peerId) {
|
||||||
lobby = &*lobbyIt;
|
lobby = &*lobbyIt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lobby)
|
|
||||||
return new QStringListModel(completer);
|
|
||||||
|
|
||||||
|
if (!lobby)
|
||||||
|
return new QStringListModel(completer);
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
#endif
|
#endif
|
||||||
// Get participants list
|
// Get participants list
|
||||||
QStringList participants;
|
QStringList participants;
|
||||||
for ( std::map<std::string,time_t>::const_iterator it = lobby->nick_names.begin();
|
for ( std::map<std::string,time_t>::const_iterator it = lobby->nick_names.begin();
|
||||||
it != lobby->nick_names.end();
|
it != lobby->nick_names.end();
|
||||||
it++) {
|
it++) {
|
||||||
participants.push_front(QString::fromUtf8(it->first.c_str()));
|
participants.push_front(QString::fromUtf8(it->first.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
return new QStringListModel(participants, completer);
|
return new QStringListModel(participants, completer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::addToolsAction(QAction *action)
|
void ChatWidget::addToolsAction(QAction *action)
|
||||||
|
Loading…
Reference in New Issue
Block a user