コード例 #1
0
AccessControlDataBackendManager::AccessControlDataBackendManager( PluginManager& pluginManager ) :
	m_backends(),
	m_defaultBackend( nullptr ),
	m_configuredBackend( nullptr )
{
	for( auto pluginObject : pluginManager.pluginObjects() )
	{
		auto pluginInterface = qobject_cast<PluginInterface *>( pluginObject );
		auto accessControlDataBackendInterface = qobject_cast<AccessControlDataBackendInterface *>( pluginObject );

		if( pluginInterface && accessControlDataBackendInterface )
		{
			m_backends[pluginInterface->uid()] = accessControlDataBackendInterface;

			if( pluginInterface->flags().testFlag( Plugin::ProvidesDefaultImplementation ) )
			{
				m_defaultBackend = accessControlDataBackendInterface;
			}
		}
	}

	if( m_defaultBackend == nullptr )
	{
		qCritical( "AccessControlDataBackendManager: no default plugin available!" );
	}

	reloadConfiguration();
}
コード例 #2
0
ファイル: firefox.cpp プロジェクト: aarontc/kde-workspace
Firefox::Firefox(QObject *parent) :
    QObject(parent),
    m_favicon(new FallbackFavicon(this)),
    m_fetchsqlite(0)
{
  reloadConfiguration();
  //qDebug() << "Loading Firefox Bookmarks Browser";
}
コード例 #3
0
ファイル: charrunner.cpp プロジェクト: fluxer/kde-extraapps
CharacterRunner::CharacterRunner( QObject* parent, const QVariantList &args )
    : Plasma::AbstractRunner(parent, args)
{
    Q_UNUSED(args)
    setObjectName(QLatin1String( "CharacterRunner" ));
    setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File |
                         Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::Executable |
                         Plasma::RunnerContext::ShellCommand);
    reloadConfiguration();
}
コード例 #4
0
AudioPlayerControlRunner::AudioPlayerControlRunner(QObject *parent, const QVariantList& args)
        : Plasma::AbstractRunner(parent, args)
{
    Q_UNUSED(args);

    setObjectName(QLatin1String( "Audio Player Control Runner" ));
    setSpeed(AbstractRunner::SlowSpeed);

    qDBusRegisterMetaType<QList<QVariantMap> >();

    connect(this, SIGNAL(prepare()), this, SLOT(prep()));

    reloadConfiguration();
}
コード例 #5
0
ファイル: ImapAccess.cpp プロジェクト: KDE/trojita
ImapAccess::ImapAccess(QObject *parent, QSettings *settings, Plugins::PluginManager *pluginManager, const QString &accountName) :
    QObject(parent), m_settings(settings), m_imapModel(0), m_mailboxModel(0), m_mailboxSubtreeModel(0), m_msgListModel(0),
    m_threadingMsgListModel(0), m_visibleTasksModel(0), m_oneMessageModel(0), m_netWatcher(0), m_msgQNAM(0),
    m_pluginManager(pluginManager), m_passwordWatcher(0), m_port(0),
    m_connectionMethod(Common::ConnectionMethod::Invalid),
    m_sslInfoIcon(UiUtils::Formatting::IconType::NoIcon),
    m_accountName(accountName)
{
    Imap::migrateSettings(m_settings);
    reloadConfiguration();
    m_cacheDir = Common::writablePath(Common::LOCATION_CACHE) + m_accountName + QLatin1Char('/');;
    m_passwordWatcher = new UiUtils::PasswordWatcher(this, m_pluginManager,
                                                     // FIXME: this can be removed when support for multiple accounts is implemented
                                                     accountName.isEmpty() ? QStringLiteral("account-0") : accountName,
                                                     QStringLiteral("imap"));
}
コード例 #6
0
Translator::Translator(QObject *parent, const QVariantList &args)
    : Plasma::AbstractRunner(parent, args)
{
    Q_UNUSED(args);
    
    setObjectName(QLatin1String("Translator"));
    reloadConfiguration();
    setHasRunOptions(true);
    setIgnoredTypes(Plasma::RunnerContext::Directory |
                    Plasma::RunnerContext::File |
                    Plasma::RunnerContext::NetworkLocation);
    setSpeed(AbstractRunner::SlowSpeed);
    setPriority(HighestPriority);
    setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<language code>")),i18n("Translates the word(s) :q: into target language")));
    setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<source languagce>-<target languagce>")), i18n("Translates the word(s) :q: from the source into target language")));
}
コード例 #7
0
BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args )
    : Plasma::AbstractRunner(parent, args)
{
    Q_UNUSED(args)
    setObjectName( QLatin1String("Bookmarks" ));
    m_icon = KIcon("bookmarks");
    m_bookmarkManager = KBookmarkManager::userBookmarksManager();
    m_browser = whichBrowser();
    addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds web browser bookmarks matching :q:.")));
    setDefaultSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", "bookmarks"),
                                   i18n("List all web browser bookmarks")));

    connect(this, SIGNAL(prepare()), this, SLOT(prep()));
    connect(this, SIGNAL(teardown()), this, SLOT(down()));

    reloadConfiguration();
}
コード例 #8
0
void HttpServerConfigFacade::loadConfiguration(std::string const &filePath) {
	rapidxml::file<> xmlFile(filePath.c_str());
	rapidxml::xml_document<> doc;
	doc.parse<0>(xmlFile.data());

	auto httpServer = doc.first_node("HttpServer");

	std::map<std::string, std::string> tcpSettings;
	auto server = (*httpServer).first_node("Server");
	readXmlSettings(server, tcpSettings);
	// Setting TCP config
	{
		listenPort_ = std::strtoul(tcpSettings["Port"].c_str(), nullptr, 10);
		initialUserConnection_ = std::strtoul(tcpSettings["InitialUserConnection"].c_str(), nullptr, 10);
		maxUserConnection_ = std::strtoul(tcpSettings["MaxUserConnection"].c_str(), nullptr, 10);
		bufferSize_ = SIZE_128KB;
		numaNode_ = std::strtoul(tcpSettings["NumaNode"].c_str(), nullptr, 10);
	}

	std::map<std::string, std::string> httpSettings;
	auto http = (*httpServer).first_node("Http");
	readXmlSettings(http, httpSettings);
	// Setting HTTP config
	{
		host_ = httpSettings["Host"];
		serverName_ = httpSettings["ServerName"];
		enableSSLProto_ = httpSettings["EnableSSL"] == "true" ? true : false;
		enableHttp2Proto_ = httpSettings["EnableHTTP2"] == "true" ? true : false;
		tempFilePath_ = httpSettings["TempFilePath"];
		rootPath_ = httpSettings["RootPath"];
		indexFileName_ = httpSettings["IndexFileName"];
	}

	std::map<std::string, std::string> sslSettings;
	auto ssl = (*httpServer).first_node("SSL");
	if (ssl != nullptr) {
		readXmlSettings(ssl, sslSettings);
		// Setting SSL config
		{
			certificateFilePath_ = sslSettings["CertificateFilePath"];
			privateKeyFilePath_ = sslSettings["PrivateKeyFilePath"];
		}
	}

	std::map<std::string, std::string> loggerSettings;
	auto logger = (*httpServer).first_node("Logger");
	if (logger != nullptr) {
		readXmlSettings(logger, loggerSettings);
		if (loggerSettings.empty()) {
			// TDOO: throw an exception?
			return;
		}
		rapid::logging::startLogging(getLogLevel(loggerSettings["Level"]));
		std::vector<std::shared_ptr<rapid::logging::LogAppender>> appenders;
		std::map<std::string, rapidxml::xml_node<char> *> settings;
		readAppenderSettring(logger, settings);
		if (settings.empty()) {
			// TDOO: throw an exception?
			return;
		}
		createAppenderFromSetting(settings, appenders);
	} else {
		// TDOO: throw an exception?
		return;
	}

	namespace FS = std::tr2::sys;
	FS::path watchFilePath(filePath);

	pFileWatcher_ = std::make_unique<rapid::platform::FileSystemWatcher>(watchFilePath.parent_path());
	pFileWatchTimer_ = rapid::details::Timer::createTimer();

	pFileWatchTimer_->start([this, filePath]() {
		if (!pFileWatcher_->getChangedFile().empty()) {
			RAPID_LOG_TRACE() << "File configuration changed!";
			try {
				reloadConfiguration(filePath);
			} catch (std::exception const &e) {
				RAPID_LOG_FATAL() << e.what();
			}
		}
	}, 500);
}