void ProfileManageDlg::slotProfileRename()
{
	int x = lbx_profiles->currentItem();
	if(x == -1)
		return;

	QString oldname = lbx_profiles->text(x);
	QString name;

	while(1) {
		bool ok = FALSE;
		name = QInputDialog::getText(CAP(tr("Rename Profile")), tr("Please enter a new name for the profile.  Keep it simple.\nOnly use letters or numbers.  No punctuation or spaces."), QLineEdit::Normal, name, &ok, this);
		if(!ok)
			return;

		if(profileExists(name)) {
			QMessageBox::information(this, CAP(tr("Rename Profile")), tr("There is already another profile with this name.  Please choose another."));
			continue;
		}
		else if(!profileRename(oldname, name)) {
			QMessageBox::information(this, CAP(tr("Rename Profile")), tr("Unable to rename the profile.  Please do not use any special characters."));
			continue;
		}
		break;
	}

	lbx_profiles->changeItem(name, x);
}
Пример #2
0
void ProfileNewDlg::slotCreate()
{
	name = le_name->text();

	if(profileExists(name)) {
		QMessageBox::information(this, CAP(tr("New Profile")), tr("There is already an existing profile with this name.  Please choose another."));
		return;
	}

	if(!profileNew(name)) {
		QMessageBox::information(this, CAP(tr("New Profile")), tr("Unable to create the profile.  Please do not use any special characters."));
		return;
	}

	// save config
	PsiOptions o;
	
	if (!o.newProfile()) {
		qWarning("ERROR: Failed to new profile default options");
	}
	
	
	o.setOption("options.messages.default-outgoing-message-type" ,rb_message->isChecked() ? "message": "chat");
	o.setOption("options.ui.emoticons.use-emoticons" ,ck_useEmoticons->isChecked());
	o.save(pathToProfile(name) + "/options.xml");
	
	accept();
}
QgsUserProfile *QgsUserProfileManager::getProfile( const QString &defaultProfile, bool createNew, bool initSettings )
{
  QString profileName = defaultProfile.isEmpty() ? defaultProfileName() : defaultProfile;

  if ( createNew && !profileExists( defaultProfile ) )
  {
    createUserProfile( profileName );
  }

  QgsUserProfile *profile = profileForName( profileName );
  if ( initSettings )
    profile->initSettings();

  return profile;
}
// ---------------------------------------------------------------------------
// VoIPProfilesExistL - API method
// Returns ETrue if VoIP sub service plugin ID have been set for some service.
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CSPSettingsVoIPUtils::VoIPProfilesExistL() const
    {
    XSPSLOGSTRING( 
        "CSPSettingsVoIPUtils::VoIPProfilesExistL() - IN" );

    TBool profileExists( EFalse );

    // Get all service IDs
    RArray<TServiceId> services;
    CleanupClosePushL( services );
    iSettingsEngine->FindServiceIdsL( services );
    const TInt count( services.Count() );

    // Check if some service has VoIP sub service plug-in ID
    TInt err( 0 );
    CSPProperty* property = CSPProperty::NewLC();
    for( TInt i = 0; i < count && !profileExists; ++i )
        {
        TServiceId id = services[ i ];
        if( id == KSPDefaultVoIPServiceId )
            {
            continue;
            }
            
        err = iSettingsEngine->FindPropertyL( id,
                                              EPropertyVoIPSubServicePluginId,
                                              *property );

        profileExists = ( KErrNone == err ? ETrue : EFalse );
        }

    CleanupStack::PopAndDestroy( property );
    CleanupStack::PopAndDestroy( &services );


    XSPSLOGSTRING( 
        "CSPSettingsVoIPUtils::VoIPProfilesExistL() - OUT" );
    return profileExists;
    }
Пример #5
0
bool ProfileDB::removeProfile(int profileID)
{
    bool success = false;

    if (profileExists(profileID))
    {
        QSqlQuery queryDelete(QSqlDatabase::database(connectionName));
        queryDelete.prepare("DELETE FROM Profiles WHERE ProfileID = (:ProfileID)");
        queryDelete.bindValue(":ProfileID", profileID);
        success = queryDelete.exec();

        if(!success)
        {
            //qDebug() << "remove profile failed: " << queryDelete.lastError();
        }
    }
    else
    {
        //qDebug() << "remove profile failed: profile doesnt exist";
    }

    return success;
}