Example #1
0
int readListConf ( KConfig *conf, QString key, QStrList &list )
{
  if( !conf->hasKey( key ) )
    { 
      // debug("readListConf:: key does not exist");
      return 0;
    }
  QString str_list, value;
  str_list = conf->readEntry(key);
  if(str_list.isEmpty())
    {
      // debug("readListConf:: list is empty"); 
      return 0; 
    }
  list.clear();
  int i;
  int len = str_list.length();
  for( i = 0; i < len; i++ )
    {
      if( str_list[i] != ',' && str_list[i] != '\\' )
	{
	  value += str_list[i];
	  continue;
	}
      if( str_list[i] == '\\' )
	{
	  i++;
	  value += str_list[i];
	  continue;
	}
      list.append(value);
      value.truncate(0);
    }
  list.append(value);
}
Example #2
0
QStrList objFinder::allObjects(){ /*fold00*/
  QStrList allNames;
  QDictIterator<QObject> it(*objList);
  while(it.current()){
    QObjectList *qobl = it.current()->queryList(); // Matches everything
    QObjectListIt itql( *qobl );
    while(itql.current()){
      QString name;
      name = itql.current()->className();
      name += "::";
      name += itql.current()->name("unnamed");
      allNames.append(name);
      ++itql;
    }
    delete qobl;
    ++it;
  }
  QWidgetList *all = QApplication::allWidgets();
  QWidgetListIt itW(*all);
  while(itW.current()){
    QString name;
    name = itW.current()->className();
    name += "::";
    name += itW.current()->name("unnamed");
    allNames.append(name);
    ++itW;
  }
  delete all;
  return allNames;
}
Example #3
0
void CDDBSetup::getData(QStrList& _serverlist,
                        QStrList& _submitlist,
			QString& _basedir,
			QString& _submitaddress, 
			QString& _current_server,
			bool&    remote_enabled,
			bool&    http_proxy_enabled,
			QString  &http_proxy_host,
			int      &http_proxy_port)
{
    uint i;

    _serverlist.clear();
    _submitlist.clear();
    for(i = 0; i < server_listbox->count();i++){
        _serverlist.append(server_listbox->text(i));
    }
    for(i = 0; i < submission_listbox->count(); i++){
        _submitlist.append(submission_listbox->text(i));
    }
    _basedir = basedirstring.copy();
    _submitaddress = submitaddressstring.copy();

    _current_server     = current_server_string.copy();
    remote_enabled      = remote_cddb_cb->isChecked();
    http_proxy_enabled  = cddb_http_cb->isChecked();
    http_proxy_host     = proxy_host_ef->text();
    http_proxy_port     = atoi(proxy_port_ef->text());
}
Example #4
0
ac::ac(const QString &changes, QWidget *parent, const char *name, const QStringList &)
:AcDialog(parent, name)
{

	borderFrame->hide();
	setGeometry( x(), y(), 500, 30);
	borderFrame->setGeometry( 0, 0, 500, 400);
	konsoleFrame->setGeometry( 0, 0, 500, 400);

	appdir   = "/usr/share/apt-get-konsole/";

	loadKonsole();
	konsoleFrame->installEventFilter( this );

	changes2 = changes;

	QStrList run;
	run.append( appdir+"sh/applyChanges" );

	run.append( changes );

	// run command
	terminal()->startProgram( appdir+"sh/applyChanges", run );

	j=0;
	firstdownload = TRUE;

	connect( konsole, SIGNAL( receivedData( const QString& ) ), SLOT( shellOutput( const QString&) ) );
	connect( konsole, SIGNAL( destroyed() ), SLOT( close() ) );
}
Example #5
0
void KFMServer::slotCopyClients( const char *_src_urls, const char *_dest_url )
{
    QString s = _src_urls;
    s.detach();
    QStrList urlList;

    QString dest = _dest_url;
    if ( dest == "trash:/" )
        dest = "file:" + KFMPaths::TrashPath();

    int i;
    while ( ( i = s.find( "\n" ) ) != -1 )
    {
        QString t = s.left( i );
        urlList.append( t.data() );
        s = s.mid( i + 1, s.length() );
    }

    urlList.append( s.data() );

    KIOJob *job = new KIOJob();
    if ( urlList.count() == 1 )
        job->copy( urlList.first(), dest.data() );
    else
        job->copy( urlList, dest.data() );
}
Example #6
0
void KFMServer::slotExec( const char* _url, const char * _documents )
{
    KURL u( _url );
    if ( u.isMalformed() )
    {
        QString msg;
        ksprintf(&msg, i18n( "The URL\n%s\nis malformed" ),
                 _url);
        QMessageBox::warning( (QWidget*)0,
                              i18n( "KFM Error" ), msg );
        return;
    }

    if ( _documents == 0L && _url != 0L )
    {
        KFMExec *e = new KFMExec;
        e->openURL( _url );
        return;
    }

    QString s( _documents );
    QStrList urlList;

    int i;
    while ( ( i = s.find( "\n" ) ) != -1 )
    {
        QString t = s.left( i );
        urlList.append( t.data() );
        s = s.mid( i + 1, s.length() );
    }

    urlList.append( s.data() );
    KMimeType *typ = KMimeType::getMagicMimeType( _url );
    typ->runAsApplication( _url, &urlList );
}
Example #7
0
/*!
  Decodes URLs from \a e, placing the result in \a l (which is first cleared).

  Returns TRUE if the event contained a valid list of URLs.
*/
bool QUrlDrag::decode( QDropEvent* e, QStrList& l )
{
    QByteArray payload = e->data( "url/url" );
    if ( payload.size() ) {
	e->accept();
	l.clear();
	l.setAutoDelete(TRUE);
	uint c=0;
	char* d = payload.data();
	while (c < payload.size()) {
	    uint f = c;
	    while (c < payload.size() && d[c])
		c++;
	    if ( c < payload.size() ) {
		l.append( d+f );
		c++;
	    } else {
		QString s(d+f,c-f+1);
		l.append( s );
	    }
	}
	return TRUE;
    }
    return FALSE;
}
Example #8
0
void KFMClient::slotMove( const char *_src_urls, const char *_dest_url )
{
    QString s = _src_urls;
    s.detach();
    QStrList urlList;

    QString dest = _dest_url;
    if ( dest == "trash:/" )
        dest = "file:" + KFMPaths::TrashPath();

    int i;
    while ( ( i = s.find( "\n" ) ) != -1 )
    {
        QString t = s.left( i );
        urlList.append( t.data() );
        s = s.mid( i + 1, s.length() );
    }

    urlList.append( s.data() );

    KIOJob *job = new KIOJob();
    connect( job, SIGNAL( finished( int ) ), this, SLOT( finished( int ) ) );
    if ( urlList.count() == 1 )
        job->move( urlList.first(), dest.data() );
    else
        job->move( urlList, dest.data() );
}
Example #9
0
bool cddb_playlist_decode(QStrList& list, QString& str){
 
    bool isok = true;
    int pos1, pos2;
    pos1 = 0;
    pos2 = 0;

    list.clear();

    while((pos2 = str.find(",",pos1,true)) != -1){

	if(pos2 > pos1){
	    list.append(str.mid(pos1,pos2 - pos1));
	}
    
	pos1 = pos2 + 1;
    }
  
    if(pos1 <(int) str.length())
	list.append(str.mid(pos1,str.length()));

    QString check;
    bool 	ok1;
    int   num;

    for(uint i = 0; i < list.count(); i++){
	check = list.at(i);
	check = check.stripWhiteSpace();

	if(check.isEmpty()){
	    list.remove(i);
	    i--;
	    continue;
	}

	if(check == QString (",")){
	    list.remove(i);
	    i--;
	    continue;
	}
    
	num = check.toInt(&ok1);
	if(!ok1 || num < 1){
	    list.remove(i);
	    i--;
	    isok = false;
	    continue;
	}
    
	list.remove(i);
	list.insert(i, check);

    }

    /*  for(uint i = 0; i < list.count(); i++){
	printf("playlist %d=%s\n",i,list.at(i));
	}*/
    return isok;
}
Example #10
0
void Kooka::fileSaveAs()
{
    // this slot is called whenever the File->Save As menu is selected,
   QStrList strlist;
   strlist.append( "BMP" );
   strlist.append( "JPEG" );
   FormatDialog fd( 0, "FormatDialog", &strlist );
   fd.exec();

}
void RubySupportPart::projectOpened()
{
  kdDebug() << "projectOpened()" << endl;

  QStrList l;
  l.append( shell().latin1() ) ;
  m_shellWidget->setShell( shell().latin1(), l );
  m_shellWidget->activate();
  m_shellWidget->setAutoReactivateOnClose( true );

  connect( project(), SIGNAL(addedFilesToProject(const QStringList &)),
  	this, SLOT(addedFilesToProject(const QStringList &)) );
  connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)),
  	this, SLOT(removedFilesFromProject(const QStringList &)) );

  QFileInfo program(mainProgram());

  // If it's a Rails project, create the project files if they're missing
  if (mainProgram().endsWith("script/server")) {
    QString cmd;
    QFileInfo server(project()->projectDirectory() + "/script/server");
    if (! server.exists()) {
      cmd += "rails " + project()->projectDirectory();
      if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
        appFrontend->startAppCommand(project()->projectDirectory(), cmd, false);
    }
  }

  // We want to parse only after all components have been
  // properly initialized
  QTimer::singleShot(0, this, SLOT(initialParse()));
}
Example #12
0
void 
KAMenu::slotHostlistChanged()
{
  /* die Liste der erreichbaren Archiehosts hat sich
   * veraendert. neu einlesen
   */
  //  KConfig *config = KApplication::getKApplication()->getConfig();
  QStrList archiehostlist;
  //  int archiehostlistnumber = 
  KConfigGroupSaver saveGroup( config, "HostConfig" );

  config->readListEntry( "Hosts", archiehostlist );
  //  QString currenthost = config->readEntry( "CurrentHost", "archie.sura.net" );
  QString defaulthost = "archie.sura.net" ;
  if ( archiehostlist.isEmpty() ) {
    archiehostlist.append( defaulthost );
    //    currentHostId = 0;
  }
  
  host->clear();
  char *tmpStr;
  int i = 0;
  for (tmpStr=archiehostlist.first(); tmpStr; tmpStr=archiehostlist.next()) {
    host->insertItem( tmpStr, i, i);
    i++;
  }

  slotConfigChanged();

  emit sigArchieHost(host->text(host_id));
}
void ossimQtQuadProjectionController::buildDatumMenu() const
{
   // Build the datum menu.
   QStrList datumList;
   std::vector<ossimString> tempOssimDatumList =
      ossimDatumFactory::instance()->getList();
   std::vector<ossimString>::iterator listIter = tempOssimDatumList.begin();
   while(listIter != tempOssimDatumList.end())
   {
      const ossimDatum* datum = ossimDatumFactory::instance()->
         create(*listIter);
      if(datum)
      {
         datumList.append((datum->code() + ": " + datum->name()).c_str());
      }
      ++listIter;
   }
   theDialog->theDatumComboBox->clear();
   theDialog->theDatumComboBox->insertStrList(datumList);

   // Set to WGE for default (WGS-84).
   const int COUNT = theDialog->theDatumComboBox->count();
   for (int i = 0; i < COUNT; ++i)
   {
      ossimString name = theDialog->theDatumComboBox->text(i).ascii();
      
      if (name.contains("WGE"))
      {
         theDialog->theDatumComboBox->setCurrentItem(i);
         break;
      }
   }   
}
Example #14
0
/*!
  Decodes URIs from \a e, placing the result in \a l (which is first cleared).

  Returns TRUE if the event contained a valid list of URIs.
*/
bool QUriDrag::decode( const QMimeSource* e, QStrList& l )
{
    QByteArray payload = e->encodedData( "text/uri-list" );
    if ( payload.size() ) {
	l.clear();
	l.setAutoDelete(TRUE);
	uint c=0;
	char* d = payload.data();
	while (c < payload.size() && d[c]) {
	    uint f = c;
	    // Find line end
	    while (c < payload.size() && d[c] && d[c]!='\r'
		    && d[c] != '\n')
		c++;
	    QCString s(d+f,c-f+1);
	    if ( s[0] != '#' ) // non-comment?
		l.append( s );
	    // Skip junk
	    while (c < payload.size() && d[c] &&
		    (d[c]=='\n' || d[c]=='\r'))
		c++;
	}
	return TRUE;
    }
    return FALSE;
}
Example #15
0
/*!
  Sets the URIs to be the local-file URIs equivalent to \a fnames.

  \sa localFileToUri(), setUris()
*/
void QUriDrag::setFilenames( QStringList fnames )
{
    QStrList uris;
    for (QStringList::Iterator i = fnames.begin();
	    i != fnames.end(); ++i )
	uris.append(localFileToUri(*i));
    setUris(uris);
}
Example #16
0
/*!
  Sets the URIs to be the
  Unicode URIs (only useful for
  displaying to humans) \a uuris.

  \sa localFileToUri(), setUris()
*/
void QUriDrag::setUnicodeUris( QStringList uuris )
{
    QStrList uris;
    for (QStringList::Iterator i = uuris.begin();
	    i != uuris.end(); ++i )
	uris.append(unicodeUriToUri(*i));
    setUris(uris);
}
Example #17
0
void PPPdArguments::closebutton() {
  QStrList arglist;
  for(uint i=0; i < arguments->count(); i++)
    arglist.append(arguments->text(i));
  gpppdata.setpppdArgument(arglist);

  done(0);
}
Example #18
0
void DNSWidget::save() {
  QStrList serverlist;
  for(uint i=0; i < dnsservers->count(); i++)
    serverlist.append(dnsservers->text(i));
  gpppdata.setDns(serverlist);

  gpppdata.setDomain(dnsdomain->text());
  gpppdata.setExDNSDisabled(exdnsdisabled_toggle->isChecked());
}
Example #19
0
QStrList *MarkListTable::markList()
{
	QStrList *l = new QStrList;

	for ( int i=0 ; i < (signed) items.count(); i++ )
		if ( ( items.at( i ) )->mark() )
			l->append( items.at( i )->text() );
	return l;
}
Example #20
0
QStrList Dispatcher::instanceNames() const
{
    kdDebug( 701 ) << k_funcinfo << endl;
    QStrList names;
    for( QMap<QCString, InstanceInfo>::ConstIterator it = m_instanceInfo.begin(); it != m_instanceInfo.end(); ++it )
        if( ( *it ).count > 0 )
            names.append( it.key() );
    return names;
}
Example #21
0
KAArchieSettings::KAArchieSettings(const char *title, QWidget *parent, const char *name)
  :QGroupBox( title, parent, name )
{

  //  debug( "set KAArchieSettings Combobox" );
  hostbox = new QGroupBox( this, "hostbox" );
  hostbox->setFrameStyle( QFrame::NoFrame );
  hostname = new QComboBox( hostbox, "hostname" );
  hostnamelabel = new QLabel( hostname, i18n("&Host"), hostbox, "hostnamelabel" );
  
  timeoutbox = new QGroupBox ( this, "timeoutbox" );
  timeoutbox->setFrameStyle( QFrame::NoFrame );
  timeoutline = new KIntegerLine( timeoutbox, "timeoutline" );
  //  timeoutline->hide();
  //  timeoutline->setText("0000");
  // get the size for displaying "0000"
  //  const QSize lineEditSize = timeoutline->sizeHint();
  //  QFontMetrics *fm = &timeoutline->fontMetrics();
  //  int lineEditHeight = fm->boundingRect('8').height();
  //  timeoutline->setFixedHeight( timeoutline->height() );
  //  timeoutline->show();
  timeoutlabel = new QLabel( timeoutline, i18n("&Timeout (seconds)"), timeoutbox, "timeoutlabel" );
  connect(timeoutline, SIGNAL(returnPressed()),
	  this, SLOT(slotRP()) );

  triesbox = new QGroupBox ( this, "triesbox" );
  triesbox->setFrameStyle( QFrame::NoFrame );
  triesline = new KIntegerLine( triesbox, "triesline" );
  //  QString tmp("set KLineEdit height ");
  //  tmp.setNum( lineEditHeight );
  //  debug( tmp );
  //  triesline->setFixedHeight( triesline->height() );
  trieslabel = new QLabel( triesline, i18n("Maximal &retries"), triesbox, "trieslabel" );
  connect(triesline, SIGNAL(returnPressed()),
	  this, SLOT(slotRP()) );

  doLayout();


  // read initial archie server list
  QStrList archiehostlist;
  KConfig *config = KApplication::getKApplication()->getConfig();
  // get the list of hosts
  KConfigGroupSaver saveGroup( config, "HostConfig" );
  //  archiehostlistnumber = 
  config->readListEntry( "Hosts", archiehostlist );
  QString defaulthost = "archie.sura.net" ;
  if ( archiehostlist.isEmpty() ) {
    archiehostlist.append( defaulthost );
    //    currentHostId = 0;
  }
  hostname->insertStrList( &archiehostlist );
  hostname->adjustSize();


  readConfig();
}
Example #22
0
/*
void TIconView::contentsMouseMoveEvent(QMouseEvent* event)
{
  if(event->state() && LeftButton)
    {
      int distance = (event->pos() - dragPos).manhattanLength();
      if(distance > QApplication::startDragDistance())
    startDrag();
    }
  // This creates a mouse pointer problem don't do this
  //KIconView::contentsMouseMoveEvent(event);
} //this event causes crashing. commented but no feature lack yet.
*/
void TIconView::startDrag()
{
    if(dragItem)
    {
        QStrList uri;
        uri.append(dragItem->moduleinfo()->fileName().local8Bit());
        QUriDrag* uriDrag = new QUriDrag(uri, this);
        uriDrag->drag();
    }
}
Example #23
0
//-----------------------------------------------------------------------------
QStrList  KMAcctMgr::getAccounts() {
  
  KMAccount *cur;
  QStrList strList;
  for (cur=mAcctList.first(); cur; cur=mAcctList.next()) {
    strList.append(cur->name());
  }

  return strList;

}
Example #24
0
File: main.C Project: xwizard/kde1
void TEDemo::newSession(int i)
{
  char* shell = getenv("SHELL");
  if (shell == NULL || *shell == '\0') shell = "/bin/sh";

  KSimpleConfig* co = no2command.find(i);
  if (!co) return; // oops

  assert( se ); //FIXME: careful here.

  QString cmd = co->readEntry("Exec");    // not null
  QString nam = co->readEntry("Name");    // not null
  QString emu = co->readEntry("Term");
  QString sch = co->readEntry("Schema");
  QString txt = co->readEntry("Comment"); // not null
  int     fno = QMIN(co->readUnsignedNumEntry("Font",se->fontNo()),7);

  ColorSchema* schema = sch.isEmpty()
                      ? (ColorSchema*)NULL
                      : ColorSchema::find(sch);

  //FIXME: schema names here are absolut. Wrt. loadAllSchemas,
  //       relative pathes should be allowed, too.

  int schmno = schema?schema->numb:se->schemaNo();

  if (emu.isEmpty()) emu = se->emuName();

  QStrList args;
  args.append(shell);
  args.append("-c");
  args.append(cmd);

  TESession* s = new TESession(this,te,args,emu.data(),0);
  s->setFontNo(fno);
  s->setSchemaNo(schmno);
  s->setTitle(txt.data());

  addSession(s);
  runSession(s); // activate and run
}
Example #25
0
void KfmView::slotBookmarks()
{
    char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
    {
       popupFiles.append ( getURL() );
    }
    for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )    
	gui->addBookmark( s, s );
}
Example #26
0
int KConfigBase::readListEntry(const char *pKey, QStrList &list, char sep) const
{
    if(!hasKey(pKey))
        return 0;

    QCString str_list = readEntryUtf8(pKey);
    if(str_list.isEmpty())
        return 0;

    list.clear();
    QCString value = "";
    int len = str_list.length();

    for(int i = 0; i < len; i++)
    {
        if(str_list[i] != sep && str_list[i] != '\\')
        {
            value += str_list[i];
            continue;
        }
        if(str_list[i] == '\\')
        {
            i++;
            if(i < len)
                value += str_list[i];
            continue;
        }
        // if we fell through to here, we are at a separator.  Append
        // contents of value to the list
        // !!! Sergey A. Sukiyazov <*****@*****.**> !!!
        // A QStrList may contain values in 8bit locale cpecified
        // encoding
        list.append(value);
        value.truncate(0);
    }

    if(str_list[len - 1] != sep || (len > 1 && str_list[len - 2] == '\\'))
        list.append(value);
    return list.count();
}
Example #27
0
void KfmView::slotNewView()
{
	char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
       popupFiles.append ( getURL() );
	for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
	{
	KfmGui *m = new KfmGui( 0L, 0L, s );
	m->show();
    }
}
Example #28
0
bool KHost::WriteConfig()
{
	KConfig *config = ((KConnection*) topLevelWidget())->GetConfig();
	QStrList List;
	const char *Value;
	int i;

	if (config == NULL)
		return FALSE;

	hostChanged(0);
	portChanged(0);

	config->setGroup(KI_SEC_HOSTS);

	if ((Value = hostCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
		List.append(Value);

	for (i = 0; i < hostCombo->count(); i++)
		if (List.find(hostCombo->text(i)) == -1)
			List.append(hostCombo->text(i));

	config->writeEntry(KI_ENT_HOSTS,List);
	List.clear();

	if ((Value = portCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
		List.append(Value);

	for (i = 0; i < portCombo->count(); i++)
		if (List.find(portCombo->text(i)) == -1)
			List.append(portCombo->text(i));

	config->writeEntry(KI_ENT_PORTS,List);

	config->writeEntry(KI_ENT_LAST_HOST,hostCombo->currentText());
	config->writeEntry(KI_ENT_LAST_PORT,portCombo->currentText());

	return TRUE;
}
Example #29
0
/*!
  Decodes URLs from \a e, converts them to local files if they refer to
  local files, and places them in \a l (which is first cleared).

  Returns TRUE if the event contained a valid list of URLs.
  The list will be empty if no URLs were local files.
*/
bool QUrlDrag::decodeLocalFiles( QDropEvent* e, QStrList& l )
{
    QStrList u;
    if ( !decode( e, u ) )
	return FALSE;

    l.clear();
    l.setAutoDelete(TRUE);
    for (const char* s=u.first(); s; s=u.next()) {
	QString lf = urlToLocalFile(s);
	if ( !lf.isNull() )
	    l.append( lf );
    }
    return TRUE;
}
Example #30
0
void cddb_encode(QString& str, QStrList &returnlist){

    returnlist.clear();

    int pos1 = 0;
    int pos2 = 0;

    while((pos2 = str.find("\\",pos1,true)) !=-1){
	str.replace(pos2 , 1 , "\\\\");
	pos1 = pos2 + 1;
    }

    pos1 = 0;
    pos2 = 0;

    while((pos2 = str.find("\n",pos1,true)) !=-1){
	str.replace(pos2 , 1 , "\\n");
	pos1 = pos2 + 1;
    }

    pos1 = 0;
    pos2 = 0;

    while((pos2 = str.find("\t",pos1,true)) !=-1){
	str.replace(pos2 , 1 , "\\t");
	pos1 = pos2 + 1;
    }

    while(str.length() > 70){
	returnlist.append(str.left(70));
	str = str.mid(70,str.length());
    }

    returnlist.append(str);

}