Esempio n. 1
0
void BrowserApplication::loadSettings()
{
    QSettings settings;
    settings.beginGroup(QLatin1String("websettings"));

    QWebSettings *defaultSettings = QWebSettings::globalSettings();
    QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
    int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
    QFont standardFont = QFont(standardFontFamily, standardFontSize);
    standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
    defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());

    QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
    int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
    QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
    fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
    defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());

    defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool());

    QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl();
    defaultSettings->setUserStyleSheetUrl(url);

    defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);

    settings.endGroup();
}
Esempio n. 2
0
void BrowserApplication::loadSettings()
{
    QSettings settings;
    settings.beginGroup(QLatin1String("websettings"));

    QWebSettings *defaultSettings = QWebSettings::globalSettings();
    QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
    int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
    QFont standardFont = QFont(standardFontFamily, standardFontSize);
    standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
    defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());
    int minimumFontSize = settings.value(QLatin1String("minimumFontSize"),
                defaultSettings->fontSize(QWebSettings::MinimumFontSize)).toInt();
    defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize);

    QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
    int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
    QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
    fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
    defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
    defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());

    defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, !(settings.value(QLatin1String("blockPopupWindows"), true).toBool()));
    defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(QLatin1String("enableImages"), true).toBool());
    defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(QLatin1String("enableInspector"), false).toBool());

    QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl();
    defaultSettings->setUserStyleSheetUrl(url);

    settings.endGroup();
}
Esempio n. 3
0
void MyWebView::SetHighlightStyleClass(QString strClassName, QString &strTmpStyle)
{
	QByteArray  strComposedStyle("." + strClassName.toUtf8() + " { " + strTmpStyle.toUtf8()  + " }");

	QWebSettings *settings = QWebSettings::globalSettings();
	settings->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64," + strComposedStyle.toBase64()));

}
Esempio n. 4
0
QWidget* ManPageDocumentation::documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent )
{
    KDevelop::StandardDocumentationView* view = new KDevelop::StandardDocumentationView(findWidget, parent);
    view->setDocumentation(IDocumentation::Ptr(this));

    // apply custom style-sheet to normalize look of the page
    const QString cssFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdevmanpage/manpagedocumentation.css");
    QWebSettings* settings = view->settings();
    settings->setUserStyleSheetUrl(QUrl::fromLocalFile(cssFile));

    view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    QObject::connect(view, &KDevelop::StandardDocumentationView::linkClicked, ManPageDocumentation::s_provider->model(), &ManPageModel::showItemFromUrl);
    return view;
}
Esempio n. 5
0
void EmbeddedWebView::addCustomStylesheet(const QString &css)
{
    m_customCss = css;

    QWebSettings *s = settings();
    QString bgName, fgName;
    QColor bg = palette().color(QPalette::Active, QPalette::Base),
           fg = palette().color(QPalette::Active, QPalette::Text);

    switch (m_colorScheme) {
    case ColorScheme::BlackOnWhite:
        bgName = QStringLiteral("white !important");
        fgName = QStringLiteral("black !important");
        break;
    case ColorScheme::AdjustedSystem:
    {
        // This is HTML, and the authors of that markup are free to specify only the background colors, or only the foreground colors.
        // No matter what we pass from outside, there will always be some color which will result in unreadable text, and we can do
        // nothing except adding !important everywhere to fix this.
        // This code attempts to create a color which will try to produce exactly ugly results for both dark-on-bright and
        // bright-on-dark segments of text. However, it's pure alchemy and only a limited heuristics. If you do not like this, please
        // submit patches (or talk to the HTML producers, hehehe).
        const int v = bg.value();
        if (v < 96 && fg.value() > 128 + v/2) {
            int h,s,vv,a;
            fg.getHsv(&h, &s, &vv, &a) ;
            fg.setHsv(h, s, 128+v/2, a);
        }
        bgName = bg.name();
        fgName = fg.name();
        break;
    }
    case ColorScheme::System:
        bgName = bg.name();
        fgName = fg.name();
        break;
    }


    const QString urlPrefix(QStringLiteral("data:text/css;charset=utf-8;base64,"));
    const QString myColors(QStringLiteral("body { background-color: %1; color: %2; }\n").arg(bgName, fgName));
    s->setUserStyleSheetUrl(QString::fromUtf8(urlPrefix.toUtf8() + (myColors + m_customCss).toUtf8().toBase64()));
}
static PyObject *meth_QWebSettings_setUserStyleSheetUrl(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QUrl* a0;
        QWebSettings *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QWebSettings, &sipCpp, sipType_QUrl, &a0))
        {
            sipCpp->setUserStyleSheetUrl(*a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QWebSettings, sipName_setUserStyleSheetUrl, doc_QWebSettings_setUserStyleSheetUrl);

    return NULL;
}
Esempio n. 7
0
void QgsComposerHtml::loadHtml( const bool useCache, const QgsExpressionContext *context )
{
  if ( !mWebPage )
  {
    return;
  }

  QgsExpressionContext scopedContext = createExpressionContext();
  const QgsExpressionContext* evalContext = context ? context : &scopedContext;

  QString loadedHtml;
  switch ( mContentMode )
  {
    case QgsComposerHtml::Url:
    {

      QString currentUrl = mUrl.toString();

      //data defined url set?
      QVariant exprVal;
      if ( dataDefinedEvaluate( QgsComposerObject::SourceUrl, exprVal, *evalContext ) )
      {
        currentUrl = exprVal.toString().trimmed();
        QgsDebugMsg( QString( "exprVal Source Url:%1" ).arg( currentUrl ) );
      }
      if ( currentUrl.isEmpty() )
      {
        return;
      }
      if ( !( useCache && currentUrl == mLastFetchedUrl ) )
      {
        loadedHtml = fetchHtml( QUrl( currentUrl ) );
        mLastFetchedUrl = currentUrl;
      }
      else
      {
        loadedHtml = mFetchedHtml;
      }

      break;
    }
    case QgsComposerHtml::ManualHtml:
      loadedHtml = mHtml;
      break;
  }

  //evaluate expressions
  if ( mEvaluateExpressions )
  {
    loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, evalContext, mDistanceArea );
  }

  mLoaded = false;

  //reset page size. otherwise viewport size increases but never decreases again
  mWebPage->setViewportSize( QSize( maxFrameWidth() * mHtmlUnitsToMM, 0 ) );

  //set html, using the specified url as base if in Url mode or the project file if in manual mode
  const QUrl baseUrl = mContentMode == QgsComposerHtml::Url ?
                       QUrl( mActualFetchedUrl ) :
                       QUrl::fromLocalFile( QgsProject::instance()->fileInfo().absoluteFilePath() );
  mWebPage->mainFrame()->setHtml( loadedHtml, baseUrl );

  //set user stylesheet
  QWebSettings* settings = mWebPage->settings();
  if ( mEnableUserStylesheet && ! mUserStylesheet.isEmpty() )
  {
    QByteArray ba;
    ba.append( mUserStylesheet.toUtf8() );
    QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() );
    settings->setUserStyleSheetUrl( cssFileURL );
  }
  else
  {
    settings->setUserStyleSheetUrl( QUrl() );
  }

  while ( !mLoaded )
  {
    qApp->processEvents();
  }

  //inject JSON feature
  if ( !mAtlasFeatureJSON.isEmpty() )
  {
    mWebPage->mainFrame()->evaluateJavaScript( QString( "if ( typeof setFeature === \"function\" ) { setFeature(%1); }" ).arg( mAtlasFeatureJSON ) );
    //needs an extra process events here to give javascript a chance to execute
    qApp->processEvents();
  }

  recalculateFrameSizes();
  //trigger a repaint
  emit contentsChanged();
}
Esempio n. 8
0
void QgsLayoutItemHtml::loadHtml( const bool useCache, const QgsExpressionContext *context )
{
  if ( !mWebPage )
  {
    return;
  }

  QgsExpressionContext scopedContext = createExpressionContext();
  const QgsExpressionContext *evalContext = context ? context : &scopedContext;

  QString loadedHtml;
  switch ( mContentMode )
  {
    case QgsLayoutItemHtml::Url:
    {

      QString currentUrl = mUrl.toString();

      //data defined url set?
      bool ok = false;
      currentUrl = mDataDefinedProperties.valueAsString( QgsLayoutObject::SourceUrl, *evalContext, currentUrl, &ok );
      if ( ok )
      {
        currentUrl = currentUrl.trimmed();
        QgsDebugMsg( QString( "exprVal Source Url:%1" ).arg( currentUrl ) );
      }
      if ( currentUrl.isEmpty() )
      {
        return;
      }
      if ( !( useCache && currentUrl == mLastFetchedUrl ) )
      {
        loadedHtml = fetchHtml( QUrl( currentUrl ) );
        mLastFetchedUrl = currentUrl;
      }
      else
      {
        loadedHtml = mFetchedHtml;
      }

      break;
    }
    case QgsLayoutItemHtml::ManualHtml:
      loadedHtml = mHtml;
      break;
  }

  //evaluate expressions
  if ( mEvaluateExpressions )
  {
    loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, evalContext, &mDistanceArea );
  }

  bool loaded = false;

  QEventLoop loop;
  connect( mWebPage.get(), &QWebPage::loadFinished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } );
  connect( mFetcher, &QgsNetworkContentFetcher::finished, &loop, [&loaded, &loop ] { loaded = true; loop.quit(); } );

  //reset page size. otherwise viewport size increases but never decreases again
  mWebPage->setViewportSize( QSize( maxFrameWidth() * mHtmlUnitsToLayoutUnits, 0 ) );

  //set html, using the specified url as base if in Url mode or the project file if in manual mode
  const QUrl baseUrl = mContentMode == QgsLayoutItemHtml::Url ?
                       QUrl( mActualFetchedUrl ) :
                       QUrl::fromLocalFile( mLayout->project()->fileInfo().absoluteFilePath() );

  mWebPage->mainFrame()->setHtml( loadedHtml, baseUrl );

  //set user stylesheet
  QWebSettings *settings = mWebPage->settings();
  if ( mEnableUserStylesheet && ! mUserStylesheet.isEmpty() )
  {
    QByteArray ba;
    ba.append( mUserStylesheet.toUtf8() );
    QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() );
    settings->setUserStyleSheetUrl( cssFileURL );
  }
  else
  {
    settings->setUserStyleSheetUrl( QUrl() );
  }

  if ( !loaded )
    loop.exec( QEventLoop::ExcludeUserInputEvents );

  //inject JSON feature
  if ( !mAtlasFeatureJSON.isEmpty() )
  {
    mWebPage->mainFrame()->evaluateJavaScript( QStringLiteral( "if ( typeof setFeature === \"function\" ) { setFeature(%1); }" ).arg( mAtlasFeatureJSON ) );
    //needs an extra process events here to give JavaScript a chance to execute
    qApp->processEvents();
  }

  recalculateFrameSizes();
  //trigger a repaint
  emit contentsChanged();
}
Esempio n. 9
0
void QgsComposerHtml::loadHtml( const bool useCache, const QgsExpressionContext *context )
{
  if ( !mWebPage )
  {
    return;
  }

  const QgsExpressionContext* evalContext = context;
  QScopedPointer< QgsExpressionContext > scopedContext;
  if ( !evalContext )
  {
    scopedContext.reset( createExpressionContext() );
    evalContext = scopedContext.data();
  }

  QString loadedHtml;
  switch ( mContentMode )
  {
    case QgsComposerHtml::Url:
    {

      QString currentUrl = mUrl.toString();

      //data defined url set?
      QVariant exprVal;
      if ( dataDefinedEvaluate( QgsComposerObject::SourceUrl, exprVal, *evalContext ) )
      {
        currentUrl = exprVal.toString().trimmed();
        QgsDebugMsg( QString( "exprVal Source Url:%1" ).arg( currentUrl ) );
      }
      if ( currentUrl.isEmpty() )
      {
        return;
      }
      if ( !( useCache && currentUrl == mLastFetchedUrl ) )
      {
        loadedHtml = fetchHtml( QUrl( currentUrl ) );
        mLastFetchedUrl = currentUrl;
      }
      else
      {
        loadedHtml = mFetchedHtml;
      }

      break;
    }
    case QgsComposerHtml::ManualHtml:
      loadedHtml = mHtml;
      break;
  }

  //evaluate expressions
  if ( mEvaluateExpressions )
  {
    loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, evalContext, nullptr, mDistanceArea );
  }

  mLoaded = false;

  //reset page size. otherwise viewport size increases but never decreases again
  mWebPage->setViewportSize( QSize( maxFrameWidth() * mHtmlUnitsToMM, 0 ) );

  //set html, using the specified url as base if in Url mode
  mWebPage->mainFrame()->setHtml( loadedHtml, mContentMode == QgsComposerHtml::Url ? QUrl( mActualFetchedUrl ) : QUrl() );

  //set user stylesheet
  QWebSettings* settings = mWebPage->settings();
  if ( mEnableUserStylesheet && ! mUserStylesheet.isEmpty() )
  {
    QByteArray ba;
    ba.append( mUserStylesheet.toUtf8() );
    QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() );
    settings->setUserStyleSheetUrl( cssFileURL );
  }
  else
  {
    settings->setUserStyleSheetUrl( QUrl() );
  }

  while ( !mLoaded )
  {
    qApp->processEvents();
  }

  recalculateFrameSizes();
  //trigger a repaint
  emit contentsChanged();
}
Esempio n. 10
0
void QgsComposerHtml::loadHtml()
{
  if ( !mWebPage )
  {
    return;
  }

  QString loadedHtml;
  switch ( mContentMode )
  {
    case QgsComposerHtml::Url:
    {

      QString currentUrl = mUrl.toString();

      //data defined url set?
      QVariant exprVal;
      if ( dataDefinedEvaluate( QgsComposerObject::SourceUrl, exprVal ) )
      {
        currentUrl = exprVal.toString().trimmed();;
        QgsDebugMsg( QString( "exprVal Source Url:%1" ).arg( currentUrl ) );
      }
      if ( currentUrl.isEmpty() )
      {
        return;
      }
      if ( currentUrl != mLastFetchedUrl )
      {
        loadedHtml = fetchHtml( QUrl( currentUrl ) );
        mLastFetchedUrl = currentUrl;
      }
      else
      {
        loadedHtml = mFetchedHtml;
      }

      break;
    }
    case QgsComposerHtml::ManualHtml:
      loadedHtml = mHtml;
      break;
  }

  //evaluate expressions
  if ( mEvaluateExpressions )
  {
    loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, mExpressionFeature, mExpressionLayer );
  }

  mLoaded = false;
  //set html, using the specified url as base if in Url mode
  mWebPage->mainFrame()->setHtml( loadedHtml, mContentMode == QgsComposerHtml::Url ? QUrl( mActualFetchedUrl ) : QUrl() );

  //set user stylesheet
  QWebSettings* settings = mWebPage->settings();
  if ( mEnableUserStylesheet && ! mUserStylesheet.isEmpty() )
  {
    QByteArray ba;
    ba.append( mUserStylesheet.toUtf8() );
    QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() );
    settings->setUserStyleSheetUrl( cssFileURL );
  }
  else
  {
    settings->setUserStyleSheetUrl( QUrl() );
  }

  while ( !mLoaded )
  {
    qApp->processEvents();
  }

  if ( frameCount() < 1 )  return;

  QSize contentsSize = mWebPage->mainFrame()->contentsSize();

  //find maximum frame width
  double maxFrameWidth = 0;
  QList<QgsComposerFrame*>::const_iterator frameIt = mFrameItems.constBegin();
  for ( ; frameIt != mFrameItems.constEnd(); ++frameIt )
  {
    maxFrameWidth = qMax( maxFrameWidth, ( *frameIt )->boundingRect().width() );
  }
  //set content width to match maximum frame width
  contentsSize.setWidth( maxFrameWidth * mHtmlUnitsToMM );

  mWebPage->setViewportSize( contentsSize );
  mWebPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
  mWebPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
  mSize.setWidth( contentsSize.width() / mHtmlUnitsToMM );
  mSize.setHeight( contentsSize.height() / mHtmlUnitsToMM );

  renderCachedImage();

  recalculateFrameSizes();
  emit changed();
  //trigger a repaint
  emit contentsChanged();
}
Esempio n. 11
0
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);
    if (engine.getValue("kludget/general/runInShell", "0").toInt())
        system->setShellPath(engine.getValue("kludget/general/shellPath", ""));

    // plugin
	KLog::log("plugin");
    if (!plugin.isLoaded() && accessPlugins && info.pluginPath != "")
    {
        plugin.setFileName(info.pluginPath + "/" + info.pluginExecutable);
		KLog::log(QString("loading %1").arg(plugin.fileName()));

		if (plugin.load())
        {	
            typedef void (*initWithWebView)(QWebView*);
            initWithWebView init = (initWithWebView)plugin.resolve("initWithWebView");
            if (init)
            {
                init((QWebView*)window->view());
				KLog::log(QString("plugin loaded %1").arg(plugin.fileName()));
            }
		} else {
			KLog::log(QString("unable to load %1").arg(plugin.fileName()));
		}
    }

    // drop
    window->view()->setAcceptDrops(true);

    if (loadPage)
    {
        window->hide();
        QUrl url = QUrl::fromLocalFile(info.contentSrc);
        if (!QFile::exists(info.contentSrc))
        {
            url = QUrl(info.contentSrc);
            if (url.scheme().toLower() == "http")
            {
                window->view()->load(url);
            }
            else if (info.contentHtml == "")
            {
                KLog::log("Kludget::load fail");
                KLog::log(QString("content source not found. ") + info.contentSrc);
                return false;
            }
        }

        if (info.contentHtml != "")
            window->view()->setHtml(info.contentHtml);
        else
            window->view()->load(url);

        KLog::log(QString("Kludget::load ") + info.id);

#if 0
        QString defaultBg = info.path + "/Default.png";
        if (QFile::exists(defaultBg))
            //window->view()->setTransitionLayer(QImage(defaultBg));
#endif
        }

    ipcClient.connectToServer();
    return true;
}