Esempio n. 1
0
// This method is called after the password was successfully stored into the
// QKeyChain in CredentialStore.
void MirallConfigFile::clearPasswordFromConfig( const QString& connection )
{
    const QString file = configFile();
    QString con( defaultConnection() );
    if( !connection.isEmpty() )
        con = connection;

    QSettings settings( file, QSettings::IniFormat);
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );
    settings.remove(QLatin1String("passwd"));
    settings.remove(QLatin1String("password"));
    settings.sync();
}
Esempio n. 2
0
void dfs(int x){
 if(x == 3) 
  x = 3;
 int u = 0;
 ++top;stk[top] = x;
 while(top - (1<<u) > 0) {f[x][u] = stk[top-(1<<u)]; ++u; }
 rt[x] = rt[f[x][0]];
 add(con(x),a[lk[fa[x]].x].v,double(a[lk[fa[x]].x].w)*double(lk[fa[x]].len));
 TRA(i,x){
   lk[i^1].f = 1;
   fa[lk[i].v] = i;
   dep[lk[i].v] = dep[x]+1;
   dfs(lk[i].v);
 }
Esempio n. 3
0
QString MirallConfigFile::ownCloudUser( const QString& connection ) const
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    QSettings settings( configFile(), QSettings::IniFormat );
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );

    QString user = settings.value( QLatin1String("user") ).toString();
    // qDebug() << "Returning configured owncloud user: " << user;

    return user;
}
Esempio n. 4
0
void
register_chopper (struct pos *p)
{
  assert (con (p)->fg == CHOPPER
          && chopper_at_pos (p) == NULL);

  struct chopper c;

  int step = con (p)->ext.step & 0x7F;

  c.p = *p;
  c.i = step % CHOPPER_MAX_STEP;
  c.wait = CHOPPER_WAIT;
  c.blood = con (p)->ext.step & 0x80;
  c.inactive = (step > 0);
  c.alert = false;
  c.activate = false;

  chopper =
    add_to_array (&c, 1, chopper, &chopper_nmemb, chopper_nmemb, sizeof (c));

  qsort (chopper, chopper_nmemb, sizeof (c), compare_choppers);
}
char * fun(char *s1,int n1)
{
	char *s2,*s3;
	int i,count=0,j=0,k=0;
	s2=(char *)malloc(sizeof(char)*n1);
	s3=(char *)malloc(sizeof(char)*n1);
	for(i=0;i<n1;i++)
		if(s1[i]==',')
			break;
		else
		{
			count++;
			s2[j++]=s1[i];
		}
		s2[j]='\0';
		for(i=(count+1);s1[i]!='\0';i++)
            s3[k++]=s1[i];
		s3[k]='\0';
	if(con(s2)>con(s3))
		return s2;
	else
	    return s3;
}
Esempio n. 6
0
void
break_closer_floor (struct pos *p)
{
  struct closer_floor *c = closer_floor_at_pos (p);
  if (! c) return;
  c->broken = true;
  c->pressed = true;
  register_con_undo
    (&undo, p,
     MIGNORE, MIGNORE, -abs (con (p)->ext.event) - 1,
     false, false, false, false,
     CHPOS_BREAK_CLOSER_FLOOR,
     "LOOSE FLOOR BREAKING");
}
Esempio n. 7
0
void irc::pingcheckfunc()
{
	if (pinged)
	{
		pinged = false;
	}
	else
	{
		qDebug() << "reconnection needed";
		name = name + "_";
		discon();
		con();
	}
}
Esempio n. 8
0
CofmakerApplication::ApplicationResult * CofmakerApplication::InsertCategory( cofmaker::protocol::request_interface::weak_ptr request )
{
	#ifndef _WIN32
		mongo::scoped_ptr<mongo::ScopedDbConnection> con ( mongo::ScopedDbConnection::getScopedDbConnection ( this->_hostPort ) );
#else
		auto & con = mongo::ScopedDbConnection ( this->_hostPort );
#endif
		try
		{
			if ( this->_haspassword )
			{
				std::string errorMsg;
						#ifndef _WIN32
				if ( !con->get()->auth ( this->_database, this->_username, this->_password, errorMsg ) )
					std::cerr << errorMsg << std::endl;

		#else
				if ( !con->auth ( this->_database, this->_username, this->_password, errorMsg ) )
					std::cerr << errorMsg << std::endl;

		#endif
			}
			mongo::BSONObj entry = mongo::fromjson ( request.lock()->function().parameter ( "data" ).values().front() );
			std::set<std::string> fields;
			entry.getFieldNames ( fields );
			if ( fields.find ( "name" ) == fields.end() )
				throw cofmaker::exception::prorocol_error ( "{\"message\":\" Category name not specified\"}", -1, request.lock()->id() );
			mongo::BSONObjBuilder builder;
			builder.genOID();
			builder.appendElements ( entry );
		#ifndef _WIN32
			con->get()->insert ( this->_database + "." + this->_collectionCategory, builder.obj() );
			auto result = con->get()->query ( this->_database + "." + this->_collectionCategory, BSON ( "name" << entry.getField ( "name" ) ) );
		#else
			con->insert ( this->_database + "." + this->_collectionCategory, builder.obj() );
			auto result = con->query ( this->_database + "." + this->_collectionCategory, BSON ( "name" << entry.getField ( "name" ) ) );
			con.done();
			#endif
			std::string value = this->buildResult ( result );
			return new CofmakerApplication::ApplicationResult ( cofmaker::protocol::status::status_success, value );
		}
		catch ( std::exception & e )
		{
#ifdef _WIN32
			con.done();
#endif
			throw;
		}
	return new CofmakerApplication::ApplicationResult ( cofmaker::protocol::status::status_success, "{}" );
}
Esempio n. 9
0
void MirallConfigFile::setRemotePollInterval(int interval, const QString &connection )
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    if( interval < 5000 ) {
        qDebug() << "Remote Poll interval of " << interval << " is below fife seconds.";
        return;
    }
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup( con );
    settings.setValue(QLatin1String(remotePollIntervalC), interval );
    settings.sync();
}
Esempio n. 10
0
void MirallConfigFile::removeConnection( const QString& connection )
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    qDebug() << "    removing the config file for connection " << con;

    // Currently its just removing the entire config file
    QSettings settings( configFile(), QSettings::IniFormat);
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );
    settings.remove(QString::null);  // removes all content from the group
    settings.sync();
}
Esempio n. 11
0
EventPresenter::EventPresenter(
        const EventModel& model,
        QGraphicsObject* parentview,
        QObject* parent) :
    NamedObject {"EventPresenter", parent},
    m_model {model},
    m_view {new EventView{*this, parentview}},
    m_dispatcher{iscore::IDocument::documentContext(m_model).commandStack}
{
    // The scenario catches this :
    con(m_model.selection, &Selectable::changed,
        m_view, &EventView::setSelected);

    con(m_model.metadata, &ModelMetadata::colorChanged,
        m_view, &EventView::changeColor);

    con(m_model.metadata, &ModelMetadata::commentChanged,
        m_view, &EventView::changeToolTip);

    con(m_model, &EventModel::statusChanged,
        m_view, &EventView::setStatus);

    connect(m_view, &EventView::eventHoverEnter,
            this, &EventPresenter::eventHoverEnter);

    connect(m_view, &EventView::eventHoverLeave,
            this, &EventPresenter::eventHoverLeave);

    connect(m_view, &EventView::dropReceived,
            this, &EventPresenter::handleDrop);

    m_view->setCondition(m_model.condition().toString());
    m_view->setToolTip(m_model.metadata.comment());

    con(m_model, &EventModel::conditionChanged,
        this, [&] (const State::Condition& c) { m_view->setCondition(c.toString()); });
}
Esempio n. 12
0
int main(int argc, char** argv){
  NDB_INIT(argv[0]);
  load_defaults("my",load_default_groups,&argc,&argv);
  int ho_error;
  if ((ho_error=handle_options(&argc, &argv, my_long_options,
			       ndb_std_get_one_option)))
    return NDBT_ProgramExit(NDBT_WRONGARGS);
  if (argc < 1) {
    usage();
    return NDBT_ProgramExit(NDBT_WRONGARGS);
  }

  Ndb_cluster_connection con(opt_connect_str);
  con.set_name("ndb_drop_table");
  if(con.connect(12, 5, 1) != 0)
  {
    ndbout << "Unable to connect to management server." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  if (con.wait_until_ready(30,3) < 0)
  {
    ndbout << "Cluster nodes not ready in 30 seconds." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }

  Ndb MyNdb(&con, _dbname );
  if(MyNdb.init() != 0){
    ERR(MyNdb.getNdbError());
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  
  int res = 0;
  for(int i = 0; i<argc; i++){
    ndbout << "Dropping table " <<  argv[i] << "...";
    int tmp;
    if((tmp = MyNdb.getDictionary()->dropTable(argv[i])) != 0){
      ndbout << endl << MyNdb.getDictionary()->getNdbError() << endl;
      res = tmp;
    } else {
      ndbout << "OK" << endl;
    }
  }
  
  if(res != 0){
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  
  return NDBT_ProgramExit(NDBT_OK);
}
Esempio n. 13
0
int main(int argc, char** argv){
  NDB_INIT(argv[0]);
  load_defaults("my",load_default_groups,&argc,&argv);
  int ho_error;
#ifndef DBUG_OFF
  opt_debug= "d:t:O,/tmp/ndb_delete_all.trace";
#endif
  if ((ho_error=handle_options(&argc, &argv, my_long_options,
			       ndb_std_get_one_option)))
    return NDBT_ProgramExit(NDBT_WRONGARGS);

  Ndb_cluster_connection con(opt_connect_str);
  con.set_name("ndb_delete_all");
  if(con.connect(12, 5, 1) != 0)
  {
    ndbout << "Unable to connect to management server." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  if (con.wait_until_ready(30,0) < 0)
  {
    ndbout << "Cluster nodes not ready in 30 seconds." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }

  Ndb MyNdb(&con, _dbname );
  if(MyNdb.init() != 0){
    ERR(MyNdb.getNdbError());
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  
  // Check if table exists in db
  int res = NDBT_OK;
  for(int i = 0; i<argc; i++){
    const NdbDictionary::Table * pTab = NDBT_Table::discoverTableFromDb(&MyNdb, argv[i]);
    if(pTab == NULL){
      ndbout << " Table " << argv[i] << " does not exist!" << endl;
      return NDBT_ProgramExit(NDBT_WRONGARGS);
    }
    ndbout << "Deleting all from " << argv[i];
    if (! _transactional)
      ndbout << " (non-transactional)";
    ndbout << " ...";
    if(clear_table(&MyNdb, pTab, ! _transactional) == NDBT_FAILED){
      res = NDBT_FAILED;
      ndbout << "FAILED" << endl;
    }
  }
  return NDBT_ProgramExit(res);
}
Esempio n. 14
0
int main()
{
	//toprsImg img;
    int test = 5;
	
	toprsConnAble<toprsConnAbleReader> * pb = toprsConnAble<toprsConnAbleReader>::getInstance();
	toprsConnAble<toprsConnAbleFilter> * pd = toprsConnAble<toprsConnAbleFilter>::getInstance();
	////toprsConnAble * pc = toprsConnAble<toprsConnAbleReader>::getInstance();


	bool x = pb->canConnectMyInputTo(&test);

	bool y = pd->canConnectMyInputTo(&test);

	std::shared_ptr<testinter> temp(new testinter);
	std::shared_ptr<testinter> temp2 = std::make_shared<testinter>();

	toprsConnection<testinter> con(temp);
	con.connectMyInputTo(temp2);
	
	toprsConnection<testinter> con2(con);

	toprsConnection<testinter> con3(std::move(con));





	//bool z = con.testt<toprsConnAbleFilter>(&test);

	//toprsConnection<int> theConn(&test);

	//int one = 1;
	//int two =2;
	//int three = 3;

	//theConn.start();
   // theConn>>one>>two>>three;

	
	

	//bool z = pc->canConnectMyInputTo(&test);


	//return 0;
	//toprsConnAble<toprsConnAbleReader>* r = toprsConnAbleReader::getInstance();
	return 0;
}
Esempio n. 15
0
void
shake_loose_floor_row (struct pos *p)
{
  struct pos _p = *p;

  struct loose_floor *l;
  for (_p.place = PLACES - 1; _p.place >= -1; _p.place--)
    if (con (&_p)->fg == LOOSE_FLOOR) {
      l = loose_floor_at_pos (&_p);
      if (l->action == NO_LOOSE_FLOOR_ACTION) {
        l->action = SHAKE_LOOSE_FLOOR;
        l->i = 0;
      }
    }
}
Esempio n. 16
0
		bool submit(client::destination_container sender, client::destination_container target, const Plugin::SubmitRequestMessage &request_message, Plugin::SubmitResponseMessage &response_message) {
			const ::Plugin::Common_Header& request_header = request_message.header();
			nscapi::protobuf::functions::make_return_header(response_message.mutable_header(), request_header);
			connection_data con(target, sender);

			std::list<collectd::packet> list;
			for (int i = 0; i < request_message.payload_size(); ++i) {
				collectd::packet packet;
				//packet.add_string(0, "Hello WOrld");
				list.push_back(packet);
			}

			send(response_message.add_payload(), con, list);
			return true;
		}
int dps(int i, int j) {
	if (i <= 0) return 0;
	i64 &g = f[i][j];
	if (g != -1) return g;
	g = con(i, j);
	g += dps(i - 2, j);
	for (int k = 1; k < i - 1; ++k)
		for (int l = 0; l < m; ++l) {
			g += (i64)dps(k, l) * dps(i - 1 - k - 2, (j - l + m) % m) % mod;
			g += (i64)dps(k, l) * h[i - 1 - k][(j - l + m) % m] % mod;
			g += (i64)dps(k, l) * dps(i - 1 - k - 2, (l - j + m) % m) % mod;
			g += (i64)dps(k, l) * h[i - 1 - k][(l - j + m) % m] % mod;
		}
	return g %= mod;
}
Esempio n. 18
0
void irc::setup(QString srv, int p, QString c, QString n)
{
	qDebug() << "irc started";
	server = srv;
	port = p;
	channel = c;
	name = n;
	/* setup socket, connect signal/slot */
	socket = new QTcpSocket(this);
	connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
	pingcheck = new QTimer(this);
	connect(pingcheck, SIGNAL(timeout()), this, SLOT(pingcheckfunc()));
	/* connect */
	con();
}
Esempio n. 19
0
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        return -1;
    }

    QDir().mkdir("output");
    QDir output_dir("output");

    sqlite::connection con(QString::fromLocal8Bit(argv[1]).toStdString());
    iterateThreads(con, output_dir);

    return 0;
}
Esempio n. 20
0
void ConfigFile::setRemotePollInterval(chrono::milliseconds interval, const QString &connection)
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();

    if (interval < chrono::seconds(5)) {
        qCWarning(lcConfigFile) << "Remote Poll interval of " << interval.count() << " is below five seconds.";
        return;
    }
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);
    settings.setValue(QLatin1String(remotePollIntervalC), qlonglong(interval.count()));
    settings.sync();
}
Esempio n. 21
0
int MirallConfigFile::pollTimerExceedFactor( const QString& connection ) const
{
  QString con( connection );
  if( connection.isEmpty() ) con = defaultConnection();

  QSettings settings( configFile(), QSettings::IniFormat );
  settings.setIniCodec( "UTF-8" );
  settings.beginGroup( con );

  int pte = settings.value( QLatin1String("pollTimerExeedFactor"), DEFAULT_POLL_TIMER_EXEED).toInt();

  if( pte < 1 ) pte = DEFAULT_POLL_TIMER_EXEED;

  return pte;
}
Esempio n. 22
0
int ConfigFile::remotePollInterval( const QString& connection ) const
{
  QString con( connection );
  if( connection.isEmpty() ) con = defaultConnection();

  QSettings settings(configFile(), QSettings::IniFormat);
  settings.beginGroup( con );

  int remoteInterval = settings.value( QLatin1String(remotePollIntervalC), DEFAULT_REMOTE_POLL_INTERVAL ).toInt();
  if( remoteInterval < 5000) {
    qDebug() << "Remote Interval is less than 5 seconds, reverting to" << DEFAULT_REMOTE_POLL_INTERVAL;
    remoteInterval = DEFAULT_REMOTE_POLL_INTERVAL;
  }
  return remoteInterval;
}
Esempio n. 23
0
void MirallConfigFile::removeConnection( const QString& connection )
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    qDebug() << "    removing the config file for connection " << con;

    // Currently its just removing the entire config file
    // TODO: Eh? Shouldn't it try to load a file under configFile() and set it to INI?
    QSettings settings;
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );
    settings.remove(QString::null);  // removes all content from the group
    settings.sync();
}
Esempio n. 24
0
void
draw_balcony_stars (ALLEGRO_BITMAP *bitmap, struct pos *p,
                    enum vm vm)
{
  if (con (p)->bg != BALCONY) return;

  if (vm != last_vm) {
    redraw_stars_bitmap (star[p->floor + 1][p->place + 1],
                         &stars_bitmap [p->floor + 1][p->place + 1], STARS, vm);
    last_vm = vm;
  }

  draw_stars (bitmap, star[p->floor + 1][p->place + 1],
              &stars_bitmap [p->floor + 1][p->place + 1], STARS, vm);
}
Esempio n. 25
0
void socket_server::handle_accept( socket_ptr socket, const boost::system::error_code& error ) {
  
  if ( error ) {
    LOG_HIGH( SS, "error accepting socket (error code " << error << ")");      
  }
  else {

    player_connection::player_connection_ptr con( new player_connection( socket, this ) );
    _connections[con->id()] =  con;
    _new_cons.push_back( con->id());
    LOG_LOW( SS, "accepted playercon " << con->id() );
  }
  
  start_accept();
}
Esempio n. 26
0
void
register_closer_floor (struct pos *p)
{
  assert (con (p)->fg == CLOSER_FLOOR
          && closer_floor_at_pos (p) == NULL);

  struct closer_floor c;

  int event = con (p)->ext.event;

  c.p = *p;
  c.event = (event < 0) ? -event - 1 : event;
  c.pressed = (event < 0);
  c.noise = (event < 0);
  c.broken = (event < 0);
  c.unresponsive = false;

  closer_floor =
    add_to_array (&c, 1, closer_floor, &closer_floor_nmemb,
                  closer_floor_nmemb, sizeof (c));

  qsort (closer_floor, closer_floor_nmemb, sizeof (c),
         compare_closer_floors);
}
void ConnectToDatabase::aktualizujRejestrSprzedazy(string query){
    string url(EXAMPLE_HOST);
    const string user(EXAMPLE_USER);
    const string pass(EXAMPLE_PASS);
    const string database(EXAMPLE_DB);
    
    
    
    try {
        
        /* INSERT TUTORIAL CODE HERE! */
        
        
        Driver* driver = get_driver_instance();
        auto_ptr<Connection> con(driver->connect(url, user, pass));
        con->setSchema(database);
        auto_ptr<Statement> stmt(con->createStatement());
        
        // We need not check the return value explicitly. If it indicates
        // an error, Connector/C++ generates an exception.
        
        // executeQuery() wysyla zapytanie SELECT zwraca resultSet
        // executeUpdate() wysyla zapytanie INSERT, UPDATE lub DELETE i nie zwraca zadej wartosci
        
        // Jeśli nie wiesz z gory jakiego zapytania uzyjesz, uzyj funkcji execute()
        // execute() zwraca "true" jesli zapytaniem SQL bylo SELECT i "false" jesli - INSERT, UPDATE lub DELETE
        
        stmt->executeUpdate(query);
        
        /* END OF TUTORIAL CODE */
        
    } catch (sql::SQLException &e) {
        /*
         MySQL Connector/C++ throws three different exceptions:
         
         - sql::MethodNotImplementedException (derived from sql::SQLException)
         - sql::InvalidArgumentException (derived from sql::SQLException)
         - sql::SQLException (derived from std::runtime_error)
         */
        cout << "# ERR: SQLException in " << __FILE__;
        cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
        /* what() (derived from std::runtime_error) fetches error message */
        cout << "# ERR: " << e.what();
        cout << " (MySQL error code: " << e.getErrorCode();
        cout << ", SQLState: " << e.getSQLState() << " )" << endl;
    }

};
Esempio n. 28
0
int
main (int argc, char **argv)
{
   IloEnv   env;
   try {
      IloModel model(env);
      IloNumVarArray var(env);
      IloRangeArray con(env);
      IloRange add_con(env, 0.0, IloInfinity);

      populatebyrow (model, var, con);

      IloCplex cplex(model);

      // When a non-convex objective function is present, CPLEX will
      // raise an exception unless the parameter
      // IloCplex::Param::OptimalityTarget is set to accept first-order optimal
      // solutions
      cplex.setParam(IloCplex::Param::OptimalityTarget,
                     IloCplex::SolutionFirstOrder);

      // CPLEX may converge to either local optimum 
      solveanddisplay(env, cplex, var, con);

      // Add a constraint that cuts off the solution at (-1, 1)
      add_con.setExpr(var[0]);
      model.add(add_con);
      solveanddisplay(env, cplex, var, con);

      // Change the bounds of the newly added constraint to cut off
      // the solution at (1, 1)
      add_con.setBounds(-IloInfinity, 0.0);
      solveanddisplay(env, cplex, var, con);

      cplex.exportModel("indefqpex1.lp");
      
   }
   catch (IloException& e) {
      cerr << "Concert exception caught: " << e << endl;
   }
   catch (...) {
      cerr << "Unknown exception caught" << endl;
   }

   env.end();

   return 0;
}  // END main
Esempio n. 29
0
int main(int argc, char** argv){
  NDB_INIT(argv[0]);
  load_defaults("my",load_default_groups,&argc,&argv);
  int ho_error;
#ifndef DBUG_OFF
  opt_debug= "d:t:O,/tmp/ndb_desc.trace";
#endif
  if ((ho_error=handle_options(&argc, &argv, my_long_options, 
			       ndb_std_get_one_option)))
    return NDBT_ProgramExit(NDBT_WRONGARGS);

  Ndb_cluster_connection con(opt_connect_str);
  con.set_name("ndb_desc");
  if(con.connect(12, 5, 1) != 0)
  {
    ndbout << "Unable to connect to management server." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }
  if (con.wait_until_ready(30,0) < 0)
  {
    ndbout << "Cluster nodes not ready in 30 seconds." << endl;
    return NDBT_ProgramExit(NDBT_FAILED);
  }

  Ndb MyNdb(&con, _dbname);
  if(MyNdb.init() != 0){
    ERR(MyNdb.getNdbError());
    return NDBT_ProgramExit(NDBT_FAILED);
  }

  for(int i= 0; i<argc;i++)
  {
    if(desc_table(&MyNdb,argv[i]))
      ;
    else if(desc_tablespace(&MyNdb,argv[i]))
      ;
    else if(desc_logfilegroup(&MyNdb,argv[i]))
      ;
    else if(desc_datafile(con, &MyNdb, argv[i]))
      ;
    else if(desc_undofile(con, &MyNdb, argv[i]))
      ;
    else
      ndbout << "No such object: " << argv[i] << endl << endl;
  }

  return NDBT_ProgramExit(NDBT_OK);
}
Esempio n. 30
0
/*
 * returns the configured owncloud url if its already configured, otherwise an empty
 * string.
 * The returned url always has a trailing hash.
 */
QString MirallConfigFile::ownCloudUrl( const QString& connection) const
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    QSettings settings(configFile(), QSettings::IniFormat);
    settings.setIniCodec("UTF-8");
    settings.beginGroup( con );

    QString url = settings.value( QLatin1String(urlC) ).toString();
    if( ! url.isEmpty() ) {
        if( ! url.endsWith(QLatin1Char('/'))) url.append(QLatin1String("/"));
    }

    return url;
}