当前位置: 首页>>代码示例>>C++>>正文


C++ QWebSettings::setOfflineStoragePath方法代码示例

本文整理汇总了C++中QWebSettings::setOfflineStoragePath方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSettings::setOfflineStoragePath方法的具体用法?C++ QWebSettings::setOfflineStoragePath怎么用?C++ QWebSettings::setOfflineStoragePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebSettings的用法示例。


在下文中一共展示了QWebSettings::setOfflineStoragePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createWidget

WebWidget* QtWebKitWebBackend::createWidget(bool isPrivate, ContentsWidget *parent)
{
	if (!m_isInitialized)
	{
		m_isInitialized = true;

		QWebHistoryInterface::setDefaultInterface(new QtWebKitHistoryInterface(this));

		QWebSettings *globalSettings = QWebSettings::globalSettings();
		globalSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
		globalSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

		const QString cachePath = SessionsManager::getCachePath();

		if (!cachePath.isEmpty())
		{
			QDir().mkpath(cachePath);

			globalSettings->setIconDatabasePath(cachePath);
			globalSettings->setLocalStoragePath(cachePath + QLatin1String("/localStorage/"));
			globalSettings->setOfflineStoragePath(cachePath + QLatin1String("/offlineStorage/"));
			globalSettings->setOfflineWebApplicationCachePath(cachePath + QLatin1String("/offlineWebApplicationCache/"));
		}

		QWebSettings::setMaximumPagesInCache(SettingsManager::getValue(QLatin1String("Cache/PagesInMemoryLimit")).toInt());

		optionChanged(QLatin1String("Browser/"));

		connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString)));
	}

	return new QtWebKitWebWidget(isPrivate, this, NULL, parent);
}
开发者ID:neonKow,项目名称:otter-browser,代码行数:33,代码来源:QtWebKitWebBackend.cpp

示例2: icon

QtMainWindow::QtMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtMainWindow),
    webInspectorWindow(new QtWebInspector()),
    cb(NULL),
    cur_tbrp(0),
    m_alertDialog(0),
    m_LogicalDpiX(0),
    m_LogicalDpiY(0),
	firstShow(true)
    //TODO: m_SyncStatusDlg
{
#ifdef OS_WINDOWS_DESKTOP
    QPixmap icon(":/images/rho.png");
    QApplication::setWindowIcon(icon);
#endif

    ui->setupUi(this);

    QWebSettings* qs = QWebSettings::globalSettings(); //this->ui->webView->settings();
    qs->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    qs->setAttribute(QWebSettings::LocalStorageEnabled, true);
    qs->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    qs->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
    qs->setOfflineStorageDefaultQuota(1024*1024*1024);

    rho::String rs_dir = RHODESAPP().getRhoRootPath()+RHO_EMULATOR_DIR;
    qs->setOfflineWebApplicationCachePath(rs_dir.c_str());
    qs->setLocalStoragePath(rs_dir.c_str());
    qs->setOfflineStoragePath(rs_dir.c_str());

    this->ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->ui->webView->page()->mainFrame()->securityOrigin().setDatabaseQuota(1024*1024*1024);
    this->main_webView = this->ui->webView;
    this->main_webInspector = webInspectorWindow->webInspector();
    this->cur_webInspector = this->main_webInspector;

    this->move(0,0);
    this->ui->toolBar->hide();
    this->ui->toolBarRight->hide();

    // connecting WebInspector
    main_webInspector->setPage(ui->webView->page());

#ifdef OS_SYMBIAN
    QWebViewKineticScroller *newScroller = new QWebViewKineticScroller();
    newScroller->setWidget(this->ui->webView);
    QWebViewSelectionSuppressor* suppressor = new QWebViewSelectionSuppressor(this->ui->webView);
#endif

#if defined(RHODES_EMULATOR)
    webInspectorWindow->show();
#endif
}
开发者ID:mcaloon,项目名称:rhodes,代码行数:54,代码来源:QtMainWindow.cpp

示例3: initWebSettings

bool WebSettings::initWebSettings()
{
    if (!localSettingsLoaded)
        return false;

    qDebug("webOS::WebSettings::initWebSettings");

    QWebSettings* globalWebSettings = QWebSettings::globalSettings();
    QSettings settings;

    if (settings.value(WEB_SETTINGS_KEY_PERSISTENT_STORAGE).toBool()) {
        QString path = settings.value(WEB_SETTINGS_KEY_PERSISTENT_STORAGE_PATH).toString();

        if (!path.isEmpty()) {
            globalWebSettings->setAttribute(QWebSettings::LocalStorageEnabled, true);
            globalWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
            globalWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
            globalWebSettings->setIconDatabasePath(path);
            globalWebSettings->setOfflineWebApplicationCachePath(path);
            globalWebSettings->setOfflineStoragePath(QString("%1/Databases").arg(path));
            globalWebSettings->setLocalStoragePath(QString("%1/LocalStorage").arg(path));
        }
    }

    if (settings.contains(WEB_SETTINGS_KEY_AUTO_LOAD_IMAGES))
        globalWebSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(WEB_SETTINGS_KEY_AUTO_LOAD_IMAGES).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_DNS_PREFETCH))
        globalWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, settings.value(WEB_SETTINGS_KEY_DNS_PREFETCH).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_ICON_DATABASE_PATH))
        globalWebSettings->setIconDatabasePath(settings.value(WEB_SETTINGS_KEY_ICON_DATABASE_PATH).toString());

    if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT))
        globalWebSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_PLUGINS))
        globalWebSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(WEB_SETTINGS_KEY_PLUGINS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_PRIVATE_BROWSING))
        globalWebSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, settings.value(WEB_SETTINGS_KEY_PRIVATE_BROWSING).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_OPEN_WINDOWS))
        globalWebSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_OPEN_WINDOWS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_CLOSE_WINDOWS))
        globalWebSettings->setAttribute(QWebSettings::JavascriptCanCloseWindows, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_CLOSE_WINDOWS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_ACCESS_CLIPBOARD))
        globalWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_ACCESS_CLIPBOARD).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_DEVELOPER_EXTRAS))
        globalWebSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(WEB_SETTINGS_KEY_DEVELOPER_EXTRAS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_SPACIAL_NAVIGATION))
        globalWebSettings->setAttribute(QWebSettings::SpatialNavigationEnabled, settings.value(WEB_SETTINGS_KEY_SPACIAL_NAVIGATION).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_LINKS_INCLUDED_IN_FOCUS_CHAIN))
        globalWebSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, settings.value(WEB_SETTINGS_KEY_LINKS_INCLUDED_IN_FOCUS_CHAIN).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_ZOOM_TEXT_ONLY))
        globalWebSettings->setAttribute(QWebSettings::ZoomTextOnly, settings.value(WEB_SETTINGS_KEY_ZOOM_TEXT_ONLY).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_PRINT_ELEMENT_BACKGROUNDS))
        globalWebSettings->setAttribute(QWebSettings::PrintElementBackgrounds, settings.value(WEB_SETTINGS_KEY_PRINT_ELEMENT_BACKGROUNDS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE)) {
        bool offlineStorageDatabaseEnabled = settings.value(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE).toBool();
        globalWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, offlineStorageDatabaseEnabled);
        if (offlineStorageDatabaseEnabled && settings.contains(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE_PATH))
            globalWebSettings->setOfflineStoragePath(settings.value(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE_PATH).toString());
    }

    if (settings.contains(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE)) {
        bool offlineWebApplicationCachedEnabled = settings.value(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE).toBool();
        globalWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, offlineWebApplicationCachedEnabled);
        if (offlineWebApplicationCachedEnabled && settings.contains(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE_PATH))
            globalWebSettings->setOfflineWebApplicationCachePath(settings.value(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE_PATH).toString());
    }

    if (settings.contains(WEB_SETTINGS_KEY_LOCAL_STORAGE)) {
        bool localStorageEnabled = settings.value(WEB_SETTINGS_KEY_LOCAL_STORAGE).toBool();
        globalWebSettings->setAttribute(QWebSettings::LocalStorageEnabled, localStorageEnabled);
        if (localStorageEnabled && settings.contains(WEB_SETTINGS_KEY_LOCAL_STORAGE_PATH))
            globalWebSettings->setLocalStoragePath(settings.value(WEB_SETTINGS_KEY_LOCAL_STORAGE_PATH).toString());
    }

    if (settings.contains(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_REMOTE_URLS))
        globalWebSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, settings.value(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_REMOTE_URLS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_FILE_URLS))
        globalWebSettings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, settings.value(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_FILE_URLS).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_XSS_AUDITING))
        globalWebSettings->setAttribute(QWebSettings::XSSAuditingEnabled, settings.value(WEB_SETTINGS_KEY_XSS_AUDITING).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_ACCELERATED_COMPOSITING))
        globalWebSettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, settings.value(WEB_SETTINGS_KEY_ACCELERATED_COMPOSITING).toBool());

    if (settings.contains(WEB_SETTINGS_KEY_WEBGL))
//.........这里部分代码省略.........
开发者ID:ericblade-owo,项目名称:WebKitSupplemental,代码行数:101,代码来源:weboswebsettings.cpp

示例4: loadSettings

bool Kludget::loadSettings(const KludgetInfo &i, bool loadPage)
{
    info = i;

#if 1

    qDebug("path: %s", qPrintable(info.path));
    qDebug("name: %s", qPrintable(info.name));
    qDebug("config: %s", qPrintable(info.configFile));
    qDebug("instance config: %s", qPrintable(info.instancePreferenceFile));
    qDebug("storage: %s", qPrintable(info.storagePath));
    qDebug("contentSrc: %s", qPrintable(info.contentSrc));
#endif

    if (!QFile::exists(info.configFile))
    {
        KLog::log("Kludget::load fail");
        KLog::log("config file not found");
        return false;
    }

    window->setWindowTitle(info.id + ":" + QString::number(QApplication::applicationPid()));

    // access
    KDocument access;
    access.openDocument(info.storagePath + "/access.xml");
    bool accessLocal = access.getValue("kludget/access/local", "0").toInt();
    bool accessNetwork = access.getValue("kludget/access/network", "0").toInt();
    bool accessPlugins = access.getValue("kludget/access/plugins", "0").toInt();
    bool accessSystem = access.getValue("kludget/access/system", "0").toInt();

    // engine
    KDocument engine;
    engine.openDocument(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + ENGINE_CONFIG_FILE);

    // instance settings
    settings->setPath(info.instancePreferenceFile);
#if defined(WIN32)

    settings->loadPreferences(":resources/xml/widgetPreferences.xml");
#else

    settings->loadPreferences(":resources/xml/widgetPreferences_linux.xml");
#endif

    settings->loadPreferences(info.configFile);
    settings->loadPreferences(info.path + "/" + PREFERENCE_FILE);

    // position
    int x = settings->read("kludget/x", window->x()).toInt();
    int y = settings->read("kludget/y", window->y()).toInt();
    window->move(x, y);

    resize(settings->read("kludget/width", info.width).toInt(), settings->read("kludget/height", info.height).toInt());

    window->setOpacity(settings->read("kludget/opacity", 200).toInt());
    window->setIgnoreDrag(settings->read("kludget/ignoreDrag", "0").toInt());
    window->setIgnoreMouse(settings->read("kludget/ignoreMouse", "0").toInt());
    window->setWindowLevel(settings->read("kludget/windowLevel", "0").toInt());
    window->setSnapToScreen(settings->read("kludget/snapToScreen", "0").toInt());
    window->view()->setGrayed(settings->read("kludget/grayScaled", "0").toInt());

#if 0

    window->view()->setTinted(settings->read("kludget/tinted", "0").toInt());
    window->view()->setTintColor(QColor(settings->read("kludget/tintColor", "#c0c0c0").toString()));
    window->view()->setTintMode(settings->read("kludget/tintMode", "14").toInt());
#endif

    // zoom
    window->setZoomFactor(settings->read("kludget/zoom", 1).toDouble());
    window->view()->page()->setViewportSize(window->view()->page()->viewportSize());
    window->autoSize(true);

    setProperty("identifier", info.id);
    setProperty("instance", info.instance);

    setupContextMenu();

    QWebSettings *webSettings = window->view()->page()->settings();
#if 0
    webSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    webSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
    webSettings->setOfflineStoragePath(info.storagePath);
    webSettings->setOfflineStorageDefaultQuota(5000000);
#endif
    webSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    webSettings->setAttribute(QWebSettings::PluginsEnabled, accessPlugins);
    webSettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap());
	webSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
	webSettings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
	webSettings->setUserStyleSheetUrl(QUrl::fromLocalFile(":resources/style/widget.css"));

    // network settings
    KNetwork *net = KNetwork::instance();
    net->loadSettings();
    net->setAccess(accessNetwork, accessLocal, QUrl::fromLocalFile(QFileInfo(info.contentSrc).absolutePath()));

    // system settings
    system->setEnableCommands(accessSystem);
//.........这里部分代码省略.........
开发者ID:Delgerdalai14,项目名称:kludgets,代码行数:101,代码来源:kludget.cpp


注:本文中的QWebSettings::setOfflineStoragePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。