void ZooArch::unarchFileInternal() { // if _fileList is empty, we extract all. // if _destDir is empty, abort with error. if ( m_destDir.isEmpty() || m_destDir.isNull() ) { kdError( 1601 ) << "There was no extract directory given." << endl; return; } // zoo has no option to specify the destination directory // so we have to change to it. bool ret = QDir::setCurrent( m_destDir ); // We already checked the validity of the dir before coming here Q_ASSERT(ret); KProcess *kp = m_currentProcess = new KProcess; kp->clearArguments(); *kp << m_archiver_program; if ( ArkSettings::extractOverwrite() ) { *kp << "xOOS"; } else { *kp << "x"; } *kp << m_filename; // if the list is empty, no filenames go on the command line, // and we then extract everything in the archive. if (m_fileList) { QStringList::Iterator it; for ( it = m_fileList->begin(); it != m_fileList->end(); ++it ) { *kp << (*it); } } connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ), SLOT( slotReceivedOutput(KProcess*, char*, int) ) ); connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ), SLOT( slotReceivedOutput(KProcess*, char*, int) ) ); connect( kp, SIGNAL( processExited(KProcess*) ), SLOT( slotExtractExited(KProcess*) ) ); if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) ) { KMessageBox::error( 0, i18n( "Could not start a subprocess." ) ); emit sigExtract( false ); } }
void ZipArch::unarchFileInternal() { // if fileList is empty, all files are extracted. // if destDir is empty, abort with error. if ( m_destDir.isEmpty() || m_destDir.isNull() ) { kdError( 1601 ) << "There was no extract directory given." << endl; return; } KProcess *kp = m_currentProcess = new KProcess; kp->clearArguments(); *kp << m_unarchiver_program; if ( !m_password.isEmpty() ) *kp << "-P" << m_password; if ( ArkSettings::extractJunkPaths() && !m_viewFriendly ) *kp << "-j" ; if ( ArkSettings::rarToLower() ) *kp << "-L"; if ( ArkSettings::extractOverwrite() ) *kp << "-o"; else *kp << "-n"; *kp << m_filename; // if the list is empty, no filenames go on the command line, // and we then extract everything in the archive. if ( m_fileList ) { QStringList::Iterator it; for ( it = m_fileList->begin(); it != m_fileList->end(); ++it ) { *kp << (*it); } } *kp << "-d" << m_destDir; connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ), SLOT( slotReceivedOutput(KProcess*, char*, int) ) ); connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ), SLOT( slotReceivedOutput(KProcess*, char*, int) ) ); connect( kp, SIGNAL( processExited(KProcess*) ), SLOT( slotExtractExited(KProcess*) ) ); if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) ) { KMessageBox::error( 0, i18n( "Could not start a subprocess." ) ); emit sigExtract( false ); } }
QString KFileShare::findExe(const char *exeName) { // /usr/sbin on Mandrake, $PATH allows flexibility for other distributions QString path = QString::fromLocal8Bit(getenv("PATH")) + QString::fromLatin1(":/usr/sbin"); QString exe = KStandardDirs::findExe(exeName, path); if(exe.isEmpty()) kdError() << exeName << " not found in " << path << endl; return exe; }
PMRuleTargetClass::PMRuleTargetClass( QDomElement& e, QPtrList<PMRuleDefineGroup>& globalGroups ) { m_class = e.attribute( "name" ); if( m_class.isEmpty( ) ) kdError( PMArea ) << "RuleSystem: Invalid class name" << endl; appendRules( e, globalGroups ); }
void PMDensityEdit::displayObject( PMObject* o ) { if( o->isA( "Density" ) ) { Base::displayObject( o ); } else kdError( PMArea ) << "PMDensityEdit: Can't display object\n"; }
void PMSkySphereEdit::displayObject( PMObject* o ) { if( o->isA( "SkySphere" ) ) { Base::displayObject( o ); } else kdError( PMArea ) << "PMSkySphereEdit: Can't display object\n"; }
double Wire::voltage() const { double temp; if((temp = m_pStartPin->voltage() - m_pEndPin->voltage()) && Simulator::self()->isSimulating()) { kdError() << k_funcinfo << "Wire voltage error: " << temp << endl; } return m_pStartPin->voltage(); }
PMRuleConstant::PMRuleConstant( QDomElement& e ) : PMRuleValue( ) { QString v = e.attribute( "value" ); if( v.isNull( ) ) kdError( PMArea ) << "RuleSystem: Invalid value" << endl; m_value = PMVariant( v ); }
int PMObjectSelect::selectObject( PMObject* link, const QStringList& t, PMObject* & obj, QWidget* parent ) { PMObject* last = link; PMObject* scene; bool stop = false; bool found = false; do { scene = last->parent( ); if( scene ) { if( scene->type( ) == "Scene" ) { last = last->prevSibling( ); stop = true; found = true; } else last = last->parent( ); } else stop = true; } while( !stop ); if( found ) { PMObjectSelect s( parent ); PMObject* o = scene->firstChild( ); bool l = false; while( o && !l && last ) { if( t.findIndex( o->type( ) ) >= 0 ) s.m_pListBox->insertItem( new PMListBoxObject( o ) ); if( o == last ) l = true; else o = o->nextSibling( ); } int result = s.exec( ); if( result == Accepted ) obj = s.selectedObject( ); return result; } else kdError( PMArea ) << "PMObjectSelect: Link does not seem to be correctly inserted in the scene.\n"; return Rejected; }
QVBox* KGameDialog::addConfigPage(KGameDialogConfig* widget, const QString& title) { if (!widget) { kdError(11001) << "Cannot add NULL config widget" << endl; return 0; } QVBox* page = addVBoxPage(title); addConfigWidget(widget, page); return page; }
kpColor kpTool::oldBackgroundColor () const { if (m_mainWindow) return m_mainWindow->colorToolBar ()->oldBackgroundColor (); else { kdError () << "kpTool::oldBackgroundColor() without mainWindow" << endl; return kpColor::invalid; } }
double kpTool::oldColorSimilarity () const { if (m_mainWindow) return m_mainWindow->colorToolBar ()->oldColorSimilarity (); else { kdError () << "kpTool::oldColorSimilarity() without mainWindow" << endl; return 0; } }
void PageView::addChild( QPtrVector<DocumentWidget> *wdgList ) { if( wdgList == 0 ) { kdError(1223) << "PageView::addChild(...) called with invalid arguments" << endl; return; } widgetList = wdgList; layoutPages(); }
int kpTool::processedColorSimilarity () const { if (m_mainWindow) return m_mainWindow->colorToolBar ()->processedColorSimilarity (); else { kdError () << "kpTool::processedColorSimilarity() without mainWindow" << endl; return kpColor::Exact; } }
kpColor kpTool::color (int which) const { if (m_mainWindow) return m_mainWindow->colorToolBar ()->color (which); else { kdError () << "kpTool::color () without mainWindow" << endl; return kpColor::invalid; } }
// The reason we don't store stuff in a QString is because BitTorrent // b-encoded strings may contain zeroes within the string, which makes // a BString more of a buffer than a true string. void BString::init (ByteTape &tape) { QByteArray &dict(tape.data()); if (dict.find(':', tape.pos()) == -1) { kdDebug(7034) << "Can't find : for string!" << endl; return; } // Copy the part from start to :, as it will be a number // That number is the number of characters to read int length = dict.find(':', tape.pos()) - tape.pos(); char *ptr = dict.data(); ptr += tape.pos(); QByteArray buffer (length + 1); qmemmove (buffer.data(), ptr, length); buffer[length] = 0; QString numberString (buffer); bool a_isValid; ulong len = numberString.toULong (&a_isValid); if (!a_isValid) { kdDebug(7034) << "Invalid string length!" << endl; return; } // Now that we have the length, we need to advance the tape // past the colon tape += length; // Move to colon if (*tape != ':') { // Sanity check kdError(7034) << "SANITY CHECK FAILED. *tape != ':'!" << endl; return; } tape++; // Move past colon // Time to copy the data char *textBuffer = tape.at(tape.pos()); if (!m_data.resize(len + 1)) return; qmemmove (m_data.data(), textBuffer, len); m_data[len] = 0; // Null terminate for convienience tape += len; m_valid = true; }
void KPluginSelectionWidget::clientChanged(bool didchange) { kdDebug(702) << k_funcinfo << endl; d->changed += didchange ? 1 : -1; if(d->changed == 1) emit changed(true); else if(d->changed == 0) emit changed(false); else if(d->changed < 0) kdError(702) << "negative changed value: " << d->changed << endl; }
/****************************************************************************** * Reset the alarm daemon. * Reply = true if daemon was told to reset * = false if daemon is not running. */ bool Daemon::reset() { kdDebug(5950) << "Daemon::reset()" << endl; if (!kapp->dcopClient()->isApplicationRegistered(DAEMON_APP_NAME)) return false; AlarmDaemonIface_stub s(DAEMON_APP_NAME, DAEMON_DCOP_OBJECT); s.resetCalendar(QCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString()); if (!s.ok()) kdError(5950) << "Daemon::reset(): resetCalendar dcop send failed" << endl; return true; }
KDirSaver::KDirSaver( const KURL & url ) { if ( url.isLocalFile() ) { cd( url.path() ); } else { kdError() << k_funcinfo << "Can't change dir to remote location " << url.url() << endl; } }
// private void kpTool::createAction () { #if DEBUG_KP_TOOL && 0 kdDebug () << "kpTool(" << name () << "::createAction()" << endl; #endif if (!m_mainWindow) { kdError () << "kpTool::createAction() without mw" << endl; return; } KActionCollection *ac = m_mainWindow->actionCollection (); if (!ac) { kdError () << "kpTool::createAction() without ac" << endl; return; } if (m_action) { // TODO: I don't think this will ever be executed as we are not called // outside of the constructor. #if DEBUG_KP_TOOL kdDebug () << "\tdeleting existing" << endl; #endif ac->remove (m_action); m_action = 0; } m_action = new kpToolAction (text (), iconName (), shortcutForKey (m_key), this, SLOT (slotActionActivated ()), m_mainWindow->actionCollection (), name ()); m_action->setExclusiveGroup (QString::fromLatin1 ("Tool Box Actions")); m_action->setWhatsThis (description ()); connect (m_action, SIGNAL (toolTipChanged (const QString &)), this, SLOT (slotActionToolTipChanged (const QString &))); }
void KCalResourceConfig::saveSettings( KRES::Resource *resource ) { KCalResource *res = static_cast<KCalResource*>( resource ); if ( res ) { KBB::ResourcePrefs *p = res->prefs(); p->setServer( mServerEdit->text() ); p->setProduct( mProductEdit->text() ); p->setComponent( mComponentEdit->text() ); } else { kdError(5700) << "KCalResourceConfig::saveSettings(): no KCalResource, cast failed" << endl; } }
void HTMLExporter::write(const KBookmarkGroup &grp, const QString &filename, bool showAddress) { QFile file(filename); if(!file.open(IO_WriteOnly)) { kdError(7043) << "Can't write to file " << filename << endl; return; } QTextStream tstream(&file); tstream.setEncoding(QTextStream::UnicodeUTF8); tstream << toString(grp, showAddress); }
Q_LONG KoStore::write( const char* _data, Q_ULONG _len ) { if ( _len == 0L ) return 0; if ( !m_bIsOpen ) { kdError(s_area) << "KoStore: You must open before writing" << endl; return 0L; } if ( m_mode != Write ) { kdError(s_area) << "KoStore: Can not write to store that is opened for reading" << endl; return 0L; } int nwritten = m_stream->writeBlock( _data, _len ); Q_ASSERT( nwritten == (int)_len ); m_iSize += nwritten; return nwritten; }
void MainView::checkAnswer() { if ( mQuestions.count() == 0 ) { kdError() << "checkAnswer(): no questions." << endl; return; } mReadyTimer.stop(); Question q = *mCurrentQuestion; QString text = "<qt>"; if ( mAnswerEdit->text() == q.answer() ) { text += i18n("Correct answer:"); mResultView->incrementCurrentCount(); mQuestions.remove( mCurrentQuestion ); } else { text += "<font color=\"red\">" + i18n("Wrong answer.") + "</font><br>"; text += i18n("Correct Answer:"); mResultView->incrementWrongCount(); } text += "<br>"; text += q.question() + " = " + q.answer(); text += "</qt>"; mFeedbackText->setText( text ); if ( mQuestions.count() == 0 ) { QString text = "<qt>"; text += i18n("<b>Congratulation!</b><br/>"); text += i18n("You answered all questions.<br/>"); text += "<br/>"; if ( mResultView->wrongCount() == 0 ) { text += i18n("You gave no wrong answers."); } else { text += i18n("You gave one wrong answer.", "You gave %n wrong answers", mResultView->wrongCount() ); } text += "<br/>"; text += mResultView->rating(); text += "</qt>"; KMessageBox::information( this, text ); mQuestionLabel->setText( "" ); mAnswerEdit->setText( "" ); mAnswerEdit->setEnabled( false ); mOkButton->setEnabled( false ); mFeedbackText->setText( i18n("You won.") ); } else { newQuestion(); } }
void SevenZipArch::unarchFileInternal( ) { if ( m_destDir.isEmpty() || m_destDir.isNull() ) { kdError( 1601 ) << "There was no extract directory given." << endl; return; } TDEProcess *kp = m_currentProcess = new TDEProcess; kp->clearArguments(); // extract (and maybe overwrite) *kp << m_unarchiver_program << "x"; if ( ArkSettings::extractOverwrite() ) { //*kp << "-ao"; } // FIXME overwrite existing files created with wrong password *kp << "-y"; if ( !m_password.isEmpty() ) *kp << "-p" + m_password; *kp << m_filename; // if the file list is empty, no filenames go on the command line, // and we then extract everything in the archive. if ( m_fileList ) { TQStringList::Iterator it; for ( it = m_fileList->begin(); it != m_fileList->end(); ++it ) { *kp << (*it); } } *kp << "-o" + m_destDir ; 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( slotExtractExited(TDEProcess*) ) ); if ( !kp->start( TDEProcess::NotifyOnExit, TDEProcess::AllOutput ) ) { KMessageBox::error( 0, i18n( "Could not start a subprocess." ) ); emit sigExtract( false ); } }
/*************************************************************************** * reads the df-commands results **/ int KDiskFreeSp::readDF( const QString & mountPoint ) { if (readingDFStdErrOut || dfProc->isRunning()) return -1; m_mountPoint = mountPoint; dfStringErrOut=""; // yet no data received dfProc->clearArguments(); (*dfProc) << QString::fromLocal8Bit(DF_COMMAND) << QString::fromLocal8Bit(DF_ARGS); if (!dfProc->start( KProcess::NotifyOnExit, KProcess::AllOutput )) kdError() << "could not execute ["<< DF_COMMAND << "]" << endl; return 1; }
void MicroSettingsDlg::slotCreatePinMap() { m_pNewPinMappingDlg = new KDialogBase( this, "New Pin Mapping Dlg", true, i18n("New Pin Mapping"), Ok | Cancel ); m_pNewPinMappingDlg->setButtonText( Ok, i18n("Create") ); m_pNewPinMappingWidget = new NewPinMappingWidget( m_pNewPinMappingDlg ); m_pNewPinMappingDlg->setMainWidget( m_pNewPinMappingWidget ); PinMappingNameValidator * validator = new PinMappingNameValidator( this ); m_pNewPinMappingWidget->nameEdit->setValidator( validator ); connect( m_pNewPinMappingWidget->nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckNewPinMappingName(const QString &)) ); slotCheckNewPinMappingName( 0 ); int accepted = m_pNewPinMappingDlg->exec(); unsigned selectedType = m_pNewPinMappingWidget->typeCombo->currentItem(); QString name = m_pNewPinMappingWidget->nameEdit->text(); delete m_pNewPinMappingDlg; delete validator; m_pNewPinMappingDlg = 0l; m_pNewPinMappingWidget = 0l; if ( accepted != QDialog::Accepted ) return; PinMapping::Type type = PinMapping::Invalid; switch ( selectedType ) { case 0: type = PinMapping::SevenSegment; break; case 1: type = PinMapping::Keypad_4x3; break; case 2: type = PinMapping::Keypad_4x4; break; default: kdError() << k_funcinfo << "Unknown selected type " << type << endl; break; } m_pinMappings[name] = PinMapping( type ); m_pWidget->pinMapCombo->insertItem( name ); m_pWidget->pinMapCombo->setCurrentItem( m_pWidget->pinMapCombo->count() - 1 ); updatePinMapButtons(); slotModifyPinMap(); }
void PMGlobalSettingsEdit::displayObject( PMObject* o ) { if( o->isA( "GlobalSettings" ) ) { bool readOnly = o->isReadOnly( ); m_pDisplayedObject = ( PMGlobalSettings* ) o; m_pAdcBailoutEdit->setValue( m_pDisplayedObject->adcBailout( ) ); m_pAdcBailoutEdit->setReadOnly( readOnly ); m_pAmbientLightEdit->setColor( m_pDisplayedObject->ambientLight( ) ); m_pAmbientLightEdit->setReadOnly( readOnly ); m_pAssumedGammaEdit->setValue( m_pDisplayedObject->assumedGamma( ) ); m_pAssumedGammaEdit->setReadOnly( readOnly ); m_pHfGray16Edit->setChecked( m_pDisplayedObject->hfGray16( ) ); m_pHfGray16Edit->setEnabled( !readOnly ); m_pIridWaveLengthEdit->setColor( m_pDisplayedObject->iridWaveLength( ) ); m_pIridWaveLengthEdit->setReadOnly( readOnly ); m_pMaxIntersectionsEdit->setValue( m_pDisplayedObject->maxIntersections( ) ); m_pMaxIntersectionsEdit->setReadOnly( readOnly ); m_pMaxTraceLevelEdit->setValue( m_pDisplayedObject->maxTraceLevel( ) ); m_pMaxTraceLevelEdit->setReadOnly( readOnly ); m_pNumberWavesEdit->setValue( m_pDisplayedObject->numberWaves( ) ); m_pNumberWavesEdit->setReadOnly( readOnly ); m_pNoiseGeneratorEdit->setCurrentItem( m_pDisplayedObject->noiseGenerator( ) ); m_pNoiseGeneratorEdit->setEnabled( !readOnly ); m_pRadiosityEdit->setChecked( m_pDisplayedObject->isRadiosityEnabled( ) ); m_pRadiosityEdit->setEnabled( !readOnly ); m_pBrightnessEdit->setValue( m_pDisplayedObject->brightness( ) ); m_pBrightnessEdit->setReadOnly( readOnly ); m_pCountEdit->setValue( m_pDisplayedObject->count( ) ); m_pCountEdit->setReadOnly( readOnly ); m_pDistanceMaximumEdit->setValue( m_pDisplayedObject->distanceMaximum( ) ); m_pDistanceMaximumEdit->setReadOnly( readOnly ); m_pErrorBoundEdit->setValue( m_pDisplayedObject->errorBound( ) ); m_pErrorBoundEdit->setReadOnly( readOnly ); m_pGrayThresholdEdit->setValue( m_pDisplayedObject->grayThreshold( ) ); m_pGrayThresholdEdit->setReadOnly( readOnly ); m_pLowErrorFactorEdit->setValue( m_pDisplayedObject->lowErrorFactor( ) ); m_pLowErrorFactorEdit->setReadOnly( readOnly ); m_pMinimumReuseEdit->setValue( m_pDisplayedObject->minimumReuse( ) ); m_pMinimumReuseEdit->setReadOnly( readOnly ); m_pNearestCountEdit->setValue( m_pDisplayedObject->nearestCount( ) ); m_pNearestCountEdit->setReadOnly( readOnly ); m_pRecursionLimitEdit->setValue( m_pDisplayedObject->recursionLimit( ) ); m_pRecursionLimitEdit->setReadOnly( readOnly ); slotRadiosityClicked( ); Base::displayObject( o ); } else kdError( PMArea ) << "PMGlobalSettingsEdit: Can't display object\n"; }
void KMixDockWidget::handleNewMaster(int soundcard_id, QString& channel_id) // !! @todo rework parameters { //kdDebug(67100) << "KMixDockWidget::handleNewMaster() soundcard_id=" << soundcard_id << " , channel_id=" << channel_id << endl; Mixer *mixer = Mixer::mixers().at(soundcard_id); if ( mixer == 0 ) { kdError(67100) << "KMixDockWidget::createPage(): Invalid Mixer (soundcard_id=" << soundcard_id << ")" << endl; return; // can not happen } m_mixer = mixer; Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere". Mixer::setMasterCardDevice( channel_id ); createMasterVolWidget(); }
DecoBenchApplication::DecoBenchApplication(const QString &library, Tests tests, int count) : m_tests(tests), m_count(count) { KConfig kwinConfig("kwinrc"); kwinConfig.setGroup("Style"); plugins = new KDecorationPreviewPlugins( &kwinConfig ); preview = new KDecorationPreview( plugins, 0 ); if (plugins->loadPlugin(library) ) kdDebug() << "Decoration library " << library << " loaded..." << endl; else kdError() << "Error loading decoration library " << library << "!" << endl; if (preview->recreateDecoration() ) kdDebug() << "Decoration created..." << endl; else kdError() << "Error creating decoration!" << endl; preview->show(); }