~ubuntu-branches/ubuntu/oneiric/arora/oneiric

« back to all changes in this revision

Viewing changes to src/settings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Roderick B. Greening
  • Date: 2009-09-10 15:24:04 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090910152404-668k22ux3mfap6g0
Tags: 0.9.0-0ubuntu1
* New upstream release
* Update patches:
  - kubuntu_02_default_bookmarks.diff
* Remove patches:
  - kubuntu_04_startpage_spacing.diff (fixed upstream)
  - kubuntu_05_manpages.diff (fixed upstream)
  - kubuntu_07_adblock.diff (unstable/unsuitable)

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
#include <qmetaobject.h>
82
82
#include <qmessagebox.h>
83
83
#include <qsettings.h>
 
84
#include <qfiledialog.h>
84
85
 
85
86
SettingsDialog::SettingsDialog(QWidget *parent)
86
87
    : QDialog(parent)
87
 
#if QT_VERSION >= 0x040500
88
88
    , m_cacheEnabled(false)
89
 
#endif
90
89
{
91
90
    setupUi(this);
92
91
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
95
94
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
96
95
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
97
96
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));
 
97
    connect(downloadDirectoryButton, SIGNAL(clicked()), this, SLOT(chooseDownloadDirectory()));
98
98
 
99
 
#if QT_VERSION < 0x040500
100
 
    oneCloseButton->setVisible(false); // no other mode than one close button with qt <4.5
101
 
    networkCache->setVisible(false);
102
 
#else
103
99
    // As network cache has too many bugs in 4.5.1, do not allow to enable it.
104
100
    if (QLatin1String(qVersion()) == QLatin1String("4.5.1"))
105
101
        networkCache->setVisible(false);
106
 
#endif
 
102
 
107
103
    loadDefaults();
108
104
    loadFromSettings();
109
105
}
128
124
    enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
129
125
    enableImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages));
130
126
    clickToFlash->setChecked(false);
131
 
    filterTrackingCookiesCheckbox->setChecked(true);
 
127
    filterTrackingCookiesCheckbox->setChecked(false);
132
128
}
133
129
 
134
130
void SettingsDialog::loadFromSettings()
222
218
        keepUntilCombo->setCurrentIndex(2);
223
219
        break;
224
220
    }
225
 
    filterTrackingCookiesCheckbox->setChecked(settings.value(QLatin1String("filterTrackingCookies"), true).toBool());
 
221
    filterTrackingCookiesCheckbox->setChecked(settings.value(QLatin1String("filterTrackingCookies"), false).toBool());
226
222
    settings.endGroup();
227
223
 
228
 
#if QT_VERSION >= 0x040500
229
224
    // Network
230
225
    settings.beginGroup(QLatin1String("network"));
231
226
    m_cacheEnabled = settings.value(QLatin1String("cacheEnabled"), true).toBool();
232
227
    networkCache->setChecked(m_cacheEnabled);
233
228
    networkCacheMaximumSizeSpinBox->setValue(settings.value(QLatin1String("maximumCacheSize"), 50).toInt());
234
229
    settings.endGroup();
235
 
#endif
236
230
 
237
231
    // Proxy
238
232
    settings.beginGroup(QLatin1String("proxy"));
248
242
    settings.beginGroup(QLatin1String("tabs"));
249
243
    selectTabsWhenCreated->setChecked(settings.value(QLatin1String("selectNewTabs"), false).toBool());
250
244
    confirmClosingMultipleTabs->setChecked(settings.value(QLatin1String("confirmClosingMultipleTabs"), true).toBool());
251
 
#if QT_VERSION >= 0x040500
252
245
    oneCloseButton->setChecked(settings.value(QLatin1String("oneCloseButton"),false).toBool());
253
 
#endif
254
246
    quitAsLastTabClosed->setChecked(settings.value(QLatin1String("quitAsLastTabClosed"), true).toBool());
255
247
    openTargetBlankLinksIn->setCurrentIndex(settings.value(QLatin1String("openTargetBlankLinksIn"), TabWidget::NewSelectedTab).toInt());
256
248
    openLinksFromAppsIn->setCurrentIndex(settings.value(QLatin1String("openLinksFromAppsIn"), TabWidget::NewSelectedTab).toInt());
345
337
    settings.setValue(QLatin1String("filterTrackingCookies"), filterTrackingCookiesCheckbox->isChecked());
346
338
    settings.endGroup();
347
339
 
348
 
#if QT_VERSION >= 0x040500
349
340
    // Network
350
341
    settings.beginGroup(QLatin1String("network"));
351
342
    settings.setValue(QLatin1String("cacheEnabled"), networkCache->isChecked());
352
343
    settings.setValue(QLatin1String("maximumCacheSize"), networkCacheMaximumSizeSpinBox->value());
353
344
    settings.endGroup();
354
 
#endif
355
345
 
356
346
    // proxy
357
347
    settings.beginGroup(QLatin1String("proxy"));
367
357
    settings.beginGroup(QLatin1String("tabs"));
368
358
    settings.setValue(QLatin1String("selectNewTabs"), selectTabsWhenCreated->isChecked());
369
359
    settings.setValue(QLatin1String("confirmClosingMultipleTabs"), confirmClosingMultipleTabs->isChecked());
370
 
#if QT_VERSION >= 0x040500
371
360
    settings.setValue(QLatin1String("oneCloseButton"), oneCloseButton->isChecked());
372
 
#endif
373
361
    settings.setValue(QLatin1String("quitAsLastTabClosed"), quitAsLastTabClosed->isChecked());
374
362
    settings.setValue(QLatin1String("openTargetBlankLinksIn"), openTargetBlankLinksIn->currentIndex());
375
363
    settings.setValue(QLatin1String("openLinksFromAppsIn"), openLinksFromAppsIn->currentIndex());
391
379
void SettingsDialog::accept()
392
380
{
393
381
    saveToSettings();
394
 
#if QT_VERSION >= 0x040500
395
382
    // Due to a bug in Qt <= 4.5.1, enabling/disabling cache requires the browser to be restarted.
396
383
    if (QLatin1String(qVersion()) <= QLatin1String("4.5.1") && networkCache->isChecked() != m_cacheEnabled) {
397
384
        QMessageBox::information(this, tr("Restart required"),
398
385
                                 tr("The network cache configuration has changed. "
399
386
                                    "So that it can be taken into account, the browser has to be restarted."));
400
387
    }
401
 
#endif
402
388
    QDialog::accept();
403
389
}
404
390
 
414
400
    dialog.exec();
415
401
}
416
402
 
 
403
void SettingsDialog::chooseDownloadDirectory()
 
404
{
 
405
    QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose Directory"), downloadsLocation->text());
 
406
    downloadsLocation->setText(fileName);
 
407
}
 
408
 
417
409
void SettingsDialog::chooseFont()
418
410
{
419
411
    bool ok;