[webkit-reviews] review granted: [Bug 36451] [Qt] User Agent Switcher on QtLauncher : [Attachment 51518] Proposed patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Mar 25 15:46:18 PDT 2010
Simon Hausmann <hausmann at webkit.org> has granted Diego Gonzalez
<diego.gonzalez at openbossa.org>'s request for review:
Bug 36451: [Qt] User Agent Switcher on QtLauncher
https://bugs.webkit.org/show_bug.cgi?id=36451
Attachment 51518: Proposed patch
https://bugs.webkit.org/attachment.cgi?id=51518&action=review
------- Additional Comments from Simon Hausmann <hausmann at webkit.org>
> +void LauncherWindow::showUserAgentDialog()
> +{
> + QStringList items;
> + QFile file(":/useragentlist.txt");
> + if (file.open(QIODevice::ReadOnly)) {
> + while (!file.atEnd())
> + items << file.readLine().trimmed();
> + file.close();
> + }
> +
> + QDialog* dialog = new QDialog(this);
> + dialog->setWindowTitle("Change User Agent");
> +
> + QVBoxLayout* layout = new QVBoxLayout(dialog);
> + dialog->setLayout(layout);
> +
> + QComboBox* combo = new QComboBox(dialog);
> + combo->setMaximumWidth(size().width() * 0.7);
> + combo->insertItems(0, items);
> + layout->addWidget(combo);
> +
> + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
> + | QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
> + connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
> + connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
> + layout->addWidget(buttonBox);
> +
> + if (dialog->exec() && !combo->currentText().isEmpty())
> + page()->setUserAgent(combo->currentText());
> +}
> +
Please delete the dialog object after use.
Otherwise r=me :)
More information about the webkit-reviews
mailing list