TQString EvaChatView::wrapFontAttributes(TQColor color, TQ_UINT8 size, bool underline, bool italic, bool bold, TQString contents) { TQString fontHead = "<span style=\""; TQString fontSize = "font-size: "+TQString::number((size<=MIN_FONT_SIZE)?MIN_FONT_SIZE:((size>MAX_FONT_SIZE)?MAX_FONT_SIZE:size))+"pt; "; TQString fontColor = TQString("color: ") + color.name() + TQString("\" >"); TQString fontStye = "", fontStyeEnd=""; if(bold) { fontStye+="<b>"; fontStyeEnd+="</b>"; } if(italic) { fontStye+="<i>"; fontStyeEnd="</i>" + fontStyeEnd; } if(underline) { fontStye+="<u>"; fontStyeEnd="</u>" + fontStyeEnd; } TQString fontEnd = "</span>"; TQString ret = fontHead + fontSize + fontColor + fontStye + contents + fontStyeEnd + fontEnd; return ret; }
void SaverConfig::add() { KURL::List files = KFileDialog::getOpenURLs( TQString(), TQString(), this, i18n("Select Media Files") ); for( unsigned int n=0; n<files.count(); n++ ) m_files->insertItem( files[n].prettyURL(), -1 ); }
void EvaChatWindowManager::slotQunJoinEvent(const unsigned int qunID, const short imType, const unsigned int sender, const unsigned int commander) { EvaQunChatWindow *win = getQunWindow(qunID); if(win ) { TQString info; switch(imType){ case TQQ_RECV_IM_APPROVE_JOIN_QUN: info = TQString(i18n("%1 has joined this Qun approved by %2.")) .arg(sender).arg(commander); break; case TQQ_RECV_IM_ADDED_TO_QUN: info = TQString(i18n("%1 has joined this Qun added by %2.")) .arg(sender).arg(commander); break; case TQQ_RECV_IM_DELETED_FROM_QUN: info = TQString(i18n("%1 has quit this Qun.") .arg(sender)); break; default: info = TQString(i18n("%1 has done some unknown action on %2.")) .arg(commander).arg(sender); } win->slotAddInformation(info); } }
void KfindWindow::beginSearch(const KURL& baseUrl) { kdDebug()<<TQString(TQString("beginSearch in: %1").arg(baseUrl.path()))<<endl; m_baseDir=baseUrl.path(+1); haveSelection = false; clear(); }
/*! 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, ' ' ); } } } } } }
bool ObjKsTheme::loadThemeRc( const TQString& activeTheme, bool force ) { //kdDebug() << "ObjKsTheme::loadThemeRc: " << activeTheme << endl; TQString prefix("Themes/"); TQString themeFile; TDEConfig *cf = 0L; // Try our best to find a theme file. themeFile = locate( "appdata", prefix + activeTheme + "/" + TQString("Theme.rc") ); themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("Theme.RC")):themeFile; themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("theme.rc")):themeFile; themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+activeTheme+TQString(".rc")):themeFile; if( !themeFile.isEmpty() ) cf = new TDEConfig( themeFile ); if( cf ) { mActiveTheme = activeTheme; mThemeDir = prefix + activeTheme+"/"; if( loadTDEConfig( cf, activeTheme, force ) ) { mThemeConfig = cf; return true; } else delete cf; } return false; }
void TarArch::slotListingDone(TDEProcess *_kp) { const TQString list = getLastShellOutput(); FileListView *flv = m_gui->fileList(); if (flv!=NULL && flv->totalFiles()>0) { const TQString firstfile = ((FileLVI *) flv->firstChild())->fileName(); if (list.find(TQRegExp(TQString("\\s\\./%1[/\\n]").arg(firstfile)))>=0) { m_dotslash = true; kdDebug(1601) << k_funcinfo << "archive has dot-slash" << endl; } else { if (list.find(TQRegExp(TQString("\\s%1[/\\n]").arg(firstfile)))>=0) { // archive doesn't have dot-slash m_dotslash = false; } else { kdDebug(1601) << k_funcinfo << "cannot match '" << firstfile << "' in listing!" << endl; } } } delete _kp; _kp = m_currentProcess = NULL; }
/** Preconditions: + button is an array of length MAX_NUM_BUTTONS Postconditions: + Title bar and buttons have been initialized and laid out + for all i in 0..(MAX_NUM_BUTTONS-1), button[i] points to either (1) a valid NextButton instance, if the corresponding button is selected in the current button scheme, or (2) null otherwise. */ void NextClient::initializeButtonsAndTitlebar(TQBoxLayout* titleLayout) { // Null the buttons to begin with (they are not guaranteed to be null). for (int i=0; i<MAX_NUM_BUTTONS; i++) { button[i] = NULL; } // The default button positions for other styles do not match the // behavior of older versions of KStep, so we have to set these // manually when customButtonPositions isn't enabled. TQString left, right; if (options()->customButtonPositions()) { left = options()->titleButtonsLeft(); right = options()->titleButtonsRight(); } else { left = TQString("I"); right = TQString("SX"); } // Do actual creation and addition to titleLayout addButtons(titleLayout, left); titlebar = new TQSpacerItem(10, titleHeight, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); titleLayout->addItem(titlebar); addButtons(titleLayout, right); // Finally, activate all live buttons for ( int i = 0; i < MAX_NUM_BUTTONS; i++) { if (button[i]) { button[i]->setMouseTracking( TRUE ); } } }
void KgpgApp::slotFileSaveAs() { //KURL url=KFileDialog::getSaveURL(TQDir::currentDirPath(),i18n("*|All Files"), this, i18n("Save As")); KEncodingFileDialog::Result saveResult; saveResult=KEncodingFileDialog::getSaveURLAndEncoding (TQString(),TQString(),TQString(),this); KURL url=saveResult.URLs.first(); TQString selectedEncoding=saveResult.encoding; if(!url.isEmpty()) { if (url.isLocalFile()) { TQString filn=url.path(); TQFile f(filn); if (f.exists()) { TQString message=i18n("Overwrite existing file %1?").arg(url.fileName()); int result=KMessageBox::warningContinueCancel(this,TQString(message),i18n("Warning"),i18n("Overwrite")); if (result==KMessageBox::Cancel) return; } f.close(); } else if (TDEIO::NetAccess::exists(url,false,this)) { TQString message=i18n("Overwrite existing file %1?").arg(url.fileName()); int result=KMessageBox::warningContinueCancel(this,TQString(message),i18n("Warning"),i18n("Overwrite")); if (result==KMessageBox::Cancel) return; } Docname=url; textEncoding=selectedEncoding; slotFileSave(); } }
TDMConfShutdown::TDMConfShutdown( int _uid, dpySpec *sess, int type, const char *os, TQWidget *_parent ) : inherited( _uid, _parent ) { #ifdef HAVE_VTS if (type == SHUT_CONSOLE) willShut = false; #endif box->addWidget( new TQLabel( TQString( "<qt><center><b><nobr>" "%1%2" "</nobr></b></center><br></qt>" ) .arg( (type == SHUT_HALT) ? i18n("Turn Off Computer") : #ifdef HAVE_VTS (type == SHUT_CONSOLE) ? i18n("Switch to Console") : #endif i18n("Restart Computer") ) .arg( os ? i18n("<br>(Next boot: %1)") .arg( TQString::fromLocal8Bit( os ) ) : TQString() ), this ) ); if (sess) { if (willShut && _scheduledSd != SHUT_NEVER) maySched = true; mayNuke = doesNuke = true; if (_allowNuke == SHUT_NONE) mayOk = false; TQLabel *lab = new TQLabel( mayOk ? i18n("Abort active sessions:") : i18n("No permission to abort active sessions:"), this ); box->addWidget( lab ); TQListView *lv = new TQListView( this ); lv->setSelectionMode( TQListView::NoSelection ); lv->setAllColumnsShowFocus( true ); lv->header()->setResizeEnabled( false ); lv->addColumn( i18n("Session") ); lv->addColumn( i18n("Location") ); TQListViewItem *itm; int ns = 0; TQString user, loc; do { decodeSess( sess, user, loc ); itm = new TQListViewItem( lv, user, loc ); sess = sess->next, ns++; } while (sess); int fw = lv->frameWidth() * 2; lv->setFixedHeight( fw + lv->header()->height() + itm->height() * (ns < 3 ? 3 : ns > 10 ? 10 : ns) ); box->addWidget( lv ); complete( lv ); } else complete( 0 ); }
void KgpgApp::slotFilePreDec() { KURL url=KFileDialog::getOpenURL(TQString(), i18n("*|All Files"), this, i18n("Open File to Decode")); if (url.isEmpty()) return; TQString oldname=url.fileName(); TQString newname; if (oldname.endsWith(".gpg") || oldname.endsWith(".asc") || oldname.endsWith(".pgp")) oldname.truncate(oldname.length()-4); else oldname.append(".clear"); oldname.prepend(url.directory(0,0)); KDialogBase *popn=new KDialogBase( KDialogBase::Swallow, i18n("Decrypt File To"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "file_decrypt",true); SrcSelect *page=new SrcSelect(); popn->setMainWidget(page); page->newFilename->setURL(oldname); page->newFilename->setMode(KFile::File); page->newFilename->setCaption(i18n("Save File")); page->checkClipboard->setText(i18n("Editor")); page->resize(page->minimumSize()); popn->resize(popn->minimumSize()); if (popn->exec()==TQDialog::Accepted) { if (page->checkFile->isChecked()) newname=page->newFilename->url(); } else { delete popn; return; } delete popn; if (!newname.isEmpty()) { TQFile fgpg(newname); if (fgpg.exists()) { TDEIO::RenameDlg *over=new TDEIO::RenameDlg(0,i18n("File Already Exists"),TQString(),newname,TDEIO::M_OVERWRITE); if (over->exec()==TQDialog::Rejected) { delete over; return; } newname=over->newDestURL().path(); delete over; } KgpgLibrary *lib=new KgpgLibrary(this); lib->slotFileDec(url,KURL(newname), customDecrypt); connect(lib,TQT_SIGNAL(importOver(TQStringList)),this,TQT_SIGNAL(refreshImported(TQStringList))); } else openEncryptedDocumentFile(url); }
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"); }
void KJavaApplet::resizeAppletWidget( int width, int height ) { kdDebug(6100) << "KJavaApplet, id = " << id << ", ::resizeAppletWidget to " << width << ", " << height << endl; TQStringList sl; sl.push_back( TQString::number( 0 ) ); // applet itself has id 0 sl.push_back( TQString( "eval" ) ); // evaluate next script sl.push_back( TQString::number( KParts::LiveConnectExtension::TypeString ) ); sl.push_back( TQString( "this.setAttribute('WIDTH',%1);this.setAttribute('HEIGHT',%2)" ).arg( width ).arg( height ) ); jsData( sl ); }
void KgpgApp::slotFileNew() { ////// delete all text from editor view->editor->setText(TQString()); editRedo->setEnabled(false); editUndo->setEnabled(false); setCaption(i18n("Untitled"), false); fileSave->setEnabled(false); Docname=TQString(); slotResetEncoding(false); }
TQString KfFileLVI::key(int column, bool) const { switch (column) { case 2: // Returns size in bytes. Used for sorting return TQString().sprintf("%010d", fileInfo->size()); case 3: // Returns time in secs from 1/1/1970. Used for sorting return TQString().sprintf("%010ld", fileitem.time(TDEIO::UDS_MODIFICATION_TIME)); } return text(column); }
void KateCodeFoldingTree::dumpNode(KateCodeFoldingNode *node, const TQString &prefix) { //output node properties kdDebug(13000)<<prefix<<TQString(TQString("Type: %1, startLineValid %2, startLineRel %3, endLineValid %4, endLineRel %5, visible %6"). arg(node->type).arg(node->startLineValid).arg(node->startLineRel).arg(node->endLineValid). arg(node->endLineRel).arg(node->visible))<<endl; //output child node properties recursive if (node->noChildren()) return; TQString newprefix(prefix + " "); for ( uint i=0; i < node->childCount(); ++i ) dumpNode (node->child(i),newprefix); }
void KSMServer::restoreLegacySessionInternal( TDEConfig* config, char sep ) { int count = config->readNumEntry( "count" ); for ( int i = 1; i <= count; i++ ) { TQString n = TQString::number(i); TQStringList wmCommand = config->readListEntry( TQString("command")+n, sep ); if( wmCommand.isEmpty()) continue; if( isWM( wmCommand.first())) continue; startApplication( wmCommand, config->readEntry( TQString("clientMachine")+n ), config->readEntry( TQString("userId")+n )); } }
void ZoneClockPanel::save(TDEConfig *config) { config->writeEntry("Clocks", _clocks.count()); TQPtrListIterator<ZoneClock> it(_clocks); int cnt=0; for ( ; it.current(); ++it) { TQString n = it.current()->name(); n = n.left(n.length()-1); config->writeEntry(TQString("Clock_%1_Name").arg(cnt), n); config->writeEntry(TQString("Clock_%1_Zone").arg(cnt), it.current()->zone()); cnt++; } }
void KateSearch::replace() { if (!doc()->isReadWrite()) return; // if multiline selection around, search in it long searchf = KateViewConfig::global()->searchFlags(); if (m_view->hasSelection() && m_view->selStartLine() != m_view->selEndLine()) searchf |= KFindDialog::SelectedText; KReplaceDialog *replaceDialog = new KReplaceDialog ( m_view, "", searchf, s_searchList, s_replaceList, m_view->hasSelection() ); replaceDialog->setPattern (getSearchText()); if( replaceDialog->exec() == TQDialog::Accepted ) { long opts = replaceDialog->options(); m_replacement = replaceDialog->replacement(); s_searchList = replaceDialog->findHistory () ; s_replaceList = replaceDialog->replacementHistory () ; // Do *not* remove the TQString() wrapping, it fixes a nasty crash replace( TQString(s_searchList.first()), m_replacement, opts ); } delete replaceDialog; m_view->update (); }
void KgpgApp::slotFileOpen() { KEncodingFileDialog::Result loadResult; loadResult=KEncodingFileDialog::getOpenURLAndEncoding(TQString(),TQString(),TQString(),this); KURL url=loadResult.URLs.first(); textEncoding=loadResult.encoding; if(!url.isEmpty()) { openDocumentFile(url,textEncoding); Docname=url; fileSave->setEnabled(false); //fileSaveAs->setEnabled(true); setCaption(url.fileName(), false); } }
void KSaveIOConfig::setMinimumKeepSize( int _size ) { TDEConfig* cfg = config (); cfg->setGroup( TQString() ); cfg->writeEntry( "MinimumKeepSize", _size ); cfg->sync(); }
void KgpgApp::slotPreSignFile() { ////////////////////////////////////// create a detached signature for a chosen file KURL url=KFileDialog::getOpenURL(TQString(),i18n("*|All Files"), this, i18n("Open File to Sign")); if (!url.isEmpty()) slotSignFile(url); }
void MyEditor::slotDroppedFile(KURL url) { ///////////////// decide what to do with dropped file TQString text; if (!tempFile.isEmpty()) { TDEIO::NetAccess::removeTempFile(tempFile); tempFile=TQString(); } if (url.isLocalFile()) tempFile = url.path(); else { if (KMessageBox::warningContinueCancel(0,i18n("<qt><b>Remote file dropped</b>.<br>The remote file will now be copied to a temporary file to process requested operation. This temporary file will be deleted after operation.</qt>"),0,KStdGuiItem::cont(),"RemoteFileWarning")!=KMessageBox::Continue) return; if (!TDEIO::NetAccess::download (url, tempFile,this)) { KMessageBox::sorry(this,i18n("Could not download file.")); return; } } ///////////// if dropped filename ends with gpg, pgp or asc, try to decode it if ((tempFile.endsWith(".gpg")) || (tempFile.endsWith(".asc")) || (tempFile.endsWith(".pgp"))) { slotDecodeFile(tempFile); } else slotCheckContent(tempFile); }
const TQString X11Helper::findXkbRulesFile(TQString x11Dir, Display *dpy) { TQString rulesFile; XkbRF_VarDefsRec vd; char *tmp = NULL; if (XkbRF_GetNamesProp(dpy, &tmp, &vd) && tmp != NULL ) { // kdDebug() << "namesprop " << tmp << endl; rulesFile = x11Dir + TQString("xkb/rules/%1").arg(tmp); // kdDebug() << "rulesF " << rulesFile << endl; } else { // old way for(int ii=0; ii<X11_RULES_COUNT; ii++) { const char* ruleFile = rulesFileList[ii]; TQString xruleFilePath = x11Dir + ruleFile; // kdDebug() << "trying " << xruleFilePath << endl; if( TQFile(xruleFilePath).exists() ) { rulesFile = xruleFilePath; break; } } } return rulesFile; }
void KSaveIOConfig::setAutoResume( bool _mode ) { TDEConfig* cfg = config (); cfg->setGroup( TQString() ); cfg->writeEntry( "AutoResume", _mode ); cfg->sync(); }
KHTTPOptions::KHTTPOptions(TDEConfig *config, TQString group, TQWidget *parent, const char *name) : TDECModule( parent, name ), m_pConfig(config), m_groupname(group) { TQVBoxLayout *lay = new TQVBoxLayout(this, 10, 5); lay->addWidget( new TQLabel(i18n("Accept languages:"), this) ); le_languages = new TQLineEdit(this); lay->addWidget( le_languages ); connect(le_languages, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotChanged())); lay->addSpacing(10); lay->addWidget( new TQLabel(i18n("Accept character sets:"), this) ); le_charsets = new TQLineEdit(this); lay->addWidget( le_charsets ); connect(le_charsets, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotChanged())); lay->addStretch(10); // defaultCharsets = TQString("utf-8 ")+klocale->charset()+" iso-8859-1"; defaultCharsets = TQString("utf-8 ")+" iso-8859-1"; // TODO // finaly read the options load(); }
void DiskSensor::receivedStdout(TDEProcess *, char *buffer, int len ) { buffer[len] = 0; sensorResult += TQString( TQCString(buffer) ); }
void KSaveIOConfig::setPersistentConnections( bool enable ) { TDEConfig* cfg = config (); cfg->setGroup( TQString() ); cfg->writeEntry( "PersistentConnections", enable ); cfg->sync(); }
static TQString roundNumber(const TQString &numStr, int precision) { TQString tmpString = numStr; if (precision < 0 || ! TQRegExp("^[+-]?\\d+(\\.\\d+)*(e[+-]?\\d+)?$").exactMatch(tmpString)) return numStr; // Skip the sign (for now) bool neg = (tmpString[0] == '-'); if (neg || tmpString[0] == '+') tmpString.remove(0, 1); // Split off exponential part (including 'e'-symbol) TQString mantString = tmpString.section('e', 0, 0, TQString::SectionCaseInsensitiveSeps); TQString expString = tmpString.section('e', 1, 1, TQString::SectionCaseInsensitiveSeps | TQString::SectionIncludeLeadingSep); if (expString.length() == 1) expString = TQString(); _round(mantString, precision); if(neg) mantString.prepend('-'); return mantString + expString; }
void KSaveIOConfig::setProxyConnectTimeout( int _timeout ) { TDEConfig* cfg = config (); cfg->setGroup( TQString() ); cfg->writeEntry("ProxyConnectTimeout", TQMAX(MIN_TIMEOUT_VALUE,_timeout)); cfg->sync(); }