// called via DBUS in all instances
void KonqCombo::insertPermanent( const QString& url )
{
    //kDebug() << "url=" << url;
    saveState();
    setTemporary( url );
    m_permanent = true;
    restoreState();
}
void KonqCombo::keyPressEvent( QKeyEvent *e )
{
    KHistoryComboBox::keyPressEvent( e );
    // we have to set it as temporary, otherwise we wouldn't get our nice
    // pixmap. Yes, QComboBox still sucks.
    KShortcut key( e->key() | e->modifiers() );
    if ( key == KStandardShortcut::rotateUp() ||
         key == KStandardShortcut::rotateDown() )
         setTemporary( currentText() );
}
void KonqCombo::removeURL( const QString& url )
{
    setUpdatesEnabled( false );
    lineEdit()->setUpdatesEnabled( false );

    removeFromHistory( url );
    applyPermanent();
    setTemporary( currentText() );

    setUpdatesEnabled( true );
    lineEdit()->setUpdatesEnabled( true );
    update();
}
void KonqCombo::restoreState()
{
    setTemporary( m_currentText );
    if (m_selectedText.isEmpty()) {
        lineEdit()->setCursorPosition( m_cursorPos );
    } else {
        const int index = m_currentText.indexOf(m_selectedText);
        if (index == -1) {
            lineEdit()->setCursorPosition( m_cursorPos );
        } else {
            lineEdit()->setSelection(index, m_selectedText.length());
        }
    }
}
void KonqCombo::setURL( const QString& url )
{
    //kDebug() << url << "returnPressed=" << m_returnPressed;
    setTemporary( url );

    if ( m_returnPressed ) { // Really insert...
        m_returnPressed = false;
        QDBusMessage message = QDBusMessage::createSignal( KONQ_MAIN_PATH, "org.kde.Konqueror.Main", "addToCombo" );
        message << url;
        QDBusConnection::sessionBus().send( message );
    }
    // important security consideration: always display the beginning
    // of the url rather than its end to prevent spoofing attempts.
    lineEdit()->setCursorPosition( 0 );
}
示例#6
0
void JabberRoomChat::participantChanged(const QString &id)
{
    auto jid = Jid::parse(id);
    auto contact = m_contactManager->byId(m_chat.chatAccount(), id, ActionCreateAndAdd);
    auto buddy = m_buddyManager->byContact(contact, ActionCreateAndAdd);
    buddy.setDisplay(jid.resource());
    buddy.setTemporary(true);

    auto status = m_presenceService->presenceToStatus(m_room->participantPresence(id));
    contact.setCurrentStatus(status);

    auto details = static_cast<ChatDetailsRoom *>(m_chat.details());
    if (status.isDisconnected())
        details->removeContact(contact);
    else
        details->addContact(contact);
}
示例#7
0
Message JabberRoomChatService::handleReceivedMessage(const QXmppMessage &xmppMessage) const
{
    auto jid = Jid::parse(xmppMessage.from());
    auto roomChat = getRoomChat(jid.bare());
    if (!roomChat)
        return Message::null;

    if (jid.resource() == roomChat->nick())   // message from myself
        return Message::null;

    auto contact = m_contactManager->byId(account(), jid.full(), ActionCreateAndAdd);
    auto buddy = m_buddyManager->byContact(contact, ActionCreateAndAdd);
    buddy.setDisplay(jid.resource());
    buddy.setTemporary(true);

    auto result = m_messageStorage->create();
    result.setMessageChat(roomChat->chat());
    result.setMessageSender(contact);

    return result;
}
void KonqCombo::setTemporary( const QString& text )
{
    setTemporary( text, KonqPixmapProvider::self()->pixmapFor(text) );
}