SvnJobBase::SvnJobBase( KDevSvnPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity ) : VcsJob( parent, verbosity ), m_part( parent ), m_status( KDevelop::VcsJob::JobNotStarted ) { setCapabilities( KJob::Killable ); setTitle( "Subversion" ); }
void DUChainControlFlowJob::init(const QString &jobName) { setObjectName(i18n("Generating control flow graph for %1", jobName)); setCapabilities(Killable); setAutoDelete(false); ICore::self()->uiController()->registerStatus(this); }
KMobileGnokii::KMobileGnokii(QObject *obj, const char *name, const QStringList &args ) : KMobileDevice(obj, name, args) { // set initial device info setClassType( Phone ); m_deviceName = i18n("Mobile Phone accessed via GNOKII"); m_deviceRevision = ""; m_connectionName = "/dev/ircomm0"; setCapabilities( hasAddressBook | hasNotes ); m_numAddresses = -1; // now initialize the configuration based on the // given config file from args[0] loadDeviceConfiguration(); if (m_modelnr.isEmpty()) loadGnokiiConfiguration(); if (m_modelnr.isEmpty()) { // default communcation values m_modelnr = "6310"; m_connection = "infrared"; m_port = "/dev/ircomm0"; m_baud = "9600"; } PRINT_DEBUG << QString("Using GNOKII configuration: %1 %2 %3 %4\n").arg(m_modelnr) .arg(m_connection).arg(m_port).arg(m_baud); saveDeviceConfiguration(); saveGnokiiConfiguration(); }
ZeroConfDiscoverDevice::ZeroConfDiscoverDevice(const std::string& type) : osgGA::Device() , _autoDiscovery(new AutoDiscovery()) { setCapabilities(RECEIVE_EVENTS); _autoDiscovery->discoverServices(type, new MyDiscoveredServicesCallback(this, type)); }
DocCHMPlugin::DocCHMPlugin(QObject* parent, const char* name, QStringList // args ) :DocumentationPlugin(DocCHMPluginFactory::instance()->config(), parent, name) { setCapabilities(CustomDocumentationTitles); // | Index | FullTextSearch | ProjectDocumentation autoSetup(); }
OscSendingDevice::OscSendingDevice(const std::string& address, int port, unsigned int num_messages_per_event, unsigned int delay_between_sends_in_millisecs) : osgGA::Device() , _transmitSocket(IpEndpointName(address.c_str(), port)) , _buffer(new char[BUFFER_SIZE]) , _oscStream(_buffer, BUFFER_SIZE) , _numMessagesPerEvent(osg::maximum(1u,num_messages_per_event)) , _delayBetweenSendsInMilliSecs( (_numMessagesPerEvent > 1) ? delay_between_sends_in_millisecs : 0) , _msgId(0) , _lastEvent(NULL) { setCapabilities(SEND_EVENTS); OSG_NOTICE << "OscDevice :: sending events to " << address << ":" << port << " "; #ifdef OSC_HOST_LITTLE_ENDIAN OSG_NOTICE << "(little endian)"; #elif OSC_HOST_BIG_ENDIAN OSG_NOTICE << "(big endian)"; #endif OSG_NOTICE << " (" << _numMessagesPerEvent << "msgs/event, " << _delayBetweenSendsInMilliSecs << "ms delay between msgs)"; OSG_NOTICE << std::endl; }
void ScriptPlugin::init() { addAuthor(QLatin1String("euroelessar")); setInfo(QT_TRANSLATE_NOOP("Plugin", "Script API"), QT_TRANSLATE_NOOP("Plugin", "Added ability to create plugins at JavaScript"), PLUGIN_VERSION(0, 0, 1, 0), ExtensionIcon("network-wireless")); setCapabilities(Loadable); }
OsmPlugin::OsmPlugin( QObject *parent ) : RunnerPlugin( parent ) { setCapabilities( Parsing ); setName( tr( "Osm File Parser" ) ); setNameId( "Osm" ); setDescription( tr( "Create GeoDataDocument from Osm Files" ) ); setGuiString( tr( "Osm Parser" ) ); }
Job::Job(Archive *archive, ReadOnlyArchiveInterface *interface) : KJob() , m_archive(archive) , m_archiveInterface(interface) , d(new Private(this)) { setCapabilities(KJob::Killable); }
void BirthdayReminder::init() { setInfo(QT_TRANSLATE_NOOP("Plugin", "BirthdayReminder"), QT_TRANSLATE_NOOP("Plugin", "This plugin shows notifications when someone from " "your contact list has a birthday"), PLUGIN_VERSION(0, 1, 0, 0)); setCapabilities(Loadable); }
FunambolSyncJob::FunambolSyncJob(QObject* parent) : SyncJob(parent), d(new FunambolSyncJob::Private) { d->backend = 0; d->config = 0; setCapabilities(KJob::NoCapabilities); // TODO: at a later time, see if we can suspend the sync or kill it }
void MassMessaging::init() { debug() << Q_FUNC_INFO; addAuthor(QLatin1String("sauron")); setInfo(QT_TRANSLATE_NOOP("Plugin", "MassMessaging"), QT_TRANSLATE_NOOP("Plugin", "Simple messaging to contact list"), PLUGIN_VERSION(0, 1, 0, 0)); setCapabilities(Loadable); }
Nepomuk::MassUpdateJob::MassUpdateJob( QObject* parent ) : KJob( parent ), m_index( -1 ) { kDebug(); setCapabilities( Killable|Suspendable ); connect( &m_processTimer, SIGNAL( timeout() ), this, SLOT( slotNext() ) ); }
void SessionHelper::init() { setInfo(QT_TRANSLATE_NOOP("Plugin", "Session helper"), QT_TRANSLATE_NOOP("Plugin", "Activates the session when certain events"), PLUGIN_VERSION(0, 1, 0, 0)); setCapabilities(Loadable); addAuthor(QLatin1String("sauron")); addAuthor(QLatin1String("nicoizo")); }
RoutinoPlugin::RoutinoPlugin( QObject *parent ) : RunnerPlugin( parent ) { setCapabilities( Routing ); setSupportedCelestialBodies( QStringList() << "earth" ); setCanWorkOffline( true ); setName( tr( "Routino" ) ); setNameId( "routino" ); setDescription( tr( "Retrieves routes from routino" ) ); setGuiString( tr( "Routino Routing" ) ); }
MetadataJob::MetadataJob(QObject *parent) : Job(parent) , m_core(0) , m_addCompressedPackages(false) { setCapabilities(Cancelable); connect(&m_xmlTask, &QFutureWatcherBase::finished, this, &MetadataJob::xmlTaskFinished); connect(&m_metadataTask, &QFutureWatcherBase::finished, this, &MetadataJob::metadataTaskFinished); connect(&m_metadataTask, &QFutureWatcherBase::progressValueChanged, this, &MetadataJob::progressChanged); }
void EmoEditPlugin::init() { addAuthor(QLatin1String("euroelessar")); setInfo(QT_TRANSLATE_NOOP("Plugin", "EmoEdit plugin"), QT_TRANSLATE_NOOP("Plugin", "Add emoticons to text edit widget"), PLUGIN_VERSION(0, 0, 1, 0), ExtensionIcon()); setCapabilities(Loadable); m_inParsingState = false; }
BatchExtract::BatchExtract(QObject* parent) : KCompositeJob(parent), m_autoSubfolder(false), m_preservePaths(true), m_openDestinationAfterExtraction(false), m_registered(false) { setCapabilities(KJob::Killable); connect(this, &KJob::result, this, &BatchExtract::showFailedFiles); }
void MetamenuPlugin::init () { qutim_sdk_0_3::ExtensionIcon icon("info"); addAuthor(QLatin1String("nicoizo")); setInfo(QT_TRANSLATE_NOOP("Plugin", "MetaMenu"), QT_TRANSLATE_NOOP("Plugin", "Ubuntu metamenu integration"), PLUGIN_VERSION(0, 0, 1, 1), icon ); setCapabilities(Loadable); }
void MassMessaging::init() { debug() << Q_FUNC_INFO; addAuthor(QT_TRANSLATE_NOOP("Author","Sidorov Aleksey"), QT_TRANSLATE_NOOP("Task","Author"), QLatin1String("*****@*****.**"), QLatin1String("sauron.me")); setInfo(QT_TRANSLATE_NOOP("Plugin", "MassMessaging"), QT_TRANSLATE_NOOP("Plugin", "Simple messaging to contact list"), PLUGIN_VERSION(0, 1, 0, 0)); setCapabilities(Loadable); }
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const KUrl& destination): KJob() { Q_ASSERT(destination.isLocalFile()); //TODO: Make a precondition before calling this function that destination file exists mOrigin = origin; mSize = size; mWritten = 0; m_speedBytes = 0; mDestination = destination; mDestinationJob = 0; mDeviceName = i18nc("Device name that will appear on the jobs", "KDE-Connect"); setCapabilities(Killable); kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination; }
void PhononSoundPlugin::init() { addAuthor(QT_TRANSLATE_NOOP("Author", "Ruslan Nigmatullin"), QT_TRANSLATE_NOOP("Task", "Author"), QLatin1String("*****@*****.**")); setInfo(QT_TRANSLATE_NOOP("Plugin", "Phonon sound engine"), QT_TRANSLATE_NOOP("Plugin", "Sound engine based on KDE sound engine"), PLUGIN_VERSION(0, 1, 0, 0), ExtensionIcon()); setCapabilities(Loadable); addExtension<PhononSoundBackend>( QT_TRANSLATE_NOOP("Plugin", "Phonon sound engine"), QT_TRANSLATE_NOOP("Plugin", "Sound engine based on KDE sound engine"), ExtensionIcon()); }
static bool restrictCapabilities() { // Capabilities we need. // CAP_SYS_ADMIN capabilty is added because cloning with CLONE_NEWPID flag later will need it. cap_value_t capabilityList[] = { CAP_SETUID, CAP_SETGID, CAP_SYS_ADMIN, CAP_SYS_CHROOT}; // Reduce capabilities to what we need. // Although we still have root euid and we keep root equivalent capabilities, // we removed (= didn't add) CAP_SYS_RESSOURCE capabilites and this resulted that // the setrlimit function with RLIMIT_NOFILE will be effective later. if (!setCapabilities(capabilityList, sizeof(capabilityList) / sizeof(capabilityList[0]))) { fprintf(stderr, "Could not adjust process capabilities: %s.\n", strerror(errno)); return false; } return true; }
QbsKJob::QbsKJob(const QbsKJob::CreateQbsJobFunction &function, const QString &buildDir, QObject *parent) : KDevelop::OutputJob(parent) , m_createQbsJobFunction(function) , m_job(nullptr) { KDevelop::OutputModel* model = new KDevelop::OutputModel( QUrl::fromLocalFile(buildDir) ); model->setFilteringStrategy( KDevelop::OutputModel::CompilerFilter ); setModel(model); setCapabilities(Killable); setStandardToolView(KDevelop::IOutputView::BuildView); setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll ); setObjectName(buildDir); setDelegate(new KDevelop::OutputDelegate); setKillJobOnOutputClose(true); }
OscSendingDevice::OscSendingDevice(const std::string& address, int port) : osgGA::Device() , _transmitSocket(IpEndpointName(address.c_str(), port)) , _buffer(new char[BUFFER_SIZE]) , _oscStream(_buffer, BUFFER_SIZE) { setCapabilities(SEND_EVENTS); OSG_NOTICE << "OscDevice :: sending events to " << address << ":" << port << " "; #ifdef OSC_HOST_LITTLE_ENDIAN OSG_NOTICE << "(little endian)"; #elif OSC_HOST_BIG_ENDIAN OSG_NOTICE << "(big endian)"; #endif OSG_NOTICE << std::endl; }
KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &args) : KLibFactory(obj,name), m_config(0L), d(0L) { setClassType(Unclassified); setCapabilities(hasNothing); m_deviceName = i18n("Unknown Device"); m_deviceRevision = i18n("n/a"); /* not available */ m_connectionName = i18n("Unknown Connection"); // set the config file name m_configFileName = args[0]; if (m_configFileName.isEmpty()) m_config = new KConfig(); else m_config = new KConfig(m_configFileName); PRINT_DEBUG << QString("name of config file is %1\n").arg(m_configFileName); }
void WeatherPlugin::init() { addAuthor( QT_TRANSLATE_NOOP( "Author", "Nikita Belov" ), QT_TRANSLATE_NOOP( "Task", "Developer" ), QLatin1String("*****@*****.**") ); setInfo( QT_TRANSLATE_NOOP("Plugin", "Weather plugin"), QT_TRANSLATE_NOOP("Plugin", "Plugin shows a current weather in your city."), PLUGIN_VERSION( 0, 0, 1, 0 ), ExtensionIcon( QIcon( ":/icons/weather.png" ) ) ); setCapabilities(Loadable); ActionGenerator *gen = new ActionGenerator(QIcon(":/icons/weather.png"), QT_TRANSLATE_NOOP("Weather", "Get weather"), SLOT(getWeather())); MenuController::addAction<WContact>(gen); gen = new ActionGenerator(QIcon(":/icons/weather.png"), QT_TRANSLATE_NOOP("Weather", "Get weather forecast"), SLOT(getForecast())); MenuController::addAction<WContact>(gen); }
RestHttpDevice::RestHttpDevice(const std::string& listening_address, const std::string& listening_port, const std::string& doc_root) : osgGA::Device() , OpenThreads::Thread() , _server(listening_address, listening_port, osgDB::findDataFile(doc_root), std::max(OpenThreads::GetNumberOfProcessors() - 1, 1)) , _serverAddress(listening_address) , _serverPort(listening_port) , _documentRoot(doc_root) , _firstEventLocalTimeStamp() , _firstEventRemoteTimeStamp(-1) , _lastEventRemoteTimeStamp(0) , _currentMouseX(0.0f) , _currentMouseY(0.0f) , _targetMouseX(0.0f) , _targetMouseY(0.0f) , _targetMouseChanged(false) { setCapabilities(RECEIVE_EVENTS); OSG_NOTICE << "RestHttpDevice :: listening on " << listening_address << ":" << listening_port << ", document root: " << doc_root << std::endl; if (osgDB::findDataFile(doc_root).empty()) { OSG_WARN << "RestHttpDevice :: warning, can't locate document-root '" << doc_root << "'for the http-server, starting anyway" << std::endl; } _server.setCallback(new RestHttp::RequestHandlerDispatcherCallback(this)); addRequestHandler(new RestHttp::KeyCodeRequestHandler(false)); addRequestHandler(new RestHttp::KeyCodeRequestHandler(true)); addRequestHandler(new RestHttp::SetMouseInputRangeRequestHandler()); addRequestHandler(new RestHttp::MouseMotionRequestHandler()); addRequestHandler(new RestHttp::MouseButtonRequestHandler(RestHttp::MouseButtonRequestHandler::PRESS)); addRequestHandler(new RestHttp::MouseButtonRequestHandler(RestHttp::MouseButtonRequestHandler::RELEASE)); addRequestHandler(new RestHttp::MouseButtonRequestHandler(RestHttp::MouseButtonRequestHandler::DOUBLE_PRESS)); addRequestHandler(new RestHttp::HomeRequestHandler()); addRequestHandler(new RestHttp::StandardRequestHandler()); // start the thread start(); }
static bool dropPrivileges() { // We become explicitely non dumpable. if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == -1) { fprintf(stderr, "Setting dumpable is failed: %s\n", strerror(errno)); return false; } if (setresgid(sandboxUserGID, sandboxUserGID, sandboxUserGID) == -1) { fprintf(stderr, "Failed to fallback to group: %d.\n", sandboxUserGID); return false; } if (setresuid(sandboxUserUID, sandboxUserUID, sandboxUserUID) == -1) { fprintf(stderr, "Failed to fallback to user: %d.\n", sandboxUserUID); return false; } // Drop all capabilities. Again, setuid() normally takes care of this if we had euid 0. return setCapabilities(0, 0); }
CustomBuildJob::CustomBuildJob( CustomBuildSystem* plugin, KDevelop::ProjectBaseItem* item, CustomBuildSystemTool::ActionType t ) : OutputJob( plugin ), type( t ), killed( false ), enabled( false ) { setCapabilities( Killable ); QString subgrpname; QString title; switch( type ) { case CustomBuildSystemTool::Build: title = i18n( "Building:" ); subgrpname = QString( "%1Build" ).arg( ConfigConstants::toolGroupPrefix ); break; case CustomBuildSystemTool::Clean: title = i18n( "Cleaning:" ); subgrpname = QString( "%1Clean" ).arg( ConfigConstants::toolGroupPrefix ); break; case CustomBuildSystemTool::Install: title = i18n( "Installing:" ); subgrpname = QString( "%1Install" ).arg( ConfigConstants::toolGroupPrefix ); break; case CustomBuildSystemTool::Configure: title = i18n( "Configuring:" ); subgrpname = QString( "%1Configure" ).arg( ConfigConstants::toolGroupPrefix ); break; case CustomBuildSystemTool::Prune: title = i18n( "Pruning:" ); subgrpname = QString( "%1Prune" ).arg( ConfigConstants::toolGroupPrefix ); break; case CustomBuildSystemTool::Undefined: return; } setTitle( QString("%1 %2").arg( cmd ).arg( item->text() ) ); setObjectName( QString("%1 %2").arg( cmd ).arg( item->text() ) ); builddir = plugin->buildDirectory( item ).toLocalFile(); KConfigGroup grp = plugin->configuration( item->project() ).group( subgrpname ); enabled = grp.readEntry( ConfigConstants::toolEnabled, false ); cmd = grp.readEntry( ConfigConstants::toolExecutable, KUrl() ).toLocalFile(); environment = grp.readEntry( ConfigConstants::toolEnvironment, "" ); arguments = grp.readEntry( ConfigConstants::toolArguments, "" ); setDelegate( new KDevelop::OutputDelegate ); }