void KSaveIOConfig::setProxyFor( const TQString& protocol, const TQString& _proxy ) { TDEConfig* cfg = config (); cfg->setGroup( "Proxy Settings" ); cfg->writeEntry( protocol.lower() + "Proxy", _proxy ); cfg->sync(); }
TQString AddresseeItem::key( int column, bool ) const { if (column == Email) { TQString value = text(Email); TQRegExp emailRe("<\\S*>"); int match = emailRe.search(value); if (match > -1) value = value.mid(match + 1, emailRe.matchedLength() - 2); return value.lower(); } return text(column).lower(); }
Addressee::List Resource::findByEmail( const TQString &email ) { Addressee::List results; const TQString lowerEmail = email.lower(); ConstIterator it; for ( it = begin(); it != end(); ++it ) { const TQStringList mailList = (*it).emails(); for ( TQStringList::ConstIterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { if ( lowerEmail == (*ite).lower() ) results.append( *it ); } } return results; }
bool KCMStyle::findStyle( const TQString& str, int& combobox_item ) { StyleEntry* se = styleEntries.find(str.lower()); TQString name = se ? se->name : str; combobox_item = 0; //look up name for( int i = 0; i < cbStyle->count(); i++ ) { if ( cbStyle->text(i) == name ) { combobox_item = i; return TRUE; } } return FALSE; }
TQStringList KSSLD::getKDEKeyByEmail(const TQString &email) { TQStringList rc; TQMap<TQString, TQPtrVector<KSSLCertificate> >::iterator it = skEmail.find(email.lower()); kdDebug() << "GETKDEKey " << email.latin1() << endl; if (it == skEmail.end()) return rc; TQPtrVector<KSSLCertificate> &elem = *it; for (unsigned int n = 0; n < elem.size(); n++) { KSSLCertificate *cert = elem.at(n); if (cert) { rc.append(cert->getKDEKey()); } } kdDebug() << "ergebnisse: " << rc.size() << " " << elem.size() << endl; return rc; }
void CustomSmileyManager::slotFaceSelectionChanged( ) { // TQTable::numSelections() doesn't return the correct value // if use select some rows by pressing shift key int numSelections = 0; int first = -1; for(int r = 0; r < tblFaceList->numRows(); r++){ numSelections += ((tblFaceList->isRowSelected(r))?1:0); if( (numSelections == 1) && (first == -1) ){ first = r; } } bool isSingle = (numSelections == 1); btnEdit->setEnabled(isSingle); btnUp->setEnabled(isSingle); btnDown->setEnabled(isSingle); if(numSelections){ TQListViewItem *item = lvGroups->selectedItem(); if(item){ int gId = m_Config->groupIndex( item->text( 0 ) ); if(gId < 0) return; CustomFace face = m_Config->getFace( gId, first); TQString path = EvaMain::user->getSetting()->getCustomSmileyDir() + "/"; if(gId > 0 ) path += (item->text(0) + "/"); TQString ext = face.org().right(3); lblPreview->clear(); if(ext.lower() == "gif"){ lblPreview->setMovie( TQMovie(path + face.org())); } else { TQImage img(path + face.org() ); lblPreview->setPixmap( TQPixmap(img.smoothScale( lblPreview->size(), TQImage::ScaleMin))); } } } }
void KCMStyle::loadStyle( TDEConfig& config ) { cbStyle->clear(); // Create a dictionary of WidgetStyle to Name and Desc. mappings, // as well as the config page info styleEntries.clear(); styleEntries.setAutoDelete(true); TQString strWidgetStyle; TQStringList list = TDEGlobal::dirs()->findAllResources("themes", "*.themerc", true, true); for (TQStringList::iterator it = list.begin(); it != list.end(); ++it) { KSimpleConfig config( *it, true ); if ( !(config.hasGroup("KDE") && config.hasGroup("Misc")) ) continue; config.setGroup("KDE"); strWidgetStyle = config.readEntry("WidgetStyle"); if (strWidgetStyle.isNull()) continue; // We have a widgetstyle, so lets read the i18n entries for it... StyleEntry* entry = new StyleEntry; config.setGroup("Misc"); entry->name = config.readEntry("Name"); entry->desc = config.readEntry("Comment", i18n("No description available.")); entry->configPage = config.readEntry("ConfigPage", TQString::null); // Check if this style should be shown config.setGroup("Desktop Entry"); entry->hidden = config.readBoolEntry("Hidden", false); // Insert the entry into our dictionary. styleEntries.insert(strWidgetStyle.lower(), entry); } // Obtain all style names TQStringList allStyles = TQStyleFactory::keys(); // Get translated names, remove all hidden style entries. TQStringList styles; StyleEntry* entry; for (TQStringList::iterator it = allStyles.begin(); it != allStyles.end(); it++) { TQString id = (*it).lower(); // Find the entry. if ( (entry = styleEntries.find(id)) != 0 ) { // Do not add hidden entries if (entry->hidden) continue; styles += entry->name; nameToStyleKey[entry->name] = id; } else { styles += (*it); //Fall back to the key (but in original case) nameToStyleKey[*it] = id; } } // Sort the style list, and add it to the combobox styles.sort(); cbStyle->insertStringList( styles ); // Find out which style is currently being used config.setGroup( "General" ); TQString defaultStyle = TDEStyle::defaultStyle(); TQString cfgStyle = config.readEntry( "widgetStyle", defaultStyle ); // Select the current style // Do not use cbStyle->listBox() as this may be NULL for some styles when // they use QPopupMenus for the drop-down list! // ##### Since Trolltech likes to seemingly copy & paste code, // TQStringList::findItem() doesn't have a Qt::StringComparisonMode field. // We roll our own (yuck) cfgStyle = cfgStyle.lower(); int item = 0; for( int i = 0; i < cbStyle->count(); i++ ) { TQString id = nameToStyleKey[cbStyle->text(i)]; item = i; if ( id == cfgStyle ) // ExactMatch break; else if ( id.contains( cfgStyle ) ) break; else if ( id.contains( TQApplication::style().className() ) ) break; item = 0; } cbStyle->setCurrentItem( item ); m_bStyleDirty = false; switchStyle( currentStyle() ); // make resets visible }
void NoatunSensor::update() { TQString format; SensorParams *sp; Meter *meter; TQObjectListIt it( *objList ); TQString title; int songLength = 0; int currentTime = 0; bool running = isRunning(); if( running ) { title = getTitle(); if( title.isEmpty() ) title = "Noatun"; currentTime = getTime(); if( currentTime == -1 ) currentTime = 0; songLength = getLength(); if( songLength == -1 ) songLength = 0; } while (it != 0) { sp = (SensorParams*)(*it); meter = sp->getMeter(); if( running ) { format = sp->getParam("FORMAT"); if (format.length() == 0 ) { format = "%title %time / %length"; } if( format.lower() == "%ms" ) { meter->setMax( songLength ); meter->setValue( currentTime ); } else if ( format.lower() == "%full" ) { meter->setValue( 1 ); } else { format.replace( TQRegExp("%title", false), title ); format.replace( TQRegExp("%id", false), noatunID ); format.replace( TQRegExp("%length", false), TQTime( 0,0,0 ). addMSecs( songLength ) .toString( "h:mm:ss" ) ); format.replace( TQRegExp("%time", false), TQTime( 0,0,0 ). addMSecs( currentTime ) .toString( "h:mm:ss" ) ); format.replace( TQRegExp("%remain", false), TQTime( 0,0,0 ). addMSecs( songLength ) .addMSecs(-currentTime ) .toString( "h:mm:ss" ) ); meter->setValue(format); } } else { meter->setValue(""); } ++it; } }
/** @brief Try to get country code from layout name in xkb before xorg 6.9.0 */ TQString LayoutIcon::getCountryFromLayoutName(const TQString& layoutName) { TQString flag; if( X11Helper::areLayoutsClean() ) { // >= Xorg 6.9.0 if( layoutName == "mkd" ) flag = "mk"; else if( layoutName == "srp" ) { TQString csFlagFile = locate("locale", flagTemplate.arg("cs")); flag = csFlagFile.isEmpty() ? "yu" : "cs"; } else if( layoutName.endsWith("/jp") ) flag = "jp"; else if( layoutName == "trq" || layoutName == "trf" || layoutName == "tralt" ) flag = "tr"; else if( layoutName.length() > 2 ) flag = ""; else flag = layoutName; } else { if( layoutName == "ar" ) // Arabic - not argentina ; else if( layoutName == "sr" || layoutName == "cs") // Serbian language - Yugoslavia flag = "yu"; else if( layoutName == "bs" ) // Bosnian language - Bosnia flag = "ba"; else if( layoutName == "la" ) // Latin America ; else if( layoutName == "lo" ) // Lao flag = "la"; else if( layoutName == "pl2" ) // Poland flag = "pl"; else if( layoutName == "iu" ) // Inuktitut - Canada flag = "ca"; else if( layoutName == "syr" ) // Syriac flag = "sy"; else if( layoutName == "dz" ) // Dzongka/Tibetian - Buthan flag = "bt"; else if( layoutName == "ogham" ) // Ogham - Ireland flag = "ie"; else if( layoutName == "ge_la" || layoutName == "ge_ru" ) flag = "ge"; else if( layoutName == "el" ) flag = "gr"; else if( layoutName.endsWith("/jp") ) flag = "jp"; else if( layoutName == "ml" || layoutName == "dev" || layoutName == "gur" || layoutName == "guj" || layoutName == "kan" || layoutName == "ori" || layoutName == "tel" || layoutName == "tml" || layoutName == "ben" ) // some Indian languages flag = "in"; else { int sepPos = layoutName.find(TQRegExp("[-_]")); TQString leftCode = layoutName.mid(0, sepPos); TQString rightCode; if( sepPos != -1 ) rightCode = layoutName.mid(sepPos+1); // kdDebug() << "layout name breakup: " << leftCode << ":" << rightCode << endl; if( rightCode.length() == 2 && TQRegExp("[A-Z][A-Z]").exactMatch(rightCode) ) { flag = rightCode.lower(); } else { flag = leftCode.length() == 2 ? leftCode : ""; } } } return flag; }