void NaughtyApplet::slotWarn(ulong pid, const TQString & name) { if (ignoreList_.contains(name)) return; TQString s = i18n("A program called '%1' is slowing down the others " "on your machine. It may have a bug that is causing " "this, or it may just be busy.\n" "Would you like to try to stop the program?"); int retval = KMessageBox::warningYesNo(this, s.arg(name), TQString::null, i18n("Stop"), i18n("Keep Running")); if (KMessageBox::Yes == retval) monitor_->kill(pid); else { s = i18n("In future, should busy programs called '%1' be ignored?"); retval = KMessageBox::questionYesNo(this, s.arg(name), TQString::null, i18n("Ignore"), i18n("Do Not Ignore")); if (KMessageBox::Yes == retval) { ignoreList_.append(name); config()->writeEntry("IgnoreList", ignoreList_); config()->sync(); } } }
TQString ExtensionManager::uniqueId() { TQString idBase = "Extension_%1"; TQString newId; int i = 0; bool unique = false; while (!unique) { i++; newId = idBase.arg(i); unique = true; ExtensionList::iterator itEnd = _containers.end(); for (ExtensionList::iterator it = _containers.begin(); it != itEnd; ++it) { if ((*it)->extensionId() == newId) { unique = false; break; } } } return newId; }
TQString KonqSidebarHistoryItem::toolTipText() const { if ( s_settings->m_detailedTips ) { // this weird ordering of %4, %1, %2, %3 is due to the reason, that some // urls seem to contain %N, which would get substituted in the next // .arg() calls. So to fix this, we first substitute the last items // and then put in the url. TQString tip = i18n("<qt><center><b>%4</b></center><hr>Last visited: %1<br>First visited: %2<br>Number of times visited: %3</qt>"); return tip.arg( TDEGlobal::locale()->formatDateTime( m_entry->lastVisited ) ).arg( TDEGlobal::locale()->formatDateTime( m_entry->firstVisited ) ).arg( m_entry->numberOfTimesVisited ).arg( m_entry->url.url() ); } return m_entry->url.url(); }
void IconThemesConfig::installNewTheme() { KURL themeURL = KURLRequesterDlg::getURL(TQString::null, this, i18n("Drag or Type Theme URL")); kdDebug() << themeURL.prettyURL() << endl; if (themeURL.url().isEmpty()) return; TQString themeTmpFile; // themeTmpFile contains the name of the downloaded file if (!TDEIO::NetAccess::download(themeURL, themeTmpFile, this)) { TQString sorryText; if (themeURL.isLocalFile()) sorryText = i18n("Unable to find the icon theme archive %1."); else sorryText = i18n("Unable to download the icon theme archive;\n" "please check that address %1 is correct."); KMessageBox::sorry(this, sorryText.arg(themeURL.prettyURL())); return; } TQStringList themesNames = findThemeDirs(themeTmpFile); if (themesNames.isEmpty()) { TQString invalidArch(i18n("The file is not a valid icon theme archive.")); KMessageBox::error(this, invalidArch); TDEIO::NetAccess::removeTempFile(themeTmpFile); return; } if (!installThemes(themesNames, themeTmpFile)) { //FIXME: make me able to know what is wrong.... // TQStringList instead of bool? TQString somethingWrong = i18n("A problem occurred during the installation process; " "however, most of the themes in the archive have been installed"); KMessageBox::error(this, somethingWrong); } TDEIO::NetAccess::removeTempFile(themeTmpFile); TDEGlobal::instance()->newIconLoader(); loadThemes(); TQListViewItem *item=iconThemeItem(TDEIconTheme::current()); m_iconThemes->setSelected(item, true); updateRemoveButton(); }
void KPCMCIAInfo::prepareCards() { if (!_pcmcia) { // FIXME: display error return; } for (int i = 0; i < _pcmcia->getCardCount(); i++) { TQString tabname = i18n("Card Slot %1"); KPCMCIAInfoPage *tp = new KPCMCIAInfoPage(_pcmcia->getCard(i), _mainTab); connect(this, TQT_SIGNAL(updateNow()), tp, TQT_SLOT(update())); connect(tp, TQT_SIGNAL(setStatusBar(const TQString&)), this, TQT_SLOT(slotTabSetStatus(const TQString&))); tp->resize(_mainTab->sizeHint()); _mainTab->addTab(tp, tabname.arg(i+1)); _pages.insert(i, tp); } }
static int openDevice(dev_t dev) { TQString tmp_path = locateLocal("tmp", TDEGlobal::instance()->instanceName()); TQString ext = "_socket%1"; tmp_path += ext.arg((int)dev); int rc = mknod(tmp_path.latin1(), (S_IFCHR | S_IREAD), dev); if (rc < 0) return -1; int fd = open(tmp_path.latin1(), O_RDONLY); if (fd < 0) { unlink(tmp_path.latin1()); return -1; } if (unlink(tmp_path.latin1()) < 0) { close(fd); return -1; } return fd; }
static int lookupDevice(const char *x) { TQFile df("/proc/devices"); TQString thisreg; thisreg = "^[0-9]+ %1$"; thisreg = thisreg.arg(x); if (df.open(IO_ReadOnly)) { TQTextStream t(&df); TQString s; while (!t.eof()) { s = t.readLine(); if (s.contains(TQRegExp(thisreg))) { int n = (s.left(3).stripWhiteSpace()).toInt(); df.close(); return n; } } df.close(); } return -1; }
void KPCMCIAInfoPage::update() { if (_card) { TQString tmp; _card_name->setText(_card->name()); _card_name->resize(_card_name->sizeHint()); tmp = i18n("Card type: %1 "); _card_type->setText(tmp.arg(_card->type())); _card_type->resize(_card_type->sizeHint()); tmp = i18n("Driver: %1"); _card_driver->setText(tmp.arg(_card->driver())); _card_driver->resize(_card_driver->sizeHint()); tmp = i18n("IRQ: %1%2"); TQString tmp2; switch (_card->intType()) { case 1: tmp2 = i18n(" (used for memory)"); break; case 2: tmp2 = i18n(" (used for memory and I/O)"); break; case 4: tmp2 = i18n(" (used for CardBus)"); break; default: tmp2 = ""; }; if (_card->irq() <= 0) _card_irq->setText(tmp.arg(i18n("none")).arg("")); else _card_irq->setText(tmp.arg(_card->irq()).arg(tmp2)); _card_irq->resize(_card_irq->sizeHint()); tmp = i18n("I/O port(s): %1"); if (_card->ports().isEmpty()) _card_io->setText(tmp.arg(i18n("none"))); else _card_io->setText(tmp.arg(_card->ports())); _card_io->resize(_card_io->sizeHint()); tmp = i18n("Bus: %1 bit %2"); if (_card->busWidth() == 0) _card_bus->setText(i18n("Bus: unknown")); else _card_bus->setText(tmp.arg(_card->busWidth()).arg(_card->busWidth() == 16 ? i18n("PC Card") : i18n("Cardbus"))); _card_bus->resize(_card_bus->sizeHint()); tmp = i18n("Device: %1"); _card_dev->setText(tmp.arg(_card->device())); _card_dev->resize(_card_dev->sizeHint()); tmp = i18n("Power: +%1V"); _card_vcc->setText(tmp.arg(_card->vcc()/10)); _card_vcc->resize(_card_vcc->sizeHint()); tmp = i18n("Programming power: +%1V, +%2V"); _card_vpp->setText(tmp.arg(_card->vpp()/10).arg(_card->vpp2()/10)); _card_vpp->resize(_card_vpp->sizeHint()); tmp = i18n("Configuration base: 0x%1"); if (_card->configBase() == 0) _card_cfgbase->setText(i18n("Configuration base: none")); else _card_cfgbase->setText(tmp.arg(_card->configBase(), -1, 16)); _card_cfgbase->resize(_card_cfgbase->sizeHint()); if (!(_card->status() & (CARD_STATUS_READY|CARD_STATUS_SUSPEND))) { _card_ej_ins->setText(i18n("&Insert")); } else { _card_ej_ins->setText(i18n("&Eject")); } if (!(_card->status() & (CARD_STATUS_BUSY|CARD_STATUS_SUSPEND))) { _card_sus_res->setText(i18n("&Suspend")); } else { _card_sus_res->setText(i18n("Resu&me")); } if (!(_card->status() & (CARD_STATUS_READY|CARD_STATUS_SUSPEND))) { _card_sus_res->setEnabled(false); _card_reset->setEnabled(false); } else { _card_sus_res->setEnabled(true); if (!(_card->status() & CARD_STATUS_SUSPEND)) _card_reset->setEnabled(true); else _card_reset->setEnabled(false); } } }
bool KShred::shred() { unsigned char p[6][3] = {{'\222', '\111', '\044'}, {'\111', '\044', '\222'}, {'\044', '\222', '\111'}, {'\155', '\266', '\333'}, {'\266', '\333', '\155'}, {'\333', '\155', '\266'}}; TQString msg = i18n("Shredding: pass %1 of 35"); emit processedSize(0); // thirty-five times writing the entire file size totalBytes = fileSize * 35; int iteration = 1; for (int ctr = 0; ctr < 4; ctr++) if (!fillrandom()) return false; else { emit infoMessage(msg.arg(iteration)); } if (!fillbyte((unsigned int) 0x55)) // '0x55' is 01010101 return false; emit infoMessage(msg.arg(iteration)); if (!fillbyte((unsigned int) 0xAA)) // '0xAA' is 10101010 return false; emit infoMessage(msg.arg(iteration)); for (unsigned int ctr = 0; ctr < 3; ctr++) if (!fillpattern(p[ctr], 3)) // '0x92', '0x49', '0x24' return false; else { emit infoMessage(msg.arg(iteration)); } for (unsigned int ctr = 0; ctr <= 255 ; ctr += 17) if (!fillbyte(ctr)) // sequence of '0x00', '0x11', ..., '0xFF' return false; else { emit infoMessage(msg.arg(iteration)); } for (unsigned int ctr = 0; ctr < 6; ctr++) if (!fillpattern(p[ctr], 3)) // '0x92', '0x49', '0x24' return false; else { emit infoMessage(msg.arg(iteration)); } for (int ctr = 0; ctr < 4; ctr++) if (!fillrandom()) return false; else { emit infoMessage(msg.arg(iteration)); } if (!file->remove()) return false; file = 0L; emit processedSize(fileSize); return true; }