예제 #1
0
// static
TQStringList TDEIconTheme::list()
{
    // Static pointer because of unloading problems wrt DSO's.
    if (_theme_list != 0L)
        return *_theme_list;

    _theme_list = new TQStringList();
    TQStringList icnlibs = TDEGlobal::dirs()->resourceDirs("icon");
    icnlibs += (TDEGlobal::dirs()->resourceDirs("xdgdata-icon"));
    icnlibs += "/usr/share/pixmaps";
    // These are not in the icon spec, but e.g. GNOME puts some icons there anyway.
    icnlibs += TDEGlobal::dirs()->resourceDirs("xdgdata-pixmap");
    TQStringList::ConstIterator it;
    for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
    {
        TQDir dir(*it);
        if (!dir.exists())
            continue;
        TQStringList lst = dir.entryList(TQDir::Dirs);
        TQStringList::ConstIterator it2;
        for (it2=lst.begin(); it2!=lst.end(); ++it2)
        {
            if ((*it2 == ".") || (*it2 == "..") || (*it2).startsWith("default.") )
                continue;
            if (!TDEStandardDirs::exists(*it + *it2 + "/index.desktop") && !TDEStandardDirs::exists(*it + *it2 + "/index.theme"))
                continue;
		TDEIconTheme oink(*it2);
	    if (!oink.isValid()) continue;

	    if (!_theme_list->contains(*it2))
                _theme_list->append(*it2);
        }
    }
    return *_theme_list;
}
예제 #2
0
void KXmlCommandDlg::setCommand(KXmlCommand *xmlCmd)
{
	setCaption(i18n("Command Edit for %1").arg(xmlCmd->name()));

	m_cmd = xmlCmd;
	m_description->setText(i18n(xmlCmd->description().utf8()));
	m_idname->setText(xmlCmd->name());

	m_requirements->clear();
	TQStringList	list = xmlCmd->requirements();
	TQListViewItem	*item(0);
	for (TQStringList::ConstIterator it=list.begin(); it!=list.end(); ++it)
	{
		item = new TQListViewItem(m_requirements, item, *it);
		item->setRenameEnabled(0, true);
	}

	int	index = m_mimelist.findIndex(xmlCmd->mimeType());
	if (index != -1)
		m_mimetype->setCurrentItem(index);
	else
		m_mimetype->setCurrentItem(0);

	list = xmlCmd->inputMimeTypes();
	m_selectedmime->clear();
	m_availablemime->clear();
	m_availablemime->insertStringList(m_mimelist);
	for (TQStringList::ConstIterator it=list.begin(); it!=list.end(); ++it)
	{
		m_selectedmime->insertItem(*it);
		delete m_availablemime->findItem(*it, TQt::ExactMatch);
	}
}
예제 #3
0
파일: legacy.cpp 프로젝트: Fat-Zer/tdebase
/*!
  Restores legacy session management data (i.e. restart applications)
*/
void KSMServer::restoreLegacySession( TDEConfig* config )
{
    if( config->hasGroup( "Legacy" + sessionGroup )) {
        TDEConfigGroupSaver saver( config, "Legacy" + sessionGroup );
        restoreLegacySessionInternal( config );
    } else if( wm == "twin" ) { // backwards comp. - get it from twinrc
	TDEConfigGroupSaver saver( config, sessionGroup );
	int count =  config->readNumEntry( "count", 0 );
	for ( int i = 1; i <= count; i++ ) {
    	    TQString n = TQString::number(i);
    	    if ( config->readEntry( TQString("program")+n ) != wm )
                continue;
    	    TQStringList restartCommand =
                config->readListEntry( TQString("restartCommand")+n );
	    for( TQStringList::ConstIterator it = restartCommand.begin();
		 it != restartCommand.end();
		 ++it ) {
		if( (*it) == "-session" ) {
		    ++it;
		    if( it != restartCommand.end()) {
			TDEConfig cfg( "session/" + wm + "_" + (*it), true );
			cfg.setGroup( "LegacySession" );
			restoreLegacySessionInternal( &cfg, ' ' );
		    }
		}
	    }
	}
    }
}
예제 #4
0
void TDECompletion::insertItems( const TQStringList& items )
{
    bool weighted = (myOrder == Weighted);
    TQStringList::ConstIterator it;
    if ( weighted ) { // determine weight
        for ( it = items.begin(); it != items.end(); ++it )
            addWeightedItem( *it );
    }
    else {
        for ( it = items.begin(); it != items.end(); ++it )
            addItem( *it, 0 );
    }
}
예제 #5
0
void ZoneClock::editClock()
{
  ClockDialog *_dlg = new ClockDialog(this, 0, true);
  CityList cities;
  TQStringList timezones = cities.timezones();
  for (TQStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
    _dlg->ClockZone->insertItem(i18n((*it).utf8()));

  _dlg->ClockCaption->setText(_nameLabel->text().left(_nameLabel->text().length()-1));
  for (int i=0; i<_dlg->ClockZone->count(); ++i)
    if (_dlg->ClockZone->text(i) == i18n(_zone.utf8()))
      {
        _dlg->ClockZone->setCurrentItem(i);
        break;
      }

  if (_dlg->exec() == TQDialog::Accepted)
    {
      _zone = timezones[_dlg->ClockZone->currentItem()];
      _name = _dlg->ClockCaption->text().append(":");
      _nameLabel->setText(_dlg->ClockCaption->text().append(":"));
      updateTime();
      layout()->invalidate();
      emit changed();
    }

  delete _dlg;
}
예제 #6
0
TQString KStringHandler::word( const TQString &text , const char *range )
{
    // Format in: START:END
    // Note index starts a 0 (zero)
    //
    // 0:        first word to end
    // 1:3        second to fourth words
    TQStringList list = TQStringList::split( " ", text , true );
    TQString tmp = "";
    TQString r = range;

    if ( text.isEmpty() )
        return tmp;

    uint pos = 0, cnt = list.count();
    parsePythonRange( range, pos, cnt );

    //
    // Extract words
    //
    int wordsToExtract = cnt-pos+1;
    TQStringList::Iterator it = list.at( pos);

    while ( (it != list.end()) && (wordsToExtract-- > 0))
    {
       tmp += *it;
       tmp += " ";
       it++;
    }

    return tmp.stripWhiteSpace();
}
예제 #7
0
TQString KStringHandler::remrange( const TQString &text , const char *range )
{
    // Format in: START:END
    // Note index starts a 0 (zero)
    //
    // 0:        first word to end
    // 1:3        second to fourth words
    TQStringList list = TQStringList::split( " ", text , true );
    TQString tmp = "";
    TQString r = range;

    if ( text.isEmpty() )
        return tmp;

    uint pos = 0, cnt = list.count();
    parsePythonRange( range, pos, cnt );

    //
    // Remove that range of words
    //
    int wordsToDelete = cnt-pos+1;
    TQStringList::Iterator it = list.at( pos);

    while ( (it != list.end()) && (wordsToDelete-- > 0))
       it = list.remove( it );

    return list.join( " " );
}
예제 #8
0
void recursive_transfer(const KArchiveDirectory * dir,
	    const TQString & path, KZip * zip)
{
    TQStringList l = dir->entries();
    TQStringList::Iterator it = l.begin();
    for( ; it != l.end(); ++it )
    {
        const KArchiveEntry* e = dir->entry( (*it) );
	kdDebug() << "actual file: " << e->name() << endl;
	if (e->isFile())
	{
    	    Q_ASSERT( e && e->isFile() );
    	    const KArchiveFile* f = (KArchiveFile*)e;
    	    printf("FILE=%s\n", e->name().latin1());

    	    TQByteArray arr( f->data() );
    	    printf("SIZE=%i\n",arr.size() );
    	    TQString str( arr );
    	    printf("DATA=%s\n", str.latin1());

	    if (e->symlink().isEmpty()) {
	        zip->writeFile( path+e->name().latin1(),
			    "holgi", "holgrp",
			    arr.size() , f->data() );
	    } else
	        zip->writeSymLink(path+e->name(), e->symlink(), "leo", "leo",
				0120777, 1000000000l, 1000000000l, 1000000000l);
	}
	else if (e->isDirectory())
	{
	    recursive_transfer((KArchiveDirectory *)e ,
			path+e->name()+"/", zip);
	}
    }
}
예제 #9
0
TQStringList IconThemesConfig::findThemeDirs(const TQString &archiveName)
{
  TQStringList foundThemes;

  KTar archive(archiveName);
  archive.open(IO_ReadOnly);
  const KArchiveDirectory* themeDir = archive.directory();

  KArchiveEntry* possibleDir = 0L;
  KArchiveDirectory* subDir = 0L;

  // iterate all the dirs looking for an index.theme or index.desktop file
  TQStringList entries = themeDir->entries();
  for (TQStringList::Iterator it = entries.begin();
       it != entries.end();
       ++it) {
    possibleDir = const_cast<KArchiveEntry*>(themeDir->entry(*it));
    if (possibleDir->isDirectory()) {
      subDir = dynamic_cast<KArchiveDirectory*>( possibleDir );
      if (subDir && (subDir->entry("index.theme") != NULL ||
                     subDir->entry("index.desktop") != NULL))
        foundThemes.append(subDir->name());
    }
  }

  archive.close();
  return foundThemes;
}
예제 #10
0
void TDMAppearanceWidget::loadGuiStyles(KBackedComboBox *combo)
{
  // XXX: Global + local schemes
  TQStringList list = TDEGlobal::dirs()->
      findAllResources("data", "tdestyle/themes/*.themerc", false, true);
  for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
  {
    KSimpleConfig config(*it, true);

    if (!(config.hasGroup("KDE") && config.hasGroup("Misc")))
	continue;

    config.setGroup("Desktop Entry");
    if (config.readBoolEntry("Hidden", false))
	continue;

    config.setGroup("KDE");
    TQString str2 = config.readEntry("WidgetStyle");
    if (str2.isNull())
	continue;

    config.setGroup("Misc");
    combo->insertItem( str2, config.readEntry("Name") );
  }
}
예제 #11
0
void KMDriverDB::init(TQWidget *parent)
{
	TQFileInfo	dbfi(dbFile());
	TQString		dirname = KMFactory::self()->manager()->driverDirectory();
	TQStringList	dbDirs = TQStringList::split(':', dirname, false);
	bool	createflag(false);

	for (TQStringList::ConstIterator it=dbDirs.begin(); it!=dbDirs.end() && !createflag; ++it)
		if (!(*it).startsWith("module:") && !m_creator->checkDriverDB(*it, dbfi.lastModified()))
			createflag = true;

	if (createflag)
	{
		// starts DB creation and wait for creator signal
		if (!m_creator->createDriverDB(dirname,dbfi.absFilePath(),parent))
			KMessageBox::error(parent, KMFactory::self()->manager()->errorMsg().prepend("<qt>").append("</qt>"));
	}
	else if (m_entries.count() == 0)
	{
		// call directly the slot as the DB won't be re-created
		// this will (re)load the driver DB
		slotDbCreated();
	}
	else
		// no need to refresh, and already loaded, just emit signal
		emit dbLoaded(false);
}
예제 #12
0
void TDERecentDocument::clear()
{
  TQStringList list = recentDocuments();
  TQDir dir;
  for(TQStringList::Iterator it = list.begin(); it != list.end() ; ++it)
    dir.remove(*it);
}
예제 #13
0
파일: kssld.cpp 프로젝트: Fat-Zer/tdelibs
void KSSLD::searchAddCert(KSSLCertificate *cert) {
	skMD5Digest.insert(cert->getMD5Digest(), cert, true);

	TQStringList mails;
	cert->getEmails(mails);
	for(TQStringList::const_iterator iter = mails.begin(); iter != mails.end(); ++iter) {
		TQString email = static_cast<const TQString &>(*iter).lower();
		TQMap<TQString, TQPtrVector<KSSLCertificate> >::iterator it = skEmail.find(email);

		if (it == skEmail.end())
			it = skEmail.insert(email, TQPtrVector<KSSLCertificate>());

		TQPtrVector<KSSLCertificate> &elem = *it;
		
		if (elem.findRef(cert) == -1) {
			unsigned int n = 0;
			for(; n < elem.size(); n++) {
				if (!elem.at(n)) {
					elem.insert(n, cert);
					break;
				}
			}
			if (n == elem.size()) {
				elem.resize(n+1);
				elem.insert(n, cert);
			}
		}
	}	
}
예제 #14
0
void SevenZipArch::addFile( const TQStringList & urls )
{
  TDEProcess *kp = m_currentProcess = new TDEProcess;

  kp->clearArguments();
  *kp << m_archiver_program << "a" ;

  if ( !m_password.isEmpty() )
    *kp << "-p" + m_password;

  KURL url( urls.first() );
  TQDir::setCurrent( url.directory() );

  *kp << m_filename;

  TQStringList::ConstIterator iter;
  for ( iter = urls.begin(); iter != urls.end(); ++iter )
  {
    KURL url( *iter );
    *kp << url.fileName();
  }

  connect( kp, TQT_SIGNAL( receivedStdout(TDEProcess*, char*, int) ),
           TQT_SLOT( slotReceivedOutput(TDEProcess*, char*, int) ) );
  connect( kp, TQT_SIGNAL( receivedStderr(TDEProcess*, char*, int) ),
           TQT_SLOT( slotReceivedOutput(TDEProcess*, char*, int) ) );
  connect( kp, TQT_SIGNAL( processExited(TDEProcess*) ),
           TQT_SLOT( slotAddExited(TDEProcess*) ) );

  if ( !kp->start( TDEProcess::NotifyOnExit, TDEProcess::AllOutput ) )
  {
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
    emit sigAdd( false );
  }
}
예제 #15
0
void ShortcutsModule::readSchemeNames()
{
	TQStringList schemes = TDEGlobal::dirs()->findAllResources("data", "kcmkeys/*.kksrc");

	m_pcbSchemes->clear();
	m_rgsSchemeFiles.clear();

	i18n("User-Defined Scheme");
	m_pcbSchemes->insertItem( i18n("Current Scheme") );
	m_rgsSchemeFiles.append( "cur" );

	// This for system files
	for ( TQStringList::ConstIterator it = schemes.begin(); it != schemes.end(); ++it) {
	// KPersonalizer relies on .kksrc files containing all the keyboard shortcut
	//  schemes for various setups.  It also requires the TDE defaults to be in
	//  a .kksrc file.  The TDE defaults shouldn't be listed here.
		//if( r.search( *it ) != -1 )
		//   continue;

		KSimpleConfig config( *it, true );
		config.setGroup( "Settings" );
		TQString str = config.readEntry( "Name" );

		m_pcbSchemes->insertItem( str );
		m_rgsSchemeFiles.append( *it );
	}
}
예제 #16
0
static void printList( const TQStringList& list )
{
    TQStringList::ConstIterator it = list.begin();
    for ( ; it != list.end(); ++it )
        cout << (*it).local8Bit().data() << endl;
    cout << endl;
}
예제 #17
0
TQString TDEStorageDevice::mountPath() {
	// See if this device node is mounted
	// This requires parsing /proc/mounts, looking for deviceNode()

	// The Device Mapper throws a monkey wrench into this
	// It likes to advertise mounts as /dev/mapper/<something>,
	// where <something> is listed in <system path>/dm/name

	// First, ensure that all device information (mainly holders/slaves) is accurate
	TDEGlobal::hardwareDevices()->rescanDeviceInformation(this);

	TQString dmnodename = systemPath();
	dmnodename.append("/dm/name");
	TQFile namefile( dmnodename );
	TQString dmaltname;
	if ( namefile.open( IO_ReadOnly ) ) {
		TQTextStream stream( &namefile );
		dmaltname = stream.readLine();
		namefile.close();
	}
	if (!dmaltname.isNull()) {
		dmaltname.prepend("/dev/mapper/");
	}

	TQStringList lines;
	TQFile file( "/proc/mounts" );
	if ( file.open( IO_ReadOnly ) ) {
		TQTextStream stream( &file );
		TQString line;
		while ( !stream.atEnd() ) {
			line = stream.readLine();
			TQStringList mountInfo = TQStringList::split(" ", line, true);
			TQString testNode = *mountInfo.at(0);
			// Check for match
			if ((testNode == deviceNode()) || (testNode == dmaltname) || (testNode == ("/dev/disk/by-uuid/" + diskUUID()))) {
				TQString ret = *mountInfo.at(1);
				ret.replace("\\040", " ");
				return ret;
			}
			lines += line;
		}
		file.close();
	}

	// While this device is not directly mounted, it could concievably be mounted via the Device Mapper
	// If so, try to retrieve the mount path...
	TQStringList slaveDeviceList = holdingDevices();
	for ( TQStringList::Iterator slavedevit = slaveDeviceList.begin(); slavedevit != slaveDeviceList.end(); ++slavedevit ) {
		// Try to locate this device path in the TDE device tree
		TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
		TDEGenericDevice *hwdevice = hwdevices->findBySystemPath(*slavedevit);
		if ((hwdevice) && (hwdevice->type() == TDEGenericDeviceType::Disk)) {
			TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
			return sdevice->mountPath();
		}
	}

	return TQString::null;
}
예제 #18
0
TQStringList KStringHandler::capwords( const TQStringList &list )
{
    TQStringList tmp = list;
    for ( TQStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it ) {
        *it = ( *it )[ 0 ].upper() + ( *it ).mid( 1 );
    }
    return tmp;
}
예제 #19
0
void ConfigWidget::setCorrectLanguage( const TQStringList& langs)
{
    int idx = 0;
    for ( TQStringList::const_iterator itr = langs.begin();
          itr != langs.end(); ++itr, ++idx ) {
        if ( *itr == d->broker->settings()->defaultLanguage() )
            d->ui->m_langCombo->setCurrentItem( idx );
    }
}
예제 #20
0
void KMConfigFonts::loadConfig(TDEConfig *)
{
	TQSettings	settings;
	m_embedfonts->setChecked(settings.readBoolEntry("/qt/embedFonts", true));
	TQStringList	paths = settings.readListEntry("/qt/fontPath", ':');
	TQListViewItem	*item(0);
	for (TQStringList::ConstIterator it=paths.begin(); it!=paths.end(); ++it)
		item = new TQListViewItem(m_fontpath, item, *it);
}
예제 #21
0
void EditAction::updateDCOPFunctions()
{
	theDCOPFunctions->clear();
	if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return;
	TQStringList functions = AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], theDCOPObjects->currentText());
	if(!functions.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPFunctions->insertItem((*theAction).method().prototype());
	for(TQStringList::iterator i = functions.begin(); i != functions.end(); ++i)
		theDCOPFunctions->insertItem(*i);
	updateArguments();
}
예제 #22
0
TQString KMountPoint::devNameFromOptions(const TQStringList &options)
{
   // Search options to find the device name
   for ( TQStringList::ConstIterator it = options.begin(); it != options.end(); ++it)
   {
      if( (*it).startsWith("dev="))
         return TQString(*it).remove("dev=");
   } 
   return TQString("none");
}
예제 #23
0
TQString LprHandler::locateDir(const TQString& dirname, const TQString& paths)
{
	TQStringList	pathlist = TQStringList::split(':', paths, false);
	for (TQStringList::ConstIterator it=pathlist.begin(); it!=pathlist.end(); ++it)
	{
		TQString	testpath = *it + "/" + dirname;
		if (::access(TQFile::encodeName(testpath), F_OK) == 0)
			return testpath;
	}
	return TQString::null;
}
예제 #24
0
void ZoneClockPanel::createDialog()
{
  if (!_dlg)
    {
      _dlg = new ClockDialog(this, 0, true);
      CityList cities;
      TQStringList timezones = cities.timezones();
      for (TQStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
        _dlg->ClockZone->insertItem(i18n((*it).utf8()));
    }
}
예제 #25
0
// static
TQStringList FileProps::createKeyValueList( const KFileMetaInfoGroup& g,
                                           const TQStringList& keys )
{
    TQStringList result;
    TQStringList::ConstIterator it = keys.begin();

    for ( ; it != keys.end(); ++it )
        result.append( FileProps::createKeyValue( g, *it ) );

    return result;
}
예제 #26
0
void KSim::SwapPrefs::readConfig(KSim::Config *config)
{
  m_swapCheck->setChecked(config->showSwap());

  TQStringList::ConstIterator it;
  TQStringList items = config->swapFormatList();
  for (it = items.begin(); it != items.end(); ++it)
    if (!m_swapCombo->contains(*it))
      m_swapCombo->insertItem(*it);

  m_swapCombo->setCurrentItem(config->swapItem());
}
예제 #27
0
void QuickLauncher::loadConfig()
{
    DEBUGSTR << "QuickLauncher::loadConfig()" << endl << flush;
    //TDEConfig *c = config();
    //c->setGroup("General");
    setConserveSpace(m_settings->conserveSpace());
    setDragEnabled(m_settings->dragEnabled());
    /*DEBUGSTR << "    IconDim="<<m_iconDim << endl << flush;
    DEBUGSTR << "    ConserveSpace=" << (m_manager->conserveSpace()) << 
        endl << flush;
    DEBUGSTR << "    DragEnabled=" << isDragEnabled() << endl << flush;*/
    TQStringList volatileButtons = m_settings->volatileButtons();
    TQStringList urls = m_settings->buttons();
    if (m_settings->showDesktopEnabled()) {
        if (!urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP"))
            urls.prepend("SPECIAL_BUTTON__SHOW_DESKTOP");
    }
    else {
        if (urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP"))
            urls.remove("SPECIAL_BUTTON__SHOW_DESKTOP");
    }
    kdDebug() << "GetButtons " << urls.join("/") << endl;
    TQStringList::Iterator iter(urls.begin());
    int n = 0;
    while (iter != urls.end()) {
        TQString url = *iter;
        addApp(url, n, false);
        ++iter;
        ++n;
    }

    // Restore sticky state
    for (n=0; n<int(m_buttons->size()); ++n)
    {
        QuickButton* button = (*m_buttons)[n];
        if (volatileButtons.contains(button->menuId()) == false)
        {
            button->setSticky(true);
        }
        button->setDynamicModeEnabled(m_settings->autoAdjustEnabled());
    }

    m_popularity->readConfig(m_settings);
    m_popularity->setHistoryHorizon(m_settings->historyHorizon()/100.0);

    TQStringList serviceNames = m_settings->serviceNames();
    TQValueList<int> insPos = m_settings->serviceInspos();
    for (int n=std::min(serviceNames.size(),insPos.size())-1; n>=0; --n)
    {
        m_appOrdering[serviceNames[n]] = insPos[n];
    }
}
예제 #28
0
TQString TDEStorageDevice::determineFileSystemType(TQString path) {
	TQStringList mountTable;
	TQString prevPath = path;
	dev_t prevDev = 0;
	int pos;
	struct stat directory_info;
	if (path.startsWith("/")) {
		stat(path.local8Bit(), &directory_info);
		prevDev = directory_info.st_dev;
		// Walk the directory tree up to the root, checking for any change in st_dev
		// If a change is found, the previous value of path is the mount point itself
		while (path != "/") {
			pos = path.findRev("/", -1, TRUE);
			if (pos < 0) {
				break;
			}
			path = path.mid(0, pos);
			if (path == "") {
				path = "/";
			}
			stat(path.local8Bit(), &directory_info);
			if (directory_info.st_dev != prevDev) {
				break;
			}
			prevPath = path;
			prevDev = directory_info.st_dev;
		}
	}

	// Read in mount table
	mountTable.clear();
	TQFile file( "/proc/mounts" );
	if ( file.open( IO_ReadOnly ) ) {
		TQTextStream stream( &file );
		while ( !stream.atEnd() ) {
			mountTable.append(stream.readLine());
		}
		file.close();
	}

	// Parse mount table
	TQStringList::Iterator it;
	for ( it = mountTable.begin(); it != mountTable.end(); ++it ) {
		TQStringList mountInfo = TQStringList::split(" ", (*it), true);
		if ((*mountInfo.at(1)) == prevPath) {
			return (*mountInfo.at(2));
		}
	}

	// Unknown file system type
	return TQString::null;
}
예제 #29
0
TQMap<TQString, TQString> MANProtocol::buildIndexMap(const TQString &section)
{
    TQMap<TQString, TQString> i;
    TQStringList man_dirs = manDirectories();
    // Supplementary places for whatis databases
    man_dirs += m_mandbpath;
    if (man_dirs.find("/var/cache/man")==man_dirs.end())
        man_dirs << "/var/cache/man";
    if (man_dirs.find("/var/catman")==man_dirs.end())
        man_dirs << "/var/catman";
    
    TQStringList names;
    names << "whatis.db" << "whatis";
    TQString mark = "\\s+\\(" + section + "[a-z]*\\)\\s+-\\s+";

    for ( TQStringList::ConstIterator it_dir = man_dirs.begin();
          it_dir != man_dirs.end();
          ++it_dir )
    {
        if ( TQFile::exists( *it_dir ) ) {
    	    TQStringList::ConstIterator it_name;
            for ( it_name = names.begin();
	          it_name != names.end();
	          it_name++ )
            {
	        if (addWhatIs(i, (*it_dir) + "/" + (*it_name), mark))
		    break;
	    }
            if ( it_name == names.end() ) {
                TDEProcess proc;
                proc << "whatis" << "-M" << (*it_dir) << "-w" << "*";
                myStdStream = TQString::null;
                connect( &proc, TQT_SIGNAL( receivedStdout(TDEProcess *, char *, int ) ),
                         TQT_SLOT( slotGetStdOutput( TDEProcess *, char *, int ) ) );
                proc.start( TDEProcess::Block, TDEProcess::Stdout );
                TQTextStream t( &myStdStream, IO_ReadOnly );
                parseWhatIs( i, t, mark );
            }
        }
예제 #30
0
static TQString qrichtextify( const TQString& text )
{
  if ( text.isEmpty() || text[0] == '<' )
    return text;

  TQStringList lines = TQStringList::split('\n', text);
  for(TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it)
  {
    *it = TQStyleSheet::convertFromPlainText( *it, TQStyleSheetItem::WhiteSpaceNormal );
  }

  return lines.join(TQString());
}