示例#1
0
void
wCatalogEditor::checkUserFields( QStringList &lst)
{
	aCfgItem item = md->find(catId);
	int fid;
	if(item.isNull()) return;
	item = md->findChild(item,md_element);
	for(int i=0; i< md->count(item,md_field); i++)
  	{
		aCfgItem mdi = md->findChild(item,md_field,i);
		int ind = lst.findIndex(QString("uf%1").arg(md->attr(mdi,mda_id)));
		if(ind!=-1)
		{
			lst.insert(lst.at(i),lst[ind]);
			lst.remove(lst.at(ind+1));
			
		}
		else
		{
			ind = lst.findIndex(QString("text_uf%1").arg(md->attr(mdi,mda_id)));
			if(ind!=-1)
			{
				lst.insert(lst.at(i),lst[ind]);
				lst.remove(lst.at(ind+1));
			
			}
		}
  	}
	
}
示例#2
0
void KRecentDirs::add(const QString &fileClass, const QString &directory)
{
   QString key = fileClass;
   QStringList result;
   KConfig *config = recentdirs_readList(key, result, false);
   // make sure the dir is first in history
   result.remove(directory);
   result.prepend(directory);
   while(result.count() > MAX_DIR_HISTORY)
      result.remove(result.fromLast());
   config->writePathEntry(key, result);
   recentdirs_done(config);
}
示例#3
0
        void OPimContact::removeEmail( const QString &v )
{
    QString e = v.simplifyWhiteSpace();
    QString def = defaultEmail();
    QString emailsStr = find( Qtopia::Emails );
    QStringList emails = emailList();

    // otherwise, must first contain it
    if ( !emailsStr.contains( e ) )
        return ;

    // remove it
    //odebug << " removing email from list " << e << "" << oendl;
    emails.remove( e );
    // reset the string
    emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator
    replace( Qtopia::Emails, emailsStr );

    // if default, then replace the default email with the first one
    if ( def == e )
    {
        //odebug << "removeEmail is default; setting new default" << oendl;
        if ( !emails.count() )
            clearEmails();
        else // setDefaultEmail will remove e from the list
            setDefaultEmail( emails.first() );
    }
}
示例#4
0
void BushuViewWidget::slotBushuSelected( QListViewItem *item )
{
    if ( !item )
        return ;

    QString selectedBushuName = item->text( 0 );
    if ( selectedBushuName.isEmpty() )
        return ;

    QFile file( BUSHUDICT );
    if ( file.open( IO_ReadOnly ) )
    {
        QTextStream stream( &file );
        stream.setCodec(QTextCodec::codecForName(BUSHUDICT_ENCODING));
        QString line;

        // search selected bushu line by line
        while ( !stream.atEnd() )
        {
            QStringList chars = QStringList::split( " ",  stream.readLine()  );
            QString bushuName = chars[ 0 ];
            if ( selectedBushuName == bushuName )
            {
                // Display Characters
                chars.remove( bushuName );
                m_charGridView->setCharacters( chars );
            }
        }
        file.close();
    }
}
示例#5
0
static void addEntry(QStringList &list, const QString &name, const QString &file, const QString &fmapDir)
{
    QString existing(getEntry(list, name));
    bool insert = true;

    if(!existing.isEmpty())
        if(isAlias(existing))
            list.remove(existing);
        else
            insert = false;

    if(insert)
    {
        QString entry;
        QTextOStream str(&entry);

        str << '/' << name << " (";

        if(0 == file.find(fmapDir))
            str << file.mid(fmapDir.length());
        else
            str << file;

        str << ") ;";
        list.append(entry);
    }
}
示例#6
0
void BaseTreeView::restoreLayout(KConfig *config, const QString &group)
{
  KListView::restoreLayout(config, group);
  KConfigGroupSaver saver(config, group);
  setShowToolTips( config->readBoolEntry("ShowToolTips", true) );

  if (! m_saveOpenFolder || ! qConfig.saveTrees)
    return;

  BaseTreeBranch *btb;
  KFileTreeBranchIterator it( branches() );
  int maxBranch = config->readNumEntry("NumOpenFolderList", 0);
  for (int i = 1; i <= maxBranch; ++i)
  {
    QStringList folderList = QuantaCommon::readPathListEntry(config, "OpenFolderList" + QString::number(i));
    if (folderList.count() > 1) {
      KURL rootURL = (*folderList.begin());
      folderList.remove(folderList.begin());  // remove the root URL
      KFileTreeBranchIterator it( branches() );
      for ( ; it.current(); ++it)
      {
        if ((*it)->rootUrl() == rootURL) {
          btb = dynamic_cast<BaseTreeBranch *>( (*it) );
          if (btb) {
            btb->folderToOpen = folderList;
            btb->reopenFolder();
            break;
          }
        }
      }
    }
  }
}
示例#7
0
void JabberBrowser::addHistory(const QString &str)
{
    QStringList l;
    QString h = m_client->getBrowserHistory();
    while (h.length()){
        l.append(getToken(h, ';'));
    }
    QStringList::Iterator it;
    for (it = l.begin(); it != l.end(); ++it){
        if (*it == str){
            l.remove(it);
            break;
        }
    }
    l.prepend(str);
    QString res;
    Command cmd;
    cmd->id		= static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl;
    cmd->param	= this;
    Event eWidget(EventCommandWidget, cmd);
    CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process());
    if (cmbUrl)
        cmbUrl->clear();
    unsigned i = 0;
    for (it = l.begin(); it != l.end(); ++it){
        if (i++ > MAX_HISTORY)
            break;
        if (!res.isEmpty())
            res += ";";
        cmbUrl->insertItem(*it);
        res += quoteChars(*it, ";");
    }
    m_client->setBrowserHistory(res);
}
示例#8
0
KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg)
{
    KURL::List uris;

    if (KURLDrag::decode(e, uris) && (uris.count() > 0)) {
	KURL *url = new KURL(uris.first());

	KImageIO::registerFormats();
	if( KImageIO::canRead(KImageIO::type(url->fileName())) )
	    return url;

	QStringList qs = QStringList::split('\n', KImageIO::pattern());
	qs.remove(qs.begin());

	QString msg = i18n( "%1 "
			    "does not appear to be an image file.\n"
			    "Please use files with these extensions:\n"
			    "%2")
			    .arg(url->fileName())
			    .arg(qs.join("\n"));
	KMessageBox::sorry( wdg, msg);
	delete url;
    }
    return 0;
}
示例#9
0
void HistoryWindow::addHistory(const QString &str)
{
    QStringList l;
    QString h = CorePlugin::m_plugin->getHistorySearch();
    while (h.length()){
        l.append(getToken(h, ';'));
    }
    QStringList::Iterator it;
    for (it = l.begin(); it != l.end(); ++it){
        if (*it == str){
            l.remove(it);
            break;
        }
    }
    l.prepend(str);
    QString res;
    unsigned i = 0;
    for (it = l.begin(); it != l.end(); ++it){
        if (i++ > MAX_HISTORY)
            break;
        if (!res.isEmpty())
            res += ";";
        res += quoteChars(*it, ";");
    }
    CorePlugin::m_plugin->setHistorySearch(res);
}
示例#10
0
void JabberBrowser::addHistory(const QString &str)
{
    QStringList l;
    QString h = m_client->getBrowserHistory();
    while (h.length()) {
        l.append(getToken(h, ';'));
    }
    QStringList::Iterator it;
    for (it = l.begin(); it != l.end(); ++it) {
        if (*it == str) {
            l.remove(it);
            break;
        }
    }
    l.prepend(str);
    QString res;
    unsigned i = 0;
    for (it = l.begin(); it != l.end(); ++it) {
        if (i++ > MAX_HISTORY)
            break;
        if (!res.isEmpty())
            res += ";";
        res += quoteChars(*it, ";");
    }
    m_client->setBrowserHistory(res);
}
示例#11
0
void FX_SetupImpl::Init(QStringList c_avail)
{
  m_config->setGroup("Effect Stack Configuration");
  QStringList conf_active = m_config->readListEntry("Activated");
  QStringList c_active;
  QStringList::Iterator sit, it;
  
  listBox_Available->clear();
  listBox_Active->clear();
  c_active.clear();
  
  pushButton_removeAll->setEnabled(false);
  
  for (sit=conf_active.begin(); sit!=conf_active.end(); ++sit){
      it = c_avail.find(*sit);
      if ( it!=c_avail.end() ){ // active plugin as per config-file in pluginlist found
          c_active.append(*sit); // append to active list
          c_avail.remove(*sit); // remove active plugin from the list of avail plugins
      }
  }
    
  if ( !c_active.isEmpty() ){
      pushButton_removeAll->setEnabled(true);
  }
  
  // Fill ListBoxes
  for(it=c_avail.begin(); it!=c_avail.end(); ++it){
    listBox_Available->insertItem( (*it), -1 );  
  }
  for(it=c_active.begin(); it!=c_active.end(); ++it){
    listBox_Active->insertItem( (*it), -1 );
  }
}
示例#12
0
void addBackEnd::doRollBack()
{
	if (KMessageBox::warningContinueCancel(m_parent, i18n("<qt>This removes all your entries from the sidebar and adds the system default ones.<BR><B>This procedure is irreversible</B><BR>Do you want to proceed?</qt>"))==KMessageBox::Continue)
	{
		KStandardDirs *dirs = KGlobal::dirs();
		QString loc=dirs->saveLocation("data","konqsidebartng/" + m_currentProfile + "/",true);
		QDir dir(loc);
		QStringList dirEntries = dir.entryList( QDir::Dirs | QDir::NoSymLinks );
		dirEntries.remove(".");
		dirEntries.remove("..");
		for ( QStringList::Iterator it = dirEntries.begin(); it != dirEntries.end(); ++it ) {
			if ((*it)!="add")
				 KIO::NetAccess::del(KURL( loc+(*it) ), m_parent);
		}
		emit initialCopyNeeded();
	}
}
示例#13
0
void ManagerImpl::writeResourceConfig( Resource *resource, bool checkActive )
{
  QString key = resource->identifier();

  kdDebug(5650) << "Saving resource " << key << endl;

  if ( !mConfig ) createStandardConfig();

  mConfig->setGroup( "Resource_" + key );
  resource->writeConfig( mConfig );

  mConfig->setGroup( "General" );
  QString standardKey = mConfig->readEntry( "Standard" );

  if ( resource == mStandard  && standardKey != key )
    mConfig->writeEntry( "Standard", resource->identifier() );
  else if ( resource != mStandard && standardKey == key )
    mConfig->writeEntry( "Standard", "" );
  
  if ( checkActive ) {
    QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
    QStringList passiveKeys = mConfig->readListEntry( "PassiveResourceKeys" );
    if ( resource->isActive() ) {
      if ( passiveKeys.contains( key ) ) { // remove it from passive list
        passiveKeys.remove( key );
        mConfig->writeEntry( "PassiveResourceKeys", passiveKeys );
      }
      if ( !activeKeys.contains( key ) ) { // add it to active list
        activeKeys.append( key );
        mConfig->writeEntry( "ResourceKeys", activeKeys );
      }
    } else if ( !resource->isActive() ) {
      if ( activeKeys.contains( key ) ) { // remove it from active list
        activeKeys.remove( key );
        mConfig->writeEntry( "ResourceKeys", activeKeys );
      }
      if ( !passiveKeys.contains( key ) ) { // add it to passive list
        passiveKeys.append( key );
        mConfig->writeEntry( "PassiveResourceKeys", passiveKeys );
      }
    }
  }

  mConfig->sync();
}
示例#14
0
QStringList KSSLD::caList() {
QStringList x;
KConfig cfg("ksslcalist", true, false);

	x = cfg.groupList();
	x.remove("<default>");

return x;
}
示例#15
0
QFont KGlobalSettings::largeFont(const QString &text)
{
    QFontDatabase db;
    QStringList fam = db.families();

    // Move a bunch of preferred fonts to the front.
    if (fam.remove("Arial"))
       fam.prepend("Arial");
    if (fam.remove("Verdana"))
       fam.prepend("Verdana");
    if (fam.remove("Tahoma"))
       fam.prepend("Tahoma");
    if (fam.remove("Lucida Sans"))
       fam.prepend("Lucida Sans");
    if (fam.remove("Lucidux Sans"))
       fam.prepend("Lucidux Sans");
    if (fam.remove("Nimbus Sans"))
       fam.prepend("Nimbus Sans");
    if (fam.remove("Gothic I"))
       fam.prepend("Gothic I");

    if (_largeFont)
        fam.prepend(_largeFont->family());

    for(QStringList::ConstIterator it = fam.begin();
        it != fam.end(); ++it)
    {
        if (db.isSmoothlyScalable(*it) && !db.isFixedPitch(*it))
        {
            QFont font(*it);
            font.setPixelSize(75);
            QFontMetrics metrics(font);
            int h = metrics.height();
            if ((h < 60) || ( h > 90))
                continue;

            bool ok = true;
            for(unsigned int i = 0; i < text.length(); i++)
            {
                if (!metrics.inFont(text[i]))
                {
                    ok = false;
                    break;
                }
            }
            if (!ok)
                continue;

            font.setPointSize(48);
            _largeFont = new QFont(font);
            return *_largeFont;
        }
    }
    _largeFont = new QFont(KGlobalSettings::generalFont());
    _largeFont->setPointSize(48);
    return *_largeFont;
}
示例#16
0
void xInstaller::extAssign( AppEntry * app, QStringList slExt )
{
	toLog( "@ extAssign" );
	
	QStringList::Iterator it;
	
	QStringList slTypes;
	slTypes.clear();
	
	QFile file( MOD_MIME_TYPE );
	
    if ( !file.open( IO_ReadWrite ) )
		return;

	toLog( "Find exist type" );
	QTextStream stream( &file );
	QString line;
	while ( !stream.atEnd() ) 
	{
		line = stream.readLine(); // line of text excluding '\n'
		for ( int i=slExt.count()-1; i>=0; i-- ) 
		{
			it = slExt.at(i);
			if ( line.find( *it, line.find(" ") ) > 0 )
			{
				slTypes.append( line.left( line.find(" ") ) );
				slExt.remove( it );
			}
		}
	}
	
	toLog( "write ne types" );
	QString types;
	for ( it = slExt.begin(); it != slExt.end(); ++it ) 
	{
		types = "file/x-" + *it; 
		slTypes.append( types );
		stream << (types + " " + *it + "\n");
	}
	
	file.close();
	
	toLog( "write user mime" );
	ZConfig userMime ( MOD_USER_MIME );
	for ( it = slTypes.begin(); it != slTypes.end(); ++it ) 
	{
		userMime.writeEntry ( *it, "AppList", app->appId+";");
		userMime.writeEntry ( *it, "AppID", app->appId);
	}
	userMime.flush();
	
	toLog( "Send update mime" );
	QCopChannel::send("/AM/MimeRegistry", "update()");
}
示例#17
0
void AppLnk::setPreloaded(bool yesNo) {
  // Preload information is stored in the Launcher config in v1.5.
  Config cfg("Launcher");
  cfg.setGroup("Preload");
  QStringList apps = cfg.readListEntry("Apps", ',');
  if (apps.contains(exec()) && !yesNo)
    apps.remove(exec());
  else if (yesNo && !apps.contains(exec()))
    apps.append(exec());
  cfg.writeEntry("Apps", apps, ',');
}
示例#18
0
bool WordIterator::operator ++()
{
    if (words.count()){
        QStringList::Iterator it = words.begin();
        str = *it;
        words.remove(it);
        nWord = 0;
        return true;
    }
    str = getNextWord();
    return !str.isEmpty();
}
示例#19
0
void KateFileSelector::cmbPathReturnPressed( const QString& u )
{
  KURL typedURL( u );
  if ( typedURL.hasPass() )
    typedURL.setPass( QString::null );

  QStringList urls = cmbPath->urls();
  urls.remove( typedURL.url() );
  urls.prepend( typedURL.url() );
  cmbPath->setURLs( urls, KURLComboBox::RemoveBottom );
  dir->setFocus();
  dir->setURL( KURL(u), true );
}
示例#20
0
/*!
	Removes an event handler from the object
*/
void cUObject::removeEvent( const QString& name )
{
	cPythonScript *event = 0;

	if( scriptChain && hasEvent( name ) )
	{
		unsigned int count = reinterpret_cast< unsigned int >( scriptChain[0] );

		if( count == 1 )
		{
			clearEvents();
		}
		else
		{
			unsigned int pos = 1;

			cPythonScript **newScriptChain = new cPythonScript*[ count ];
			newScriptChain[0] = reinterpret_cast< cPythonScript* >( count - 1 );

			for( unsigned int i = 1; i < count; ++i )
			{
				if( scriptChain[i]->name() != name ) {
					newScriptChain[pos++] = scriptChain[i];
				} else {
					event = scriptChain[i];
				}
			}

			delete [] scriptChain;
			scriptChain = newScriptChain;
		}
	}

	if( eventList_ != QString::null )
	{
		QStringList eventList = QStringList::split( ",", eventList_ );
		eventList.remove( name );
		eventList_ = eventList.join( "," );

		if( eventList_.isEmpty() )
			eventList_ = QString::null;
	}

	changed_ = true;

	if (event && event->canHandleEvent(EVENT_ATTACH)) {
		PyObject *args = Py_BuildValue("(N)", getPyObject());
		event->callEvent(EVENT_ATTACH, args);
		Py_DECREF(args);
	}
}
示例#21
0
QString KProtocolManager::defaultUserAgent(const QString &_modifiers)
{
    if(!d)
        d = new KProtocolManagerPrivate;

    QString modifiers = _modifiers.lower();
    if(modifiers.isEmpty())
        modifiers = DEFAULT_USER_AGENT_KEYS;

    if(d->modifiers == modifiers)
        return d->useragent;

    QString supp;
    struct utsname nam;
    if(uname(&nam) >= 0)
    {
        if(modifiers.contains('o'))
        {
            supp += QString("; %1").arg(nam.sysname);
            if(modifiers.contains('v'))
                supp += QString(" %1").arg(nam.release);
        }
        if(modifiers.contains('p'))
        {
            // TODO: determine this value instead of hardcoding it...
            supp += QString::fromLatin1("; X11");
        }
        if(modifiers.contains('m'))
        {
            supp += QString("; %1").arg(nam.machine);
        }
        if(modifiers.contains('l'))
        {
            QStringList languageList = KGlobal::locale()->languageList();
            QStringList::Iterator it = languageList.find(QString::fromLatin1("C"));
            if(it != languageList.end())
            {
                if(languageList.contains(QString::fromLatin1("en")) > 0)
                    languageList.remove(it);
                else
                    (*it) = QString::fromLatin1("en");
            }
            if(languageList.count())
                supp += QString("; %1").arg(languageList.join(", "));
        }
    }
    d->modifiers = modifiers;
    d->useragent = CFG_DEFAULT_UAGENT(supp);
    return d->useragent;
}
示例#22
0
QCString combinePath( const char *infile, const char *outfile )
{
    QFileInfo inFileInfo( QDir::current(), QFile::decodeName(infile) );
    QFileInfo outFileInfo( QDir::current(), QFile::decodeName(outfile) );
    int numCommonComponents = 0;

    QStringList inSplitted =
	QStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE );
    QStringList outSplitted =
	QStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE );

    while ( !inSplitted.isEmpty() && !outSplitted.isEmpty() &&
	    inSplitted.first() == outSplitted.first() ) {
	inSplitted.remove( inSplitted.begin() );
	outSplitted.remove( outSplitted.begin() );
	numCommonComponents++;
    }

    if ( numCommonComponents < 2 ) {
	/*
	  The paths don't have the same drive, or they don't have the
	  same root directory. Use an absolute path.
	*/
	return QFile::encodeName( inFileInfo.absFilePath() );
    } else {
	/*
	  The paths have something in common. Use a path relative to
	  the output file.
	*/
	while ( !outSplitted.isEmpty() ) {
	    outSplitted.remove( outSplitted.begin() );
	    inSplitted.prepend( ".." );
	}
	inSplitted.append( inFileInfo.fileName() );
	return QFile::encodeName( inSplitted.join("/") );
    }
}
示例#23
0
void DocumentList::reloadAppLnks()
{
    if ( d->sendAppLnks && d->serverGui ) {
    d->serverGui->applicationScanningProgress( 0 );
    d->serverGui->allApplicationsRemoved();
    }

    delete appLnkSet;
    appLnkSet = new AppLnkSet( MimeType::appsFolderName() );

    if ( d->sendAppLnks && d->serverGui ) {
    static QStringList prevTypeList;
    QStringList types = appLnkSet->types();
    for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
        if ( !(*ittypes).isEmpty() ) {
        if ( !prevTypeList.contains(*ittypes) ) {
            QString name = appLnkSet->typeName(*ittypes);
            QPixmap pm = appLnkSet->typePixmap(*ittypes);
            QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);

            if (pm.isNull())
            {
                pm = OResource::loadImage( "UnknownDocument", OResource::SmallIcon );
                bgPm = OResource::loadImage( "UnknownDocument", OResource::BigIcon );
            }

            //FIXME our current launcher expects docs tab to be last
            d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
        }
        prevTypeList.remove(*ittypes);
        }
    }
    for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
        d->serverGui->typeRemoved(*ittypes);
    }
    prevTypeList = types;
    }

    QListIterator<AppLnk> itapp( appLnkSet->children() );
    AppLnk* l;
    while ( (l=itapp.current()) ) {
    ++itapp;
    if ( d->sendAppLnks && d->serverGui )
        d->serverGui->applicationAdded( l->type(), *l );
    }

    if ( d->sendAppLnks && d->serverGui )
    d->serverGui->applicationScanningProgress( 100 );
}
示例#24
0
QString HelpProtocol::langLookup(const QString &fname)
{
    QStringList search;

    // assemble the local search paths
    const QStringList localDoc = KGlobal::dirs()->resourceDirs("html");

    QStringList langs = KGlobal::locale()->languageList();
    langs.append("en");
    langs.remove("C");

    // this is kind of compat hack as we install our docs in en/ but the
    // default language is en_US
    for(QStringList::Iterator it = langs.begin(); it != langs.end(); ++it)
        if(*it == "en_US")
            *it = "en";

    // look up the different languages
    int ldCount = localDoc.count();
    for(int id = 0; id < ldCount; id++)
    {
        QStringList::ConstIterator lang;
        for(lang = langs.begin(); lang != langs.end(); ++lang)
            search.append(QString("%1%2/%3").arg(localDoc[id], *lang, fname));
    }

    // try to locate the file
    QStringList::Iterator it;
    for(it = search.begin(); it != search.end(); ++it)
    {
        kdDebug(7119) << "Looking for help in: " << *it << endl;

        QFileInfo info(*it);
        if(info.exists() && info.isFile() && info.isReadable())
            return *it;

        if((*it).right(5) == ".html")
        {
            QString file = (*it).left((*it).findRev('/')) + "/index.docbook";
            kdDebug(7119) << "Looking for help in: " << file << endl;
            info.setFile(file);
            if(info.exists() && info.isFile() && info.isReadable())
                return *it;
        }
    }


    return QString::null;
}
示例#25
0
void kio_videodvdProtocol::listDir( const KURL& url )
{
  if( url.path() == "/" ) {
    listVideoDVDs();
  }
  else {
    QString isoPath;
    K3bIso9660* iso = openIso( url, isoPath );
    if( iso ) {
      const K3bIso9660Directory* mainDir = iso->firstIsoDirEntry();
      const K3bIso9660Entry* e = mainDir->entry( isoPath );
      if( e ) {
	if( e->isDirectory() ) {
	  const K3bIso9660Directory* dir = static_cast<const K3bIso9660Directory*>(e);
	  QStringList el = dir->entries();
	  el.remove( "." );
	  el.remove( ".." );
	  UDSEntryList udsl;
	  for( QStringList::const_iterator it = el.begin(); it != el.end(); ++it )
	    udsl.append( createUDSEntry( dir->entry( *it ) ) );
	  listEntries( udsl );
	  finished();
	}
	else {
	  error( ERR_CANNOT_ENTER_DIRECTORY, url.path() );
	}
      }
      else {
	error( ERR_CANNOT_ENTER_DIRECTORY, url.path() );
      }

      // for testing we always do the whole thing
      delete iso;
    }
  }
}
示例#26
0
QStringList KACLListView::allowedGroups(bool defaults, KACLListViewItem *allowedItem)
{
    QStringList allowedGroups = m_allGroups;
    QListViewItemIterator it(this);
    while(it.current())
    {
        const KACLListViewItem *item = static_cast< const KACLListViewItem * >(*it);
        ++it;
        if(!item->type == NamedGroup || item->isDefault != defaults)
            continue;
        if(allowedItem && item == allowedItem && allowedItem->isDefault == defaults)
            continue;
        allowedGroups.remove(item->qualifier);
    }
    return allowedGroups;
}
示例#27
0
//
// This function advices whether a single KHttpCookie object should
// be added to the cookie jar.
//
KCookieAdvice KCookieJar::cookieAdvice(KHttpCookiePtr cookiePtr)
{
    if (m_rejectCrossDomainCookies && cookiePtr->isCrossDomain())
       return KCookieReject;

    QStringList domains;

    extractDomains(cookiePtr->host(), domains);

    // If the cookie specifies a domain, check whether it is valid. Otherwise,
    // accept the cookie anyways but remove the domain="" value to prevent
    // cross-site cookie injection.
    if (!cookiePtr->domain().isEmpty())
    {
      if (!domains.contains(cookiePtr->domain()) && 
          !cookiePtr->domain().endsWith("."+cookiePtr->host()))
          cookiePtr->fixDomain(QString::null);
    }

    if (m_autoAcceptSessionCookies && (cookiePtr->expireDate() == 0 ||
        m_ignoreCookieExpirationDate))
       return KCookieAccept;

    KCookieAdvice advice = KCookieDunno;
    bool isFQDN = true; // First is FQDN
    QStringList::Iterator it = domains.begin(); // Start with FQDN which first in the list.
    while( (advice == KCookieDunno) && (it != domains.end()))
    {
       QString domain = *it;
       // Check if a policy for the FQDN/domain is set.
       if ( domain[0] == '.' || isFQDN )
       {
          isFQDN = false;
          KHttpCookieList *cookieList = m_cookieDomains[domain];
          if (cookieList)
             advice = cookieList->getAdvice();
       }
       domains.remove(it);
       it = domains.begin(); // Continue from begin of remaining list
    }

    if (advice == KCookieDunno)
        advice = m_globalAdvice;

    return advice;
}
示例#28
0
void MainWindow::removeSelectedFromBookmarks(void)
{
  QListViewItem *item = stationView->selectedItem();
  assert(item != 0);
  QStringList bookmarks = Settings::instance()->bookmarks();
  QStringList::iterator it = bookmarks.find(item->text(0));
  if (it != bookmarks.end())
  {
    bookmarks.remove(it);
    Settings::instance()->setBookmarks(bookmarks);
    item = explorerView->selectedItem();
    if (item != 0)
    {
      explorerViewClicked(item);
    }    
  }
} /* MainWindow::removeSelectedFromBookmarks */
示例#29
-1
void ManagerImpl::removeResource( Resource *resource )
{
  QString key = resource->identifier();

  if ( !mConfig ) createStandardConfig();
  
  mConfig->setGroup( "General" );
  QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
  if ( activeKeys.contains( key ) ) {
    activeKeys.remove( key );
    mConfig->writeEntry( "ResourceKeys", activeKeys );
  } else {
    QStringList passiveKeys = mConfig->readListEntry( "PassiveResourceKeys" );
    passiveKeys.remove( key );
    mConfig->writeEntry( "PassiveResourceKeys", passiveKeys );
  }

  QString standardKey = mConfig->readEntry( "Standard" );
  if ( standardKey == key ) {
    mConfig->writeEntry( "Standard", "" );
  }

  mConfig->deleteGroup( "Resource_" + resource->identifier() );
  mConfig->sync();
}
示例#30
-1
  bool countDir( const QString& dir ) {
    const QString& dot = KGlobal::staticQString( "." );
    const QString& dotdot = KGlobal::staticQString( ".." );
    QStringList l = QDir(dir).entryList( QDir::All|QDir::Hidden|QDir::System );
    l.remove( dot );
    l.remove( dotdot );

    return countFiles( l, dir );
  }