Ejemplo n.º 1
0
QString Kopete::PasswordedAccount::passwordPrompt()
{
	if ( password().isWrong() )
		return i18n( "<qt><b>The password was wrong.</b> Please re-enter your password for %1 account <b>%2</b></qt>", protocol()->displayName(), accountId() );
	else
		return i18n( "<qt>Please enter your password for %1 account <b>%2</b></qt>", protocol()->displayName(), accountId() );
}
Ejemplo n.º 2
0
void EditAccount::accept()
{
    QString name = accountNameInput->text();
    if ( name.trimmed().isEmpty() ) {
        name = mailServerInput->text();
        if ( name.trimmed().isEmpty() )
            name = smtpServerInput->text();
    }

    if (name.trimmed().isEmpty()) {
        int ret = QMessageBox::warning(this, tr("Empty account name"),
                tr("<qt>Do you want to continue and discard any changes?</qt>"),
                QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape);
        if (ret == QMessageBox::Yes)
            reject();
        return;
    }

    QMailAccountId accountId(account->id());

    if ( accountType->currentText() == "POP" )  {
        *account = QMailAccount::accountFromSource("pop3");
    } else if ( accountType->currentText() == "IMAP")  {
        *account = QMailAccount::accountFromSource("imap4");
    }

    account->setId( accountId );
    account->setAccountName( accountNameInput->text() );

    config->setEmailAddress( emailInput->text() );
    config->setUserName( nameInput->text() );
    config->setMailUserName( mailUserInput->text() );
    config->setMailPassword( mailPasswInput->text() );
    config->setMailServer( mailServerInput->text() );
    config->setSmtpServer( smtpServerInput->text() );
    config->setDeleteMail( deleteCheckBox->isChecked() );

    config->setUseSignature( sigCheckBox->isChecked() );
    config->setSignature( sig );

    if ( thresholdCheckBox->isChecked() ) {
        config->setMaxMailSize( maxSize->value() );
    } else {
        config->setMaxMailSize( -1 );
    }
    config->setPushEnabled( pushCheckBox->isChecked() );
    if ( intervalCheckBox->isChecked() )
        config->setCheckInterval( intervalPeriod->value() );
    else
        config->setCheckInterval( -intervalPeriod->value() );
    config->setIntervalCheckRoamingEnabled( !roamingCheckBox->isChecked() );
    if ( accountType->currentText() == "IMAP") 
        config->setBaseFolder( imapBaseDir->text() );

    QString temp;
    bool result;
    temp = mailPortInput->text();
    config->setMailPort( temp.toInt(&result) );
    if ( (!result) ) {
        // should only happen when the string is empty, since we use a validator.
        if (accountType->currentText() == "POP")
            config->setMailPort( 110 );
        else
            config->setMailPort( 143 );
    }

    temp = smtpPortInput->text();
    config->setSmtpPort( temp.toInt(&result) );
    // should only happen when the string is empty, since we use a validator.
    if ( !result )
        config->setSmtpPort( 25 );

    //try to guess email address
    if ( (!emailTyped) && (config->emailAddress().isEmpty()) ) {
        QString address = config->smtpServer();

        if ( address.count('.')) {
            config->setEmailAddress( config->mailUserName() + "@" +
            address.mid( address.indexOf('.') + 1, address.length() ) );
        } else if (address.count('.') == 1) {
            config->setEmailAddress( config->mailUserName() + "@" + address );
        }
    }

    //set an accountname
    if ( account->accountName().isEmpty() ) {
        int pos = name.indexOf('.');
        if ( pos != -1) {
            name = name.mid( pos + 1, name.length() );

            pos = name.indexOf('.', pos);
            if (pos != -1)
                name = name.mid(0, pos);
        }

        account->setAccountName( name );
    }

#ifndef QT_NO_OPENSSL
    config->setSmtpUsername(smtpUsernameInput->text());
    config->setSmtpPassword(smtpPasswordInput->text());
    config->setSmtpAuthentication(authenticationType[authentication->currentIndex()]);
    config->setSmtpEncryption(static_cast<AccountConfiguration::EncryptType>(encryption->currentIndex()));
    config->setMailEncryption(static_cast<AccountConfiguration::EncryptType>(encryptionIncoming->currentIndex()));
#endif

    QDialog::accept();
}
Ejemplo n.º 3
0
QVariant StandardServiceRoot::data(int column, int role) const {
  switch (role) {
    case Qt::ToolTipRole:
      if (column == FDS_MODEL_TITLE_INDEX) {
        return tr("This is service account for standard RSS/RDF/ATOM feeds.\n\nAccount ID: %1").arg(accountId());
      }
      else {
        return ServiceRoot::data(column, role);
      }

    default:
      return ServiceRoot::data(column, role);
  }
}
Ejemplo n.º 4
0
Kopete::MetaContact* Account::addContact( const QString &contactId, const QString &displayName , Group *group, AddMode mode  )
{

	if ( !protocol()->canAddMyself() && contactId == d->myself->contactId() )
	{
		if ( isConnected() && d->lastLoginTime.secsTo(QDateTime::currentDateTime()) > 30 )
		{
			KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Error,
			                               i18n("You are not allowed to add yourself to the contact list. The addition of \"%1\" to account \"%2\" will not take place.", contactId, accountId()), i18n("Error Creating Contact")
			                             );
		}
		else
		{
			kWarning(14010) << "You are not allowed to add yourself to the contact list. The addition of" << contactId
			                << "to account" << accountId() << "will not take place.";
		}
		return 0;
	}

	bool isTemporary = (mode == Temporary);

	Contact *c = d->contacts.value( contactId );

	if(!group)
		group=Group::topLevel();

	if ( c && c->metaContact() )
	{
		if ( c->metaContact()->isTemporary() && !isTemporary )
		{
			kDebug( 14010 ) <<  " You are trying to add an existing temporary contact. Just add it on the list";

			c->metaContact()->setTemporary(false, group );
			ContactList::self()->addMetaContact(c->metaContact());
		}
		else
		{
			// should we here add the contact to the parentContact if any?
			kDebug( 14010 ) << "Contact already exists";
		}
		return c->metaContact();
	}

	MetaContact *parentContact = new MetaContact();
	if(!displayName.isEmpty())
		parentContact->setDisplayName( displayName );

	//Set it as a temporary contact if requested
	if ( isTemporary )
		parentContact->setTemporary( true );
	else
		parentContact->addToGroup( group );

	if ( c )
	{
		c->setMetaContact( parentContact );
		if ( mode == ChangeKABC )
		{
			kDebug( 14010 ) << " changing KABC";
			KABCPersistence::self()->write( parentContact );
		}
	}
	else
	{
		if ( !createContact( contactId, parentContact ) )
		{
			delete parentContact;
			return 0L;
		}
	}

	ContactList::self()->addMetaContact( parentContact );
	return parentContact;
}