QString dirDownloads(bool create_dir)
{
    QSettings settings;
    settings.beginGroup(QLatin1String("downloadmanager"));
    QString location = QDir::toNativeSeparators(settings.value(QLatin1String("downloadDirectory"), "").toString());

    if (location.isEmpty())
        location = DefaultDownloadPath(create_dir);
    else
    {
        if (QDir::isRelativePath(location))
            location = QCoreApplication::applicationDirPath() + "/" + location;

        if (create_dir) {
            QDir dir(location);
            if (!dir.exists())
                dir.mkpath(location);
        }
    }

    return location;
}
void SettingsDialog::loadDefaults()
{
    QWebSettings *defaultSettings = QWebSettings::globalSettings();
    QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
    int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
    standardFont = QFont(standardFontFamily, standardFontSize);
    standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));

    QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
    int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
    fixedFont = QFont(fixedFontFamily, fixedFontSize);
    fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));

	comboMainMenu->setCurrentIndex(0);

	downloadsLocation->setText( DefaultDownloadPath( false )  );

    enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
    enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
	blockPopups->setChecked( ! (defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows)) );
	autoLoadImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages));

	enableDiskCache->setChecked(false);

	chkSavePasswords->setChecked(false);
	checkBoxDeleteDownloads->setChecked(false);

	newTabAction->setCurrentIndex(0);

	comboBoxAV->setCurrentIndex(0);

	mouseweelClick->setCurrentIndex(1);

	comboBoxStyle->addItems(QStyleFactory::keys());
	int ind = comboBoxStyle->findText(DefaultAppStyle());
	if (ind >= 0)
		comboBoxStyle->setCurrentIndex(ind);
	
	chkUserStyleSheet->setChecked(false);
	chkUserAgent->setChecked(false);
	comboAgents->setEditText("");

	chkExtViewer->setChecked(false);

	tbGoBack->setChecked( true );
	tbGoForward->setChecked( true );
	tbAddBook->setChecked( true );
	tbHome->setChecked( true );
	tbRefresh->setChecked( true );
	tbAppStyle->setChecked( true );
	tbPrivMode->setChecked( true );
	tbPrefs->setChecked( true );
	tbImages->setChecked( false );
	tbProxy->setChecked( false );
	proxyExcept->setChecked(false);
	tbCompatibility->setChecked( true );
	tbReset->setChecked( false );

#ifndef Q_WS_WIN
	proxyAuto->setVisible(false);
#endif

	tbInspect->setChecked( false );
	tbVirtKeyb->setChecked( false );
	tbBookmarks->setChecked( false );
	tbTextSize->setChecked( false );

	expireHistory->setCurrentIndex(1);

	chkBlockAds->setChecked(false);
	listAds->clear();

	chkBlockAdsEx->setChecked(false);
	listAdEx->clear();
}