void Account::setMyself( Contact *myself ) { Q_ASSERT( !d->myself ); d->myself = myself; QObject::connect( d->myself, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)), this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) ); QObject::connect( d->myself, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)), this, SLOT(slotContactPropertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)) ); if ( isConnected() ) emit isConnectedChanged(); }
void Account::slotOnlineStatusChanged( Contact * /* contact */, const OnlineStatus &newStatus, const OnlineStatus &oldStatus ) { const bool wasOffline = !oldStatus.isDefinitelyOnline(); const bool isOffline = !newStatus.isDefinitelyOnline(); d->suspended = false; if ( wasOffline && !isOffline ) d->lastLoginTime = QDateTime::currentDateTime(); // If we went offline we have to ensure that all of our contacts // are online too. Otherwise the "Last Seen" tooltip won't work // properly. See bug 266580. if ( !wasOffline && isOffline ) setAllContactsStatus( Kopete::OnlineStatus::Offline ); if ( wasOffline || newStatus.status() == OnlineStatus::Offline ) { // Wait for twenty seconds until we treat status notifications for contacts // as unrelated to our own status change. // Twenty seconds may seem like a long time, but just after your own // connection it's basically neglectible, and depending on your own // contact list's size, the protocol you are using, your internet // connection's speed and your computer's speed you *will* need it. d->suppressStatusNotification = true; d->suppressStatusTimer.setSingleShot( true ); d->suppressStatusTimer.start( 20000 ); //the timer is also used to reset the d->connectionTry } if ( !isOffline ) { d->restoreStatus = newStatus; d->restoreMessage.setTitle( myself()->property( Kopete::Global::Properties::self()->statusTitle() ).value().toString() ); d->restoreMessage.setMessage( myself()->property( Kopete::Global::Properties::self()->statusMessage() ).value().toString() ); } /* kDebug(14010) << "account " << d->id << " changed status. was " << Kopete::OnlineStatus::statusTypeToString(oldStatus.status()) << ", is " << Kopete::OnlineStatus::statusTypeToString(newStatus.status()) << endl;*/ if ( wasOffline != isOffline ) emit isConnectedChanged(); }
JabberBookmarks::JabberBookmarks(JabberAccount *parent) : QObject(parent) , m_account(parent) { connect( m_account , SIGNAL(isConnectedChanged()) , this , SLOT(accountConnected()) ); }