void KateSearch::addToList( TQStringList& list, const TQString& s ) { if( list.count() > 0 ) { TQStringList::Iterator it = list.find( s ); if( *it != 0L ) list.remove( it ); if( list.count() >= 16 ) list.remove( list.fromLast() ); } list.prepend( s ); }
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( " " ); }
KURL *decodeImgDrop(TQDropEvent *e, TQWidget *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; TQStringList qs = TQStringList::split('\n', KImageIO::pattern()); qs.remove(qs.begin()); TQString 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; }
TQStringList KSSLD::caList() { TQStringList x; TDEConfig cfg("ksslcalist", true, false); x = cfg.groupList(); x.remove("<default>"); return x; }
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]; } }
void KateFileSelector::cmbPathReturnPressed( const TQString& u ) { KURL typedURL( u ); if ( typedURL.hasPass() ) typedURL.setPass( TQString::null ); TQStringList urls = cmbPath->urls(); urls.remove( typedURL.url() ); urls.prepend( typedURL.url() ); cmbPath->setURLs( urls, KURLComboBox::RemoveBottom ); dir->setFocus(); dir->setURL( KURL(u), true ); }
TQStringList KACLListView::allowedGroups( bool defaults, KACLListViewItem *allowedItem ) { TQStringList allowedGroups = m_allGroups; TQListViewItemIterator 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; }
TQString KStringHandler::remword( const TQString &text , uint pos ) { TQString tmp = ""; if ( text.isEmpty() ) return tmp; // Split words and add into list TQStringList list = TQStringList::split( " ", text, true ); if ( pos < list.count() ) list.remove( list.at( pos ) ); // Rejoin return list.join( " " ); }
KPaletteTable::KPaletteTable( TQWidget *parent, int minWidth, int cols) : TQWidget( parent ), cells(0), mPalette(0), mMinWidth(minWidth), mCols(cols) { d = new KPaletteTablePrivate; i18n_namedColors = i18n("Named Colors"); TQStringList diskPaletteList = KPalette::getPaletteList(); TQStringList paletteList; // We must replace the untranslated file names by translate names (of course only for KDE's standard palettes) for ( int i = 0; colorPaletteName[i].m_fileName; ++i ) { diskPaletteList.remove( colorPaletteName[i].m_fileName ); paletteList.append( i18n( "palette name", colorPaletteName[i].m_displayName ) ); } paletteList += diskPaletteList; paletteList.append( i18n_namedColors ); TQVBoxLayout *layout = new TQVBoxLayout( this ); combo = new TQComboBox( false, this ); combo->insertStringList( paletteList ); layout->addWidget(combo); sv = new TQScrollView( this ); TQSize cellSize = TQSize( mMinWidth, 120); sv->setHScrollBarMode( TQScrollView::AlwaysOff); sv->setVScrollBarMode( TQScrollView::AlwaysOn); TQSize minSize = TQSize(sv->verticalScrollBar()->width(), 0); minSize += TQSize(sv->frameWidth(), 0); minSize += TQSize(cellSize); sv->setFixedSize(minSize); layout->addWidget(sv); mNamedColorList = new TDEListBox( this, "namedColorList", 0 ); mNamedColorList->setFixedSize(minSize); mNamedColorList->hide(); layout->addWidget(mNamedColorList); connect( mNamedColorList, TQT_SIGNAL(highlighted( const TQString & )), this, TQT_SLOT( slotColorTextSelected( const TQString & )) ); setFixedSize( sizeHint()); connect( combo, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(slotSetPalette( const TQString &))); }
TQString KStringHandler::setword( const TQString &text , const TQString &word , uint pos ) { if ( text.isEmpty() ) return word; if ( word.isEmpty() ) return text; // Split words and add into list TQStringList list = TQStringList::split( " ", text, true ); if ( pos >= list.count() ) list.append( word ); else { list.insert( list.remove( list.at(pos) ) , word ); } // Rejoin return list.join( " " ); }
TQString KStringHandler::remword( const TQString &text , const TQString &word ) { TQString tmp = ""; if ( text.isEmpty() ) return tmp; if ( word.isEmpty() ) return text; // Split words and add into list TQStringList list = TQStringList::split( " ", text, true ); TQStringList::Iterator it = list.find(word); if (it != list.end()) list.remove( it ); // Rejoin return list.join( " " ); }
void ExtensionManager::migrateMenubar() { // lame, lame, lame. // the menubar applet was just plunked into kicker and not much // thought was put into how it should be used. great idea, but no // integration. >:-( // so now we have to check to see if we HAVE another extension that // will have a menubar in it, and if so, abort creating one of our // own. // // the reason i didn't do this as a tdeconfig_update script is that // most people don't use this feature, so no reason to penalize // everyone, and moreover the user may added this to their main // panel, meaning kickerrc itself would have to be vastly modified // with lots of complications. not work it IMHO. TDEConfig* config = TDEGlobal::config(); config->setGroup("General"); if (config->readBoolEntry("CheckedForMenubar", false)) { return; } if (!locate("config", "kicker_menubarpanelrc").isEmpty()) { // don't overwrite/override something that's already there return; } TQStringList elist = config->readListEntry("Extensions2"); TQStringList::iterator itEnd = elist.end(); for (TQStringList::iterator it = elist.begin(); it != elist.end(); ++it) { TQString extensionId(*it); if (extensionId.find("Extension") == -1) { continue; } // is there a config group for this extension? if (!config->hasGroup(extensionId)) { continue; } config->setGroup(extensionId); TQString extension = config->readPathEntry("ConfigFile"); TDEConfig extensionConfig(locate("config", extension)); extensionConfig.setGroup("General"); if (extensionConfig.hasKey("Applets2")) { TQStringList containers = extensionConfig.readListEntry("Applets2"); TQStringList::iterator cit = containers.begin(); TQStringList::iterator citEnd = containers.end(); for (; cit != citEnd; ++cit) { TQString appletId(*cit); // is there a config group for this applet? if (!extensionConfig.hasGroup(appletId)) { continue; } TDEConfigGroup group(&extensionConfig, appletId.latin1()); TQString appletType = appletId.left(appletId.findRev('_')); if (appletType == "Applet") { TQString appletFile = group.readPathEntry("DesktopFile"); if (appletFile.find("menuapplet.desktop") != -1) { TQString menubarConfig = locate("config", extension); TDEIO::NetAccess::copy(menubarConfig, locateLocal("config", "kicker_menubarpanelrc"), 0); elist.remove(it); config->setGroup("General"); config->writeEntry("Extensions2", elist); config->writeEntry("CheckedForMenubar", true); config->sync(); return; } } } } } config->setGroup("General"); config->writeEntry("CheckedForMenubar", true); }