void TlenEditAccountWidget::apply()
{
	account()->setConnectAtStart(ConnectAtStart->isChecked());
	account()->setId(AccountId->text());
	account()->setRememberPassword(RememberPassword->isChecked());
	account()->setPassword(AccountPassword->text());
}
示例#2
0
文件: chatdlg.cpp 项目: hummbl/psi
void ChatDlg::dropEvent(QDropEvent* event)
{
	QStringList l;
	if (account()->loggedIn() && Q3UriDrag::decodeLocalFiles(event, l) && !l.isEmpty()) {
		account()->actionSendFiles(jid(), l);
	}
}
void TlenEditAccountWidget::removeAccount()
{
	QMessageBox *messageBox = new QMessageBox(this);
	messageBox->setWindowTitle(tr("Confirm account removal"));
	messageBox->setText(tr("Are you sure do you want to remove account %1 (%2)")
			.arg(account()->name())
			.arg(account()->id()));

	messageBox->addButton(tr("Remove account"), QMessageBox::AcceptRole);
	messageBox->addButton(tr("Remove account and unregister from server"), QMessageBox::DestructiveRole);
	messageBox->addButton(QMessageBox::Cancel);

	switch (messageBox->exec())
	{
		case QMessageBox::AcceptRole:
			AccountManager::instance()->unregisterAccount(account());
			deleteLater();
			break;

		case QMessageBox::DestructiveRole:
			// not implemented
			break;
	}

	delete messageBox;
}
示例#4
0
bool MrimContact::event(QEvent *ev)
{
	if (ev->type() == ChatStateEvent::eventType()) {
		ChatStateEvent *chatEvent = static_cast<ChatStateEvent *>(ev);
		bool isComposing = chatEvent->chatState() == ChatUnit::ChatStateComposing;
		if (p->composingTimer.isActive() == isComposing)
			return true;
		if (isComposing) {
			// We should send composing notification every 10 secs
			p->composingTimer.start(10000, this);
			account()->connection()->messages()->sendComposingNotification(this);
		} else {
			p->composingTimer.stop();
		}
		return true;
	} else if(ev->type() == Authorization::Reply::eventType()) {
		Authorization::Reply *reply = static_cast<Authorization::Reply*>(ev);
		if(reply->replyType() != Authorization::Reply::Accept)
			return true;
		MrimPacket packet(MrimPacket::Compose);
		packet.setMsgType(MRIM_CS_AUTHORIZE);
		packet.append(p->email);
		account()->connection()->sendPacket(packet);
		return true;
	}
	return Contact::event(ev);
}
void TlenEditAccountWidget::loadAccountData()
{
	ConnectAtStart->setChecked(account()->connectAtStart());
	AccountId->setText(account()->id());
	RememberPassword->setChecked(account()->rememberPassword());
	AccountPassword->setText(account()->password());
}
示例#6
0
void GaduFileTransfer::send()
{
	if (FileTransfer::TypeSend != transferType()) // maybe assert here?
		return;

	if (SocketNotifiers || WaitingForSocketNotifiers) // already sending/receiving
		return;

	setRemoteFile(QString::null);

	if (!account() || localFileName().isEmpty())
	{
		changeFileTransferStatus(FileTransfer::StatusNotConnected);
		return; // TODO: notify
	}

	GaduProtocol *gaduProtocol = dynamic_cast<GaduProtocol *>(account()->protocol());
	if (!gaduProtocol)
	{
		changeFileTransferStatus(FileTransfer::StatusNotConnected);
		return;
	}

	GaduContactAccountData *gcad = gaduProtocol->gaduContactAccountData(contact());
	if (!gcad)
	{
		changeFileTransferStatus(FileTransfer::StatusNotConnected);
		return;
	}

	// async call, will return in setFileTransferNotifiers
	changeFileTransferStatus(FileTransfer::StatusWaitingForConnection);
	WaitingForSocketNotifiers = true;
	gaduProtocol->dccManager()->attachSendFileTransferSocket(this);
}
示例#7
0
bool MrimContact::sendMessage(const Message &message)
{
	if (account()->status() == Status::Offline)
		return false;
    account()->connection()->messages()->send(this, message);
	return true;
}
示例#8
0
void GaduProtocol::sendStatusToServer()
{
    if (!isConnected() && !isDisconnecting())
        return;

    if (!GaduSession)
        return;

    // some services have per-status configuration
    configureServices();

    Status newStatus = status();

    int friends = account().privateStatus() ? GG_STATUS_FRIENDS_MASK : 0;

    int type = GaduProtocolHelper::gaduStatusFromStatus(newStatus);
    bool hasDescription = !newStatus.description().isEmpty();

    setStatusFlags();

    m_lastSentStatus = newStatus;
    auto writableSessionToken = Connection->writableSessionToken();
    if (hasDescription)
        gg_change_status_descr(
            writableSessionToken.rawSession(), type | friends, newStatus.description().toUtf8().constData());
    else
        gg_change_status(writableSessionToken.rawSession(), type | friends);

    account().accountContact().setCurrentStatus(status());
}
示例#9
0
void AccountItem::generateIcon()
{
    kDebug();

    QString iconPath = account()->iconName();

    //if the icon has not been setted, we use the protocol icon    
    if(iconPath.isEmpty()) {
        iconPath = QString("im-%1").arg(account()->protocolName());
    }

    delete m_icon;
    m_icon = new KIcon(iconPath);

    if(!account()->isValid()) {
        //we paint a warning symbol in the right-bottom corner
        QPixmap pixmap = m_icon->pixmap(32, 32);
        QPainter painter(&pixmap);
        KIcon("dialog-error").paint(&painter, 15, 15, 16, 16);

        delete m_icon;
        m_icon = new KIcon(pixmap);
    }

    Q_EMIT(updated());
}
void JabberEditAccountWidget::loadAccountData()
{
	Identities->setCurrentIdentity(account().accountIdentity());
	AccountId->setText(account().id());
	RememberPassword->setChecked(account().rememberPassword());
	AccountPassword->setText(account().password());
}
示例#11
0
void AccountState::checkConnectivity()
{
    if (isSignedOut() || _waitingForNewCredentials) {
        return;
    }

    ConnectionValidator * conValidator = new ConnectionValidator(account());
    connect(conValidator, SIGNAL(connectionResult(ConnectionValidator::Status,QStringList)),
            SLOT(slotConnectionValidatorResult(ConnectionValidator::Status,QStringList)));
    if (isConnected()) {
        // Use a small authed propfind as a minimal ping when we're
        // already connected.
        conValidator->checkAuthentication();
    } else {
        // Check the server and then the auth.

#ifdef Q_OS_WIN
        // There seems to be a bug in Qt on Windows where QNAM sometimes stops
        // working correctly after the computer woke up from sleep. See #2895 #2899
        // and #2973.
        // As an attempted workaround, reset the QNAM regularly if the account is
        // disconnected.
        account()->resetNetworkAccessManager();
#endif
        conValidator->checkServerAndAuth();
    }
}
示例#12
0
QPtrList<KAction> *AIMContact::customContextMenuActions()
{

	QPtrList<KAction> *actionCollection = new QPtrList<KAction>();
	if ( !m_warnUserAction )
	{
		m_warnUserAction = new KAction( i18n( "&Warn User" ), 0, this, SLOT( warnUser() ), this, "warnAction" );
	}
	m_actionVisibleTo = new KToggleAction(i18n("Always &Visible To"), "", 0,
	                                      this, SLOT(slotVisibleTo()), this, "actionVisibleTo");
	m_actionInvisibleTo = new KToggleAction(i18n("Always &Invisible To"), "", 0,
	                                        this, SLOT(slotInvisibleTo()), this, "actionInvisibleTo");
	
	bool on = account()->isConnected();

	m_warnUserAction->setEnabled( on );

	m_actionVisibleTo->setEnabled(on);
	m_actionInvisibleTo->setEnabled(on);

	SSIManager* ssi = account()->engine()->ssiManager();
	m_actionVisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_VISIBLE ));
	m_actionInvisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_INVISIBLE ));

	actionCollection->append( m_warnUserAction );

	actionCollection->append(m_actionVisibleTo);
	actionCollection->append(m_actionInvisibleTo);


	return actionCollection;
}
Kopete::Account*
GaduEditAccount::apply()
{
	publishUserInfo();
	
	if ( account() == NULL ) {
		setAccount( new GaduAccount( protocol_, loginEdit_->text() ) );
		account_ = static_cast<GaduAccount*>( account() );
	}

	account_->setExcludeConnect( autoLoginCheck_->isChecked() );

	passwordWidget_->save( &account_->password() );

	account_->myself()->setNickName( nickName->text() );

	// this is changed only here, so i won't add any proper handling now
        account_->configGroup()->writeEntry( QString::fromAscii( "nickName" ), nickName->text() );

	account_->setExcludeConnect( autoLoginCheck_->isChecked() );
	account_->setUseTls( (GaduAccount::tlsConnection) useTls_->currentIndex() );
	account_->setExportListOnChange(exportCheck_->isChecked());
	account_->setImportListOnLogin(importCheck_->isChecked());

	account_->setIgnoreAnons( ignoreCheck_->isChecked() );

	if ( account_->setDcc( dccCheck_->isChecked() ) == false ) {
		KMessageBox::sorry( this, i18n( "<b>Starting DCC listening socket failed; dcc is not working now.</b>" ), i18n( "Gadu-Gadu" ) );
	}

	return account();
}
示例#14
0
void JabberTransport::eatContacts( )
{
	/*
	* "Gateway Contact Eating" (c)(r)(tm)(g)(o)(f)
	* this comes directly from my mind into the kopete code.
	* principle: - the transport is hungry
	*            - it will eat contacts which belong to him
	*            - the contact will die
	*            - a new contact will born, with the same characteristics, but owned by the transport
	* - Olivier 2006-01-17 -
	*/
	kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << endl;
	QDict<Kopete::Contact> cts=account()->contacts();
	QDictIterator<Kopete::Contact> it( cts ); 
	for( ; it.current(); ++it )
	{
		JabberContact *contact=dynamic_cast<JabberContact*>(it.current());
		if( contact && !contact->transport() && contact->rosterItem().jid().domain() == myself()->contactId() && contact != account()->myself())
		{
			XMPP::RosterItem item=contact->rosterItem();
			Kopete::MetaContact *mc=contact->metaContact();
			Kopete::OnlineStatus status = contact->onlineStatus();
			kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << item.jid().full() << " will be soon eat  - " << contact << endl;
			delete contact;
			Kopete::Contact *c2=account()->contactPool()->addContact( item , mc , false ); //not sure this is false;
			if(c2)
				c2->setOnlineStatus( status ); //put back the old status
		}
	}
}
void skypeEditAccount::configureSkypeClient() {
	kDebug(SKYPE_DEBUG_GLOBAL);

	if ( ! account() )
		setAccount(new SkypeAccount(d->protocol, "Skype"));

	QByteArray authAppName = ( static_cast <SkypeAccount *> (account()) )->author.toUtf8();

	if ( authAppName.isEmpty() )
		authAppName = "Kopete";

	QString skypeUser = ( static_cast <SkypeAccount *> (account()) )->getMyselfSkypeName();

	if ( skypeUser.isEmpty() )
		skypeUser = KInputDialog::getText(i18n("Configure Skype client"), i18n("Please enter your skype user name"));

	if ( skypeUser.isEmpty() ) {
		KMessageBox::error(this, i18n("You must enter your skype user name"), i18n("Skype protocol"));
		return;
	}

	const QString &skypeDir = QString("%1/.Skype").arg(QDir::homePath());
	QDir dir(skypeDir);

	if ( ! dir.exists(skypeDir) )
		dir.mkpath(skypeDir);

	const QString &sharedPath = QString("%1/shared.xml").arg(skypeDir);
	QFile sharedFile(sharedPath);

	if ( ! sharedFile.open(QIODevice::WriteOnly) ) {
		kDebug(SKYPE_DEBUG_GLOBAL) << "Cant create/open file" << sharedPath;
		KMessageBox::error(this, i18n("Cannot create/open file %1 for configuring the Skype client.", sharedPath), i18n("Skype protocol"));
		return;
	}

	sharedFile.reset();
	sharedFile.write("<?xml version=\"1.0\"?>\n<config version=\"1.0\" serial=\"9\" timestamp=\"0\">\n  <UI>\n    <Installed>2</Installed>\n    <Language>en</Language>\n    <SavePassword>1</SavePassword>\n    <StartMinimized>1</StartMinimized>\n  </UI>\n</config>\n"); //This only works with Linux Skype Client versions: 2.0.0.72 2.1.0.47 2.1.0.81
	sharedFile.close();

	const QString &userDir = QString("%1/%2").arg(skypeDir).arg(skypeUser);
	if ( ! dir.exists(userDir) )
		dir.mkpath(userDir);

	const QString &configPath = QString("%1/config.xml").arg(userDir);
	QFile configFile(configPath);

	if ( ! configFile.open(QIODevice::WriteOnly) ) {
		kDebug(SKYPE_DEBUG_GLOBAL) << "Cant create/open file" << configPath;
		KMessageBox::error(this, i18n("Cannot create/open file %1 for configuring the Skype client.", configPath), i18n("Skype protocol"));
		return;
	}

	configFile.reset();
	configFile.write("<?xml version=\"1.0\"?>\n<config version=\"1.0\" serial=\"9\" timestamp=\"0\">\n  <UI>\n    <API>\n      <Authorizations>" + authAppName + "</Authorizations>\n    </API>\n    <Notifications>\n      <Enable>\n        <Birthday>0</Birthday>\n        <CallAnswered>1</CallAnswered>\n        <CallBusy>1</CallBusy>\n        <CallFailed>1</CallFailed>\n        <CallHangup>1</CallHangup>\n        <CallHold>1</CallHold>\n        <CallMissed>1</CallMissed>\n        <CallRemoteHangup>1</CallRemoteHangup>\n        <CallResume>1</CallResume>\n        <CallRingingIn>1</CallRingingIn>\n        <CallRingingOut>1</CallRingingOut>\n        <ChatIncoming>0</ChatIncoming>\n        <ChatIncomingInitial>0</ChatIncomingInitial>\n        <ChatJoined>0</ChatJoined>\n        <ChatOutgoing>0</ChatOutgoing>\n        <ChatParted>0</ChatParted>\n        <ContactAdded>0</ContactAdded>\n        <ContactAuthRequest>0</ContactAuthRequest>\n        <ContactDeleted>0</ContactDeleted>\n        <ContactOffline>0</ContactOffline>\n        <ContactOnline>0</ContactOnline>\n        <SkypeLogin>0</SkypeLogin>\n        <SkypeLoginFailed>0</SkypeLoginFailed>\n        <SkypeLogout>0</SkypeLogout>\n        <TransferComplete>1</TransferComplete>\n        <TransferFailed>1</TransferFailed>\n        <VoicemailReceived>1</VoicemailReceived>\n        <VoicemailSent>1</VoicemailSent>\n      </Enable>\n    </Notifications>\n    <Notify>\n      <Call>0</Call>\n    </Notify>\n  </UI>\n</config>\n"); //This only works with Linux Skype Client versions: 2.0.0.72 2.1.0.47 2.1.0.81
	configFile.close();

	KMessageBox::information(this, i18n("Process has completed.\nSkype is now configured for Kopete.\nYou must restart the Skype client for changes to take effect."), i18n("Skype protocol"));
}
示例#16
0
void MainEngine::hideLangs()
{
    logic(isInitialized_);
    QList<QVariant> list;
    list = fAc_->getListNamesLL(account());
    list.append(fAc_->getNameLK(account()));
    adapterLanguages_->hideRows(std::move(list));
}
示例#17
0
文件: chatdlg.cpp 项目: hummbl/psi
void ChatDlg::updateContact(const Jid &j, bool fromPresence)
{
	// if groupchat, only update if the resource matches
	if (account()->findGCContact(j) && !jid().compare(j)) {
		return;
	}

	if (jid().compare(j, false)) {
		QList<UserListItem*> ul = account()->findRelevant(j);
		UserStatus userStatus = userStatusFor(jid(), ul, false);
		if (userStatus.statusType == XMPP::Status::Offline)
			contactChatState_ = XMPP::StateNone;

		bool statusChanged = false;
		if (status_ != userStatus.statusType || statusString_ != userStatus.status) {
			statusChanged = true;
			status_ = userStatus.statusType;
			statusString_ = userStatus.status;
		}

		contactUpdated(userStatus.userListItem, userStatus.statusType, userStatus.status);

		if (userStatus.userListItem) {
			dispNick_ = JIDUtil::nickOrJid(userStatus.userListItem->name(), userStatus.userListItem->jid().full());
			nicksChanged();
			invalidateTab();

			key_ = userStatus.publicKeyID;
			updatePGP();

			if (fromPresence && statusChanged) {
				QString msg = tr("%1 is %2").arg(Qt::escape(dispNick_)).arg(status2txt(status_));
				if (!statusString_.isEmpty()) {
					QString ss = TextUtil::linkify(TextUtil::plain2rich(statusString_));
					if (PsiOptions::instance()->getOption("options.ui.emoticons.use-emoticons").toBool()) {
						ss = TextUtil::emoticonify(ss);
					}
					if (PsiOptions::instance()->getOption("options.ui.chat.legacy-formatting").toBool()) {
						ss = TextUtil::legacyFormat(ss);
					}
					msg += QString(" [%1]").arg(ss);
				}
				appendSysMsg(msg);
			}
		}

		// Update capabilities
		capsChanged(jid());

		// Reset 'is composing' event if the status changed
		if (statusChanged && contactChatState_ != XMPP::StateNone) {
			if (contactChatState_ == XMPP::StateComposing || contactChatState_ == XMPP::StateInactive) {
				setContactChatState(XMPP::StatePaused);
			}
		}
	}
}
示例#18
0
文件: chatdlg.cpp 项目: hummbl/psi
void ChatDlg::setJid(const Jid &j)
{
	if (!j.compare(jid())) {
		account()->dialogUnregister(this);
		TabbableWidget::setJid(j);
		account()->dialogRegister(this, jid());
		updateContact(jid(), false);
	}
}
示例#19
0
void WContact::updateStatus()
{
	if (account()->getShowStatusRow()) {
		account()->update(this, false);
	} else {
		Status current = m_status;
		m_status.setText(QString());
		emit statusChanged(m_status, current);
	}
}
示例#20
0
void Contact::slotAccountIsConnectedChanged()
{
	if ( this == account()->myself() )
		return;

	if ( account()->isConnected() )
		emit onlineStatusChanged( this, d->onlineStatus, protocol()->accountOfflineStatus() );
	else
		emit onlineStatusChanged( this, protocol()->accountOfflineStatus(), d->onlineStatus );
}
示例#21
0
void SmtpClient::accountsUpdated(const QMailAccountIdList &ids)
{
    if (!ids.contains(account()))
        return;

    QMailAccount acc(account());
    bool isEnabled(acc.status() & QMailAccount::Enabled);
    if (!isEnabled)
        return;
    setAccount(account());
}
示例#22
0
void GaduProtocol::afterLoggedIn()
{
    m_gaduContactAvatarService->download(ContactAvatarId{{account().accountContact().id().toUtf8()}, {}});

    auto contacts = contactManager()->contacts(account(), ContactManager::ExcludeAnonymous);
    CurrentNotifyService->sendInitialData(contacts);

    static_cast<GaduRosterService *>(rosterService())->prepareRoster();

    sendStatusToServer();
}
示例#23
0
void MainEngine::setAccount(const spNode& node)
{
    logic(isInitialized_);
    argument(node);

    adapterLL_->setNode(node);
    curAccount_ = node;
    view_->setNameUser(fAc_->getNameUser(account()));
    view_->setNameLK(fAc_->getNameLK(account()));
    hideLangs();
    setCurLL(fAc_->getNameCurLL(account()));
}
SIM::Account *skypeEditAccount::apply() {
	kdDebug(14311) << k_funcinfo << endl;//some debug info

	//first, I need a pointer to that account
	if (!account()) //it does not exist
		setAccount(new SkypeAccount(d->protocol));//create a new one
	SkypeAccount *skype = static_cast<SkypeAccount *>(account());//get the account

	//set it's values
	skype->setExcludeConnect(excludeCheck->isChecked());//Save the "exclude from connection" setup
	skype->launchType = LaunchGroup->selectedId();//get the type how to launch skype
	if (AuthorCheck->isChecked())
		skype->author = AuthorEdit->text();//put there what user wrote
	else
		skype->author = "";//nothing unusual
	skype->setHitchHike(HitchCheck->isChecked());//save the hitch hike mode and activat ethe new value
	skype->setMarkRead(MarkCheck->isChecked());//set the mark read messages mode and activate it
	skype->setScanForUnread(ScanCheck->isChecked());
	skype->setCallControl(CallCheck->isChecked());
	skype->setPings(PingsCheck->isChecked());
	skype->setBus(BusGroup->selectedId());
	skype->setStartDBus(DBusCheck->isChecked());
	skype->setLaunchTimeout(LaunchSpin->value());
	skype->setSkypeCommand(CommandEdit->text());
	skype->setWaitBeforeConnect(WaitSpin->value());
	skype->setLeaveOnExit(LeaveCheck->isChecked());
	if (AutoCloseCallCheck->isChecked()) {
		skype->setCloseWindowTimeout(CloseTimeoutSpin->value());
	} else {
		skype->setCloseWindowTimeout(0);
	}
	if (StartCallCommandCheck->isChecked()) {
		skype->setStartCallCommand(StartCallCommandEdit->text());
	} else {
		skype->setStartCallCommand("");
	}
	skype->setWaitForStartCallCommand(WaitForStartCallCommandCheck->isChecked());
	if (EndCallCommandCheck->isChecked()) {
		skype->setEndCallCommand(EndCallCommandEdit->text());
	} else {
		skype->setEndCallCommand("");
	}
	if (IncomingCommandCheck->isChecked()) {
		skype->setIncomingCommand(IncomingCommandEdit->text());
	} else {
		skype->setIncomingCommand("");
	}

	skype->setEndCallCommandOnlyForLast(OnlyLastCallCommandCheck->isChecked());
	skype->save();//save it to config
	return skype;//return the account
}
示例#25
0
// Fill a direct offer.
//   @param offer the offer we are going to use.
//   @param amount the amount to flow through the offer.
//   @returns: tesSUCCESS if successful, or an error code otherwise.
TER
Taker::fill (Offer const& offer, Amounts const& amount)
{
    consume (offer, amount);

    // Pay the taker, then the owner
    TER result = view ().accountSend (offer.account(), account(), amount.out);

    if (result == tesSUCCESS)
        result = view ().accountSend (account(), offer.account(), amount.in);

    return result;
}
示例#26
0
// Performs funds transfers to fill the given offer and adjusts offer.
TER
Taker::fill (BasicTaker::Flow const& flow, Offer const& offer)
{
    // adjust offer
    consume_offer (offer, flow.order);

    TER result = tesSUCCESS;

    if (cross_type () != CrossType::XrpToIou)
    {
        assert (!isXRP (flow.order.in));

        if(result == tesSUCCESS)
            result = redeemIOU (account (), flow.issuers.in, flow.issuers.in.issue ());

        if (result == tesSUCCESS)
            result = issueIOU (offer.owner (), flow.order.in, flow.order.in.issue ());
    }
    else
    {
        assert (isXRP (flow.order.in));

        if (result == tesSUCCESS)
            result = transferXRP (account (), offer.owner (), flow.order.in);
    }

    // Now send funds from the account whose offer we're taking
    if (cross_type () != CrossType::IouToXrp)
    {
        assert (!isXRP (flow.order.out));

        if(result == tesSUCCESS)
            result = redeemIOU (offer.owner (), flow.issuers.out, flow.issuers.out.issue ());

        if (result == tesSUCCESS)
            result = issueIOU (account (), flow.order.out, flow.order.out.issue ());
    }
    else
    {
        assert (isXRP (flow.order.out));

        if (result == tesSUCCESS)
            result = transferXRP (offer.owner (), account (), flow.order.out);
    }

    if (result == tesSUCCESS)
        direct_crossings_++;

    return result;
}
示例#27
0
void
WlmContact::receivedMessage (const QString & message)
{
    // Create a Kopete::Message
    Kopete::ContactPtrList contactList;
    account ();
    contactList.append (account ()->myself ());
    Kopete::Message newMessage (this, contactList);
    newMessage.setPlainBody (message);
    newMessage.setDirection (Kopete::Message::Inbound);

    // Add it to the manager
    manager ()->appendMessage (newMessage);
}
示例#28
0
void TestbedContact::receivedMessage( const QString &message )
{
    // Create a Kopete::Message
    Kopete::Message *newMessage;
    Kopete::ContactPtrList contactList;
    account();
    contactList.append( account()->myself() );
    newMessage = new Kopete::Message( this, contactList, message, Kopete::Message::Inbound );

    // Add it to the manager
    manager()->appendMessage (*newMessage);

    delete newMessage;
}
示例#29
0
Kopete::Account *WPEditAccount::apply()
{
	kDebug(14170) << "WPEditAccount::apply()";

	if(!account())
		setAccount(new WPAccount(mProtocol, mHostName->text()));

//	account()->setExcludeConnect(mAutoConnect->isChecked());
	writeConfig();

	mProtocol->settingsChanged();

	return account();
}
GaduEditAccount::GaduEditAccount( GaduProtocol* proto, Kopete::Account* ident, QWidget* parent )
: QWidget( parent ), KopeteEditAccountWidget( ident ), protocol_( proto ), rcmd( 0 )
{
	setupUi(this);

#ifdef __GG_LIBGADU_HAVE_OPENSSL
	isSsl = true;
#else
	isSsl = false;
#endif

	useTls_->setDisabled( !isSsl );

	if ( account() == NULL ) {
		useTls_->setCurrentIndex( GaduAccount::TLS_no );
		registerNew->setEnabled( true );
		account_ = NULL;
	}
	else {
		account_ = static_cast<GaduAccount*>(ident);

		registerNew->setDisabled( true );
		loginEdit_->setReadOnly( true );
		loginEdit_->setText( account_->accountId() );

		passwordWidget_->load( &account_->password() );

		nickName->setText( account_->myself()->nickName() );

		autoLoginCheck_->setChecked( account_->excludeConnect() );
		dccCheck_->setChecked( account_->dccEnabled() );
		useTls_->setCurrentIndex( isSsl ? ( account_->useTls() ) : 2 );
		ignoreCheck_->setChecked( account_->ignoreAnons() );
		exportCheck_->setChecked( account_->exportListOnChange() );
		importCheck_->setChecked( account_->importListOnLogin() );

		connect( account(), SIGNAL(pubDirSearchResult(SearchResult,uint)),
					SLOT(slotSearchResult(SearchResult,uint)) );
		connectLabel->setText( i18nc( "personal information being fetched from server",
					"<p align=\"center\">Fetching from server</p>" ) );
		seqNr = account_->getPersonalInformation();
	}

	connect( registerNew, SIGNAL(clicked()), SLOT(registerNewAccount()) );

	QWidget::setTabOrder( loginEdit_, passwordWidget_->mRemembered );
	QWidget::setTabOrder( passwordWidget_->mRemembered, passwordWidget_->mPassword );
	QWidget::setTabOrder( passwordWidget_->mPassword, autoLoginCheck_ );
}