Merge branch 'master' of bitbucket.org:skunkos/rssguard

This commit is contained in:
Martin Rotter 2016-01-15 19:31:44 +01:00
commit 6bfbece28d
63 changed files with 271 additions and 291 deletions

View File

@ -288,10 +288,10 @@ Tato stránka obsahuje %n kanálů.</numerusform></translation>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Nepodporováno</translation>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -584,15 +584,15 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Nepodporováno</translation>
</message>
<message>
<source>Selected account does not support adding of new feeds.</source>
<translation type="unfinished"/>
<translation>Vybraný účet nepodporuje přidávání nových kanálů.</translation>
</message>
<message>
<source>Selected account does not support adding of new categories.</source>
<translation type="unfinished"/>
<translation>Vybraný účet nepodporuje přidávání nových kategorií.</translation>
</message>
</context>
<context>
@ -849,11 +849,11 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>neznámá</translation>
</message>
<message>
<source>file: %1, data: %2</source>
<translation type="unfinished"/>
<translation>soubor: %1, data: %2</translation>
</message>
</context>
<context>
@ -1123,15 +1123,15 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>URL je v pořádku.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>URL nemá standardní tvar. Začíná vaše URL na &quot;http://&quot; či &quot;https://&quot;?</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>URL je prázdná.</translation>
</message>
</context>
<context>
@ -1526,19 +1526,19 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Add new feed into selected account</source>
<translation type="unfinished"/>
<translation>Přidat nový kanál do vybraného účtu</translation>
</message>
<message>
<source>Add new category into selected account</source>
<translation type="unfinished"/>
<translation>Přidat novou kategorii do vybraného účtu</translation>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Přidat novou kategorii</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Přidat nový kanál</translation>
</message>
</context>
<context>
@ -2687,15 +2687,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>URL je v pořádku.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>URL nemá standardní tvar. Začíná vaše URL na &quot;http://&quot; či &quot;https://&quot;?</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>URL je prázdná.</translation>
</message>
</context>
<context>
@ -2790,15 +2790,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message>
<message>
<source>Parsing data...</source>
<translation type="unfinished"/>
<translation>Zpracovávám data...</translation>
</message>
<message>
<source>TXT files (one URL per line) (*.txt)</source>
<translation type="unfinished"/>
<translation>TXT soubory (jedna URL na řádek) (*.txt)</translation>
</message>
<message>
<source>Cannot write into destination file: &apos;%1&apos;.</source>
<translation type="unfinished"/>
<translation>Do cílového souboru nelze zapisovat: &apos;%1&apos;.</translation>
</message>
</context>
<context>
@ -3434,7 +3434,7 @@ ID účtu: %1</translation>
</message>
<message>
<source>This new account does not include any feeds. You can now add default set of feeds.</source>
<translation type="unfinished"/>
<translation>Tento nový účet doposud neobsahuje žádné kanály, chcete nyní přidat výchozí sadu kanálů?</translation>
</message>
</context>
<context>

View File

@ -286,7 +286,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"/>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -843,7 +843,7 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>ukendt</translation>
</message>
<message>
<source>file: %1, data: %2</source>
@ -1528,11 +1528,11 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Tilføj ny kategori</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Tilføj nyt feed</translation>
</message>
</context>
<context>

View File

@ -286,7 +286,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"/>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -843,7 +843,7 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>unbekannt</translation>
</message>
<message>
<source>file: %1, data: %2</source>
@ -1528,7 +1528,7 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Füge neue Kategorie hinzu</translation>
</message>
<message>
<source>Add new feed</source>

View File

@ -291,7 +291,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -286,7 +286,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"/>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>

View File

@ -286,7 +286,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"/>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -843,7 +843,7 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>inconnu</translation>
</message>
<message>
<source>file: %1, data: %2</source>
@ -1528,11 +1528,11 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Ajouter une nouvelle catégorie</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Ajouter un nouveau flux</translation>
</message>
</context>
<context>

View File

@ -286,7 +286,7 @@ This website contains %n feed(s).</source>
<translation type="unfinished"/>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -843,7 +843,7 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>sconosciuto</translation>
</message>
<message>
<source>file: %1, data: %2</source>
@ -1528,11 +1528,11 @@ or this functionality is not implemented yet.</source>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Aggiungi nuova categoria</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Aggiungi nuovo feed</translation>
</message>
</context>
<context>

View File

@ -288,10 +288,10 @@ Deze website bevat %n feeds.</numerusform></translation>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Niet ondersteund</translation>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -585,15 +585,15 @@ of deze functie bestaat nog niet.</translation>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Niet ondersteund</translation>
</message>
<message>
<source>Selected account does not support adding of new feeds.</source>
<translation type="unfinished"/>
<translation>Geselecteerde account ondersteunt geen toevoeging van nieuwe feeds.</translation>
</message>
<message>
<source>Selected account does not support adding of new categories.</source>
<translation type="unfinished"/>
<translation>Geselecteerde account ondersteunt geen toevoeging van nieuwe categorieën.</translation>
</message>
</context>
<context>
@ -850,11 +850,11 @@ of deze functie bestaat nog niet.</translation>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>onbekend</translation>
</message>
<message>
<source>file: %1, data: %2</source>
<translation type="unfinished"/>
<translation>bestand: %1, gegevens: %2</translation>
</message>
</context>
<context>
@ -1124,15 +1124,15 @@ of deze functie bestaat nog niet.</translation>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>De url is ok.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>De URL voldoet niet aan het standaard patroon. Start je url met &quot;http://&quot; of &quot;https://&quot; prefix.</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>De url is leeg.</translation>
</message>
</context>
<context>
@ -1527,19 +1527,19 @@ of deze functie bestaat nog niet.</translation>
</message>
<message>
<source>Add new feed into selected account</source>
<translation type="unfinished"/>
<translation>Voeg nieuwe feed toe aan geselecteerde account</translation>
</message>
<message>
<source>Add new category into selected account</source>
<translation type="unfinished"/>
<translation>Voeg nieuwe categorie toe aan geselecteerde account</translation>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Voeg nieuwe categorie toe</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Voeg nieuw feed toe</translation>
</message>
</context>
<context>
@ -2694,15 +2694,15 @@ Open nieuw webbrowser pagina(sleep muis omlaag).</translation>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>De URL is ok.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>De URL voldoet niet aan het standaard patroon. Start je url met &quot;http://&quot; of &quot;https://&quot; prefix.</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>De URL is leeg.</translation>
</message>
</context>
<context>
@ -2797,15 +2797,15 @@ Open nieuw webbrowser pagina(sleep muis omlaag).</translation>
</message>
<message>
<source>Parsing data...</source>
<translation type="unfinished"/>
<translation>Gegevens ontleden...</translation>
</message>
<message>
<source>TXT files (one URL per line) (*.txt)</source>
<translation type="unfinished"/>
<translation>TXT bestanden (een url per lijn) (*.txt)</translation>
</message>
<message>
<source>Cannot write into destination file: &apos;%1&apos;.</source>
<translation type="unfinished"/>
<translation>Kan niet schrijven naar doelbestand: &apos;%1&apos;.</translation>
</message>
</context>
<context>
@ -3442,7 +3442,7 @@ Account ID: %1</translation>
</message>
<message>
<source>This new account does not include any feeds. You can now add default set of feeds.</source>
<translation type="unfinished"/>
<translation>Dit nieuwe account bevat geen feeds. U kunt de standaard set van feeds toevoegen.</translation>
</message>
</context>
<context>

View File

@ -287,10 +287,10 @@ Denna webbsida innehåller %1 flöden.</numerusform></translation>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Stöds ej</translation>
</message>
<message>
<source>Give account does not support adding feeds.</source>
<source>Given account does not support adding feeds.</source>
<translation type="unfinished"/>
</message>
</context>
@ -584,15 +584,15 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>Not supported</source>
<translation type="unfinished"/>
<translation>Stöds ej</translation>
</message>
<message>
<source>Selected account does not support adding of new feeds.</source>
<translation type="unfinished"/>
<translation>Det valda kontot stöder inte tillägg av nya flöden.</translation>
</message>
<message>
<source>Selected account does not support adding of new categories.</source>
<translation type="unfinished"/>
<translation>Det valda kontot stöder inte tillägg av nya kategorier.</translation>
</message>
</context>
<context>
@ -849,11 +849,11 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>unknown</source>
<translation type="unfinished"/>
<translation>Okänd</translation>
</message>
<message>
<source>file: %1, data: %2</source>
<translation type="unfinished"/>
<translation>fil: %1, data: %2</translation>
</message>
</context>
<context>
@ -1123,15 +1123,15 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>URL:en är OK.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>URL:en stämmer inte med standardmönstret. Börjar din URL med prefixet &quot;http://&quot; eller &quot;https://&quot;?</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>URL saknas.</translation>
</message>
</context>
<context>
@ -1526,19 +1526,19 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>Add new feed into selected account</source>
<translation type="unfinished"/>
<translation>Lägg till nytt flöde i markerat konto</translation>
</message>
<message>
<source>Add new category into selected account</source>
<translation type="unfinished"/>
<translation>Lägg till ny kategori i markerat konto</translation>
</message>
<message>
<source>Add new category</source>
<translation type="unfinished"/>
<translation>Lägg till ny kategori</translation>
</message>
<message>
<source>Add new feed</source>
<translation type="unfinished"/>
<translation>Lägg till nytt flöde</translation>
</message>
</context>
<context>
@ -2688,15 +2688,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message>
<message>
<source>The URL is ok.</source>
<translation type="unfinished"/>
<translation>URL:en är OK.</translation>
</message>
<message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source>
<translation type="unfinished"/>
<translation>URL:en stämmer inte med standardmönstret. Börjar din URL med prefixet &quot;http://&quot; eller &quot;https://&quot;?</translation>
</message>
<message>
<source>The URL is empty.</source>
<translation type="unfinished"/>
<translation>URL saknas.</translation>
</message>
</context>
<context>
@ -2791,15 +2791,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message>
<message>
<source>Parsing data...</source>
<translation type="unfinished"/>
<translation>Analyserar data...</translation>
</message>
<message>
<source>TXT files (one URL per line) (*.txt)</source>
<translation type="unfinished"/>
<translation>TXT-filer (en URL per rad) (*.txt)</translation>
</message>
<message>
<source>Cannot write into destination file: &apos;%1&apos;.</source>
<translation type="unfinished"/>
<translation>Kan inte skriva till målfilen: %1</translation>
</message>
</context>
<context>
@ -3433,7 +3433,7 @@ Konto-ID: %1</translation>
</message>
<message>
<source>This new account does not include any feeds. You can now add default set of feeds.</source>
<translation type="unfinished"/>
<translation>Detta nya konto inkluderar inte några flöden. Du kan nu läsa in standarduppsättningen av flöden.</translation>
</message>
</context>
<context>

View File

@ -68,7 +68,7 @@ void DiscoverFeedsButton::linkTriggered(QAction *action) {
}
else {
qApp->showGuiMessage(tr("Not supported"),
tr("Give account does not support adding feeds."),
tr("Given account does not support adding feeds."),
QSystemTrayIcon::Warning,
qApp->mainForm(), true);
}

View File

@ -46,6 +46,7 @@ ToolBarEditor::ToolBarEditor(QWidget *parent)
}
ToolBarEditor::~ToolBarEditor() {
qDebug("Destroying ToolBarEditor instance.");
}
void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {

View File

@ -125,5 +125,5 @@ void AdBlockAddSubscriptionDialog::checkInputs() {
}
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog() {
delete m_ui;
qDebug("Destroying AdBlockAddSubscriptionDialog instance.");
}

View File

@ -63,7 +63,7 @@ class AdBlockAddSubscriptionDialog : public QDialog {
}
};
Ui::AdBlockAddSubscriptionDialog *m_ui;
QScopedPointer<Ui::AdBlockAddSubscriptionDialog> m_ui;
QVector<Subscription> m_knownSubscriptions;
};

View File

@ -59,7 +59,6 @@ AdBlockDialog::AdBlockDialog(QWidget* parent) : QDialog(parent), m_ui(new Ui::Ad
AdBlockDialog::~AdBlockDialog() {
qDebug("Destroying AdBlockDialog instance.");
delete m_ui;
}
void AdBlockDialog::setupMenu() {
@ -113,24 +112,22 @@ void AdBlockDialog::removeRule() {
}
void AdBlockDialog::addSubscription() {
QPointer<AdBlockAddSubscriptionDialog> dialog = new AdBlockAddSubscriptionDialog(this);
QScopedPointer<AdBlockAddSubscriptionDialog> dialog(new AdBlockAddSubscriptionDialog(this));
if (dialog.data()->exec() == QDialog::Accepted) {
QString title = dialog.data()->title();
QString url = dialog.data()->url();
const QString title = dialog.data()->title();
const QString url = dialog.data()->url();
if (AdBlockSubscription *subscription = m_manager->addSubscription(title, url)) {
AdBlockTreeWidget *tree = new AdBlockTreeWidget(subscription, this);
connect(tree, SIGNAL(refreshStatusChanged(bool)), this, SLOT(setDisabled(bool)));
int index = m_ui->m_tabs->insertTab(m_ui->m_tabs->count() - 1, tree, subscription->title());
const int index = m_ui->m_tabs->insertTab(m_ui->m_tabs->count() - 1, tree, subscription->title());
m_ui->m_tabs->setCurrentIndex(index);
}
}
delete dialog.data();
//delete dialog.data();
}
void AdBlockDialog::removeSubscription() {
@ -144,7 +141,7 @@ void AdBlockDialog::currentChanged(int index) {
m_currentTreeWidget = qobject_cast<AdBlockTreeWidget*>(m_ui->m_tabs->widget(index));
m_currentSubscription = m_currentTreeWidget->subscription();
bool is_easylist = m_currentSubscription->url() == QUrl(ADBLOCK_EASYLIST_URL);
const bool is_easylist = m_currentSubscription->url() == QUrl(ADBLOCK_EASYLIST_URL);
m_ui->m_checkUseLimitedEasyList->setEnabled(is_easylist && m_ui->m_checkEnable->isChecked());
m_ui->m_checkUseLimitedEasyList->setVisible(is_easylist);
@ -169,12 +166,12 @@ void AdBlockDialog::enableAdBlock(bool state) {
}
void AdBlockDialog::aboutToShowMenu() {
bool subscriptionEditable = m_currentSubscription && m_currentSubscription->canEditRules();
bool subscriptionRemovable = m_currentSubscription && m_currentSubscription->canBeRemoved();
const bool subscription_editable = m_currentSubscription && m_currentSubscription->canEditRules();
const bool subscription_removable = m_currentSubscription && m_currentSubscription->canBeRemoved();
m_actionAddRule->setEnabled(subscriptionEditable);
m_actionRemoveRule->setEnabled(subscriptionEditable);
m_actionRemoveSubscription->setEnabled(subscriptionRemovable);
m_actionAddRule->setEnabled(subscription_editable);
m_actionRemoveRule->setEnabled(subscription_editable);
m_actionRemoveSubscription->setEnabled(subscription_removable);
}
void AdBlockDialog::learnAboutRules() {
@ -197,13 +194,11 @@ void AdBlockDialog::load() {
AdBlockTreeWidget *tree = new AdBlockTreeWidget(subscription, this);
connect(tree, SIGNAL(refreshStatusChanged(bool)), this, SLOT(setDisabled(bool)));
m_ui->m_tabs->addTab(tree, subscription->title());
}
m_useLimitedEasyList = m_manager->useLimitedEasyList();
m_ui->m_checkUseLimitedEasyList->setChecked(m_useLimitedEasyList);
m_loaded = true;
QTimer::singleShot(100, this, SLOT(loadSubscriptions()));

View File

@ -67,15 +67,15 @@ class AdBlockDialog : public QDialog {
void setupMenu();
void createConnections();
Ui::AdBlockDialog *m_ui;
AdBlockManager* m_manager;
AdBlockTreeWidget* m_currentTreeWidget;
AdBlockSubscription* m_currentSubscription;
QScopedPointer<Ui::AdBlockDialog> m_ui;
AdBlockManager *m_manager;
AdBlockTreeWidget *m_currentTreeWidget;
AdBlockSubscription *m_currentSubscription;
QAction* m_actionAddRule;
QAction* m_actionRemoveRule;
QAction* m_actionAddSubscription;
QAction* m_actionRemoveSubscription;
QAction *m_actionAddRule;
QAction *m_actionRemoveRule;
QAction *m_actionAddSubscription;
QAction *m_actionRemoveSubscription;
bool m_loaded;
bool m_useLimitedEasyList;

View File

@ -70,7 +70,7 @@ void AdBlockIcon::createMenu(QMenu *menu) {
AdBlockManager *manager = AdBlockManager::instance();
AdBlockCustomList *custom_list = manager->customList();
WebPage* page = qApp->mainForm()->tabWidget()->currentWidget()->webBrowser()->view()->page();
WebPage *page = qApp->mainForm()->tabWidget()->currentWidget()->webBrowser()->view()->page();
const QUrl page_url = page->mainFrame()->url();
menu->addAction(tr("Show Adblock &settings"), manager, SLOT(showDialog()));
@ -104,18 +104,18 @@ void AdBlockIcon::createMenu(QMenu *menu) {
for (int i = 0; i < m_blockedPopups.count(); i++) {
const QPair<AdBlockRule*,QUrl> &pair = m_blockedPopups.at(i);
QString address = pair.second.toString().right(55);
QString actionText = tr("%1 with (%2)").arg(address,
pair.first->filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
const QString address = pair.second.toString().right(55);
QString action_text = tr("%1 with (%2)").arg(address,
pair.first->filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
QAction *action = menu->addAction(actionText, manager, SLOT(showRule()));
QAction *action = menu->addAction(action_text, manager, SLOT(showRule()));
action->setData(QVariant::fromValue((void*)pair.first));
}
}
menu->addSeparator();
QVector<WebPage::AdBlockedEntry> entries = page->adBlockedEntries();
const QVector<WebPage::AdBlockedEntry> entries = page->adBlockedEntries();
if (entries.isEmpty()) {
menu->addAction(tr("No content blocked"))->setEnabled(false);
@ -141,7 +141,7 @@ void AdBlockIcon::showMenu(const QPoint &pos) {
}
void AdBlockIcon::toggleCustomFilter() {
QAction *action = qobject_cast<QAction*>(sender());
const QAction *action = qobject_cast<QAction*>(sender());
if (action == NULL) {
return;

View File

@ -123,8 +123,8 @@ AdBlockSubscription *AdBlockManager::addSubscription(const QString &title, const
return NULL;
}
QString file_name = IOFactory::filterBadCharsFromFilename(title.toLower()) + QL1S(".txt");
QString file_path = IOFactory::ensureUniqueFilename(baseSubscriptionDirectory() + QDir::separator() + file_name);
const QString file_name = IOFactory::filterBadCharsFromFilename(title.toLower()) + QL1S(".txt");
const QString file_path = IOFactory::ensureUniqueFilename(baseSubscriptionDirectory() + QDir::separator() + file_name);
QFile file(file_path);
if (!file.open(QFile::WriteOnly | QFile::Truncate | QFile::Unbuffered)) {
@ -187,7 +187,7 @@ QString AdBlockManager::baseSubscriptionDirectory() {
return QDir::toNativeSeparators(directory);
}
bool AdBlockManager::shouldBeEnabled() {
bool AdBlockManager::shouldBeEnabled() const {
return qApp->settings()->value(GROUP(AdBlock), SETTING(AdBlock::Enabled)).toBool();
}
@ -198,7 +198,7 @@ void AdBlockManager::load() {
return;
}
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
m_enabled = settings->value(GROUP(AdBlock), SETTING(AdBlock::Enabled)).toBool();
m_useLimitedEasyList = settings->value(GROUP(AdBlock), SETTING(AdBlock::UseLimitedEasyList)).toBool();
m_disabledRules = settings->value(GROUP(AdBlock), SETTING(AdBlock::DisabledRules)).toStringList();
@ -228,8 +228,8 @@ void AdBlockManager::load() {
QTextStream stream(&file);
stream.setCodec("UTF-8");
QString title = stream.readLine(1024).remove(QSL("Title: "));
QUrl url = QUrl(stream.readLine(1024).remove(QSL("Url: ")));
const QString title = stream.readLine(1024).remove(QSL("Title: "));
const QUrl url = QUrl(stream.readLine(1024).remove(QSL("Url: ")));
// Close the file.
file.close();

View File

@ -69,7 +69,7 @@ class AdBlockManager : public QObject {
AdBlockCustomList *customList() const;
bool shouldBeEnabled();
bool shouldBeEnabled() const;
static QString baseSubscriptionDirectory();
static AdBlockManager *instance();

View File

@ -127,7 +127,7 @@ void AdBlockMatcher::update() {
QHash<QString, const AdBlockRule*> css_rules_hash;
QVector<const AdBlockRule*> exception_css_rules;
foreach (AdBlockSubscription *subscription, m_manager->subscriptions()) {
foreach (const AdBlockSubscription *subscription, m_manager->subscriptions()) {
foreach (const AdBlockRule *rule, subscription->allRules()) {
// Don't add internally disabled rules to cache
if (rule->isInternalDisabled()) {

View File

@ -53,7 +53,7 @@ class AdBlockMatcher : public QObject {
void enabledChanged(bool enabled);
private:
AdBlockManager* m_manager;
AdBlockManager *m_manager;
QVector<AdBlockRule*> m_createdRules;
QVector<const AdBlockRule*> m_networkExceptionRules;

View File

@ -72,6 +72,7 @@ AdBlockRule::~AdBlockRule() {
AdBlockRule *AdBlockRule::copy() const {
AdBlockRule* rule = new AdBlockRule();
rule->m_subscription = m_subscription;
rule->m_type = m_type;
rule->m_options = m_options;

View File

@ -38,7 +38,7 @@ bool AdBlockSearchTree::add(const AdBlockRule *rule) {
}
const QString filter = rule->m_matchString;
int len = filter.size();
const int len = filter.size();
if (len <= 0) {
qWarning("Inserting rule with filter len <= 0!");
@ -67,7 +67,7 @@ bool AdBlockSearchTree::add(const AdBlockRule *rule) {
const AdBlockRule *AdBlockSearchTree::find(const QNetworkRequest &request, const QString &domain,
const QString &url_string) const {
int len = url_string.size();
const int len = url_string.size();
if (len <= 0) {
return NULL;

View File

@ -36,8 +36,8 @@ BaseNetworkAccessManager::~BaseNetworkAccessManager() {
void BaseNetworkAccessManager::loadSettings() {
QNetworkProxy new_proxy;
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(GROUP(Proxy),
SETTING(Proxy::Type)).toInt());
const QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(GROUP(Proxy),
SETTING(Proxy::Type)).toInt());
if (selected_proxy_type == QNetworkProxy::NoProxy) {
// No extra setting is needed, set new proxy and exit this method.
@ -47,8 +47,7 @@ void BaseNetworkAccessManager::loadSettings() {
setProxy(QNetworkProxy::applicationProxy());
}
else {
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
// Custom proxy is selected, set it up.
new_proxy.setType(selected_proxy_type);

View File

@ -35,7 +35,6 @@ Downloader::Downloader(QObject *parent)
}
Downloader::~Downloader() {
m_downloadManager->deleteLater();
}
void Downloader::downloadFile(const QString &url, int timeout, bool protected_contents, const QString &username,
@ -101,7 +100,7 @@ void Downloader::finished() {
m_timer->stop();
// In this phase, some part of downloading process is completed.
QUrl redirection_url = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
const QUrl redirection_url = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
if (redirection_url.isValid()) {
// Communication indicates that HTTP redirection is needed.

View File

@ -76,7 +76,7 @@ class Downloader : public QObject {
private:
QNetworkReply *m_activeReply;
SilentNetworkAccessManager *m_downloadManager;
QScopedPointer<SilentNetworkAccessManager> m_downloadManager;
QTimer *m_timer;
QHash<QByteArray, QByteArray> m_customHeaders;
QByteArray m_inputData;

View File

@ -97,11 +97,11 @@ void DownloadItem::getFileName() {
return;
}
QString download_directory = qApp->downloadManager()->downloadDirectory();
const QString download_directory = qApp->downloadManager()->downloadDirectory();
QString chosen_filename = saveFileName(download_directory);
QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
QDir::separator() +
QFileInfo(chosen_filename).fileName();
const QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
QDir::separator() +
QFileInfo(chosen_filename).fileName();
if (m_requestFileName) {
// User must provide the path where he wants to save downloaded file in.
@ -118,7 +118,7 @@ void DownloadItem::getFileName() {
return;
}
QFileInfo file_info = QFileInfo(chosen_filename);
const QFileInfo file_info = QFileInfo(chosen_filename);
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(chosen_filename).absolutePath()));
@ -128,7 +128,7 @@ void DownloadItem::getFileName() {
m_output.setFileName(chosen_filename);
// Check file path for saving.
QDir save_dir = QFileInfo(m_output.fileName()).dir();
const QDir save_dir = QFileInfo(m_output.fileName()).dir();
if (!save_dir.exists() && !save_dir.mkpath(save_dir.absolutePath())) {
stop();
@ -149,8 +149,8 @@ QString DownloadItem::saveFileName(const QString &directory) const {
QString path;
if (m_reply->hasRawHeader("Content-Disposition")) {
QString value = QLatin1String(m_reply->rawHeader("Content-Disposition"));
int pos = value.indexOf(QL1S("filename="));
const QString value = QLatin1String(m_reply->rawHeader("Content-Disposition"));
const int pos = value.indexOf(QL1S("filename="));
if (pos != -1) {
QString name = value.mid(pos + 9);
@ -167,7 +167,7 @@ QString DownloadItem::saveFileName(const QString &directory) const {
path = m_url.path();
}
QFileInfo info(path);
const QFileInfo info(path);
QString base_name = info.completeBaseName();
QString end_name = info.suffix();
@ -213,10 +213,10 @@ void DownloadItem::openFile() {
void DownloadItem::openFolder() {
if (m_output.exists()) {
QString folder = QDir::toNativeSeparators(QFileInfo(m_output.fileName()).absoluteDir().absolutePath());
const QString folder = QDir::toNativeSeparators(QFileInfo(m_output.fileName()).absoluteDir().absolutePath());
#if defined(Q_OS_WIN32)
QString file = QDir::toNativeSeparators(m_output.fileName());
const QString file = QDir::toNativeSeparators(m_output.fileName());
if (!QProcess::startDetached(QString("explorer.exe /select, \"") + file + "\"")) {
MessageBox::show(this, QMessageBox::Warning, tr("Cannot open directory"), tr("Cannot open output directory. Open it manually."), QString(), folder);
@ -375,32 +375,32 @@ void DownloadItem::updateDownloadInfoLabel() {
return;
}
qint64 bytesTotal = m_reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
const qint64 bytes_total = m_reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
bool running = !downloadedSuccessfully();
double speed = currentSpeed();
double timeRemaining = remainingTime();
double time_remaining = remainingTime();
QString info;
if (running) {
QString remaining;
if (bytesTotal != 0) {
remaining = DownloadManager::timeString(timeRemaining);
if (bytes_total != 0) {
remaining = DownloadManager::timeString(time_remaining);
}
info = QString(tr("%1 of %2 (%3 per second) - %4")).arg(DownloadManager::dataString(m_bytesReceived),
bytesTotal == 0 ? QSL("?") : DownloadManager::dataString(bytesTotal),
bytes_total == 0 ? QSL("?") : DownloadManager::dataString(bytes_total),
DownloadManager::dataString((int)speed),
remaining);
}
else {
if (m_bytesReceived == bytesTotal) {
if (m_bytesReceived == bytes_total) {
info = DownloadManager::dataString(m_output.size());
}
else {
info = tr("%1 of %2 - download completed").arg(DownloadManager::dataString(m_bytesReceived),
DownloadManager::dataString(bytesTotal));
DownloadManager::dataString(bytes_total));
}
}
@ -447,7 +447,7 @@ void DownloadItem::updateInfoAndUrlLabel() {
DownloadManager::DownloadManager(QWidget *parent) : TabContent(parent), m_ui(new Ui::DownloadManager),
m_autoSaver(new AutoSaver(this)), m_model(new DownloadModel(this)),
m_networkManager(SilentNetworkAccessManager::instance()), m_iconProvider(0), m_removePolicy(Never) {
m_networkManager(SilentNetworkAccessManager::instance()), m_iconProvider(NULL), m_removePolicy(Never) {
m_ui->setupUi(this);
m_ui->m_viewDownloads->setShowGrid(false);
m_ui->m_viewDownloads->verticalHeader()->hide();
@ -465,19 +465,13 @@ DownloadManager::~DownloadManager() {
m_autoSaver->changeOccurred();
m_autoSaver->saveIfNeccessary();
if (m_iconProvider != NULL) {
delete m_iconProvider;
}
delete m_ui;
qDebug("Destroying DownloadManager instance.");
}
int DownloadManager::activeDownloads() const {
int count = 0;
foreach (DownloadItem *download, m_downloads) {
foreach (const DownloadItem *download, m_downloads) {
if (download->downloading()) {
count++;
}
@ -490,7 +484,7 @@ int DownloadManager::downloadProgress() const {
qint64 bytes_total = 0;
qint64 bytes_received = 0;
foreach (DownloadItem *download, m_downloads) {
foreach (const DownloadItem *download, m_downloads) {
if (download->downloading()) {
bytes_total += download->bytesTotal();
bytes_received += download->bytesReceived();
@ -520,9 +514,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
return;
}
QVariant header = reply->header(QNetworkRequest::ContentLengthHeader);
const QVariant header = reply->header(QNetworkRequest::ContentLengthHeader);
bool ok;
int size = header.toInt(&ok);
const int size = header.toInt(&ok);
if (ok && size == 0) {
return;
@ -541,7 +535,7 @@ void DownloadManager::addItem(DownloadItem *item) {
connect(item, SIGNAL(progress(qint64,qint64)), this, SLOT(itemProgress()));
connect(item, SIGNAL(downloadFinished()), this, SLOT(itemFinished()));
int row = m_downloads.count();
const int row = m_downloads.count();
m_model->beginInsertRows(QModelIndex(), row, row);
m_downloads.append(item);
m_model->endInsertRows();
@ -585,14 +579,14 @@ void DownloadManager::itemProgress() {
}
void DownloadManager::updateRow(DownloadItem *item) {
int row = m_downloads.indexOf(item);
const int row = m_downloads.indexOf(item);
if (row == -1) {
return;
}
if (!m_iconProvider) {
m_iconProvider = new QFileIconProvider();
if (m_iconProvider.isNull()) {
m_iconProvider.reset(new QFileIconProvider());
}
QIcon icon = m_iconProvider->icon(item->m_output.fileName());
@ -662,7 +656,7 @@ void DownloadManager::save() const {
}
void DownloadManager::load() {
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
int i = 0;
// Restore the policy.

View File

@ -146,11 +146,11 @@ class DownloadManager : public TabContent {
private:
void addItem(DownloadItem *item);
Ui::DownloadManager *m_ui;
QScopedPointer<Ui::DownloadManager> m_ui;
AutoSaver *m_autoSaver;
DownloadModel *m_model;
QNetworkAccessManager *m_networkManager;
QFileIconProvider *m_iconProvider;
QScopedPointer<QFileIconProvider> m_iconProvider;
QList<DownloadItem*> m_downloads;
RemovePolicy m_removePolicy;
QString m_downloadDirectory;

View File

@ -59,8 +59,8 @@
#include <QTextCodec>
GoogleSuggest::GoogleSuggest(LocationLineEdit *editor, QObject *parent) : QObject(parent), editor(editor) {
popup = new QListWidget();
GoogleSuggest::GoogleSuggest(LocationLineEdit *editor, QObject *parent)
: QObject(parent), editor(editor), popup(new QListWidget()) {
popup->setWindowFlags(Qt::Popup);
popup->setFocusPolicy(Qt::NoFocus);
popup->setFocusProxy(editor);
@ -74,17 +74,16 @@ GoogleSuggest::GoogleSuggest(LocationLineEdit *editor, QObject *parent) : QObjec
timer->setSingleShot(true);
timer->setInterval(500);
connect(popup, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(doneCompletion()));
connect(popup.data(), SIGNAL(itemClicked(QListWidgetItem*)), SLOT(doneCompletion()));
connect(timer, SIGNAL(timeout()), SLOT(autoSuggest()));
connect(editor, SIGNAL(textEdited(QString)), timer, SLOT(start()));
}
GoogleSuggest::~GoogleSuggest() {
delete popup;
}
bool GoogleSuggest::eventFilter(QObject *object, QEvent *event) {
if (object != popup) {
if (object != popup.data()) {
return false;
}
@ -96,7 +95,7 @@ bool GoogleSuggest::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::KeyPress) {
bool consumed = false;
int key = static_cast<QKeyEvent*>(event)->key();
const int key = static_cast<QKeyEvent*>(event)->key();
switch (key) {
case Qt::Key_Enter:
@ -139,7 +138,7 @@ void GoogleSuggest::showCompletion(const QStringList &choices) {
popup->clear();
foreach (const QString &choice, choices) {
new QListWidgetItem(choice, popup);
new QListWidgetItem(choice, popup.data());
}
popup->setCurrentItem(popup->item(0));
@ -176,20 +175,20 @@ void GoogleSuggest::autoSuggest() {
}
void GoogleSuggest::handleNetworkData() {
QNetworkReply *reply = static_cast<QNetworkReply*>(sender());
QScopedPointer<QNetworkReply> reply(static_cast<QNetworkReply*>(sender()));
if (!reply->error()) {
QStringList choices;
QDomDocument xml;
QByteArray response = reply->readAll();
QTextCodec *c = QTextCodec::codecForUtfText(response);
const QTextCodec *c = QTextCodec::codecForUtfText(response);
xml.setContent(c->toUnicode(response));
QDomNodeList suggestions = xml.elementsByTagName(QSL("suggestion"));
for (int i = 0; i < suggestions.size(); i++) {
QDomElement element = suggestions.at(i).toElement();
const QDomElement element = suggestions.at(i).toElement();
if (element.attributes().contains(QSL("data"))) {
choices.append(element.attribute(QSL("data")));
@ -198,6 +197,4 @@ void GoogleSuggest::handleNetworkData() {
showCompletion(choices);
}
reply->deleteLater();
}

View File

@ -74,7 +74,7 @@ class GoogleSuggest : public QObject {
private:
LocationLineEdit *editor;
QListWidget *popup;
QScopedPointer<QListWidget> popup;
QTimer *timer;
};

View File

@ -34,8 +34,8 @@ NetworkFactory::NetworkFactory() {
QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QUrl &url, const QString &html) {
QStringList feeds;
QRegExp rx(FEED_REGEX_MATCHER, Qt::CaseInsensitive);
QRegExp rx_href(FEED_HREF_REGEX_MATCHER, Qt::CaseInsensitive);
const QRegExp rx(FEED_REGEX_MATCHER, Qt::CaseInsensitive);
const QRegExp rx_href(FEED_HREF_REGEX_MATCHER, Qt::CaseInsensitive);
for (int pos = 0; (pos = rx.indexIn(html, pos)) != -1; pos += rx.matchedLength()) {
QString link_element = html.mid(pos, rx.matchedLength());
@ -130,9 +130,9 @@ QNetworkReply::NetworkError NetworkFactory::downloadIcon(const QList<QString> &u
foreach (const QString &url, urls) {
#if QT_VERSION >= 0x050000
QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(url.toHtmlEscaped());
const QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(url.toHtmlEscaped());
#else
QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(Qt::escape(url));
const QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(Qt::escape(url));
#endif
QByteArray icon_data;
network_result = downloadFile(google_s2_with_url, timeout, icon_data).first;

View File

@ -306,7 +306,7 @@ WebBrowser::~WebBrowser() {
// Remove this instance from the global list of web browsers.
m_runningWebBrowsers.removeAll(this);
// Delete members.
// Delete members. Do not use scoped pointers here.
delete m_layout;
delete m_zoomButtons;
delete m_actionZoom;

View File

@ -45,9 +45,9 @@ void WebBrowserNetworkAccessManager::onAuthenticationRequired(QNetworkReply *rep
QNetworkReply *WebBrowserNetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData) {
if (m_page != NULL) {
QNetworkRequest pageRequest = request;
m_page->populateNetworkRequest(pageRequest);
return WebBrowserNetworkAccessManager::instance()->createRequest(op, pageRequest, outgoingData);
QNetworkRequest page_request = request;
m_page->populateNetworkRequest(page_request);
return WebBrowserNetworkAccessManager::instance()->createRequest(op, page_request, outgoingData);
}
if (op == QNetworkAccessManager::GetOperation) {

View File

@ -38,17 +38,16 @@ class WebBrowserNetworkAccessManager : public BaseNetworkAccessManager {
// used by ALL web browsers and download manager.
static WebBrowserNetworkAccessManager *instance();
protected:
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
protected slots:
void onAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator);
private:
WebPage *m_page;
WebPage *m_page;
static QPointer<WebBrowserNetworkAccessManager> s_instance;
// QNetworkAccessManager interface
protected:
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
};
#endif // WEBBROWSERNETWORKACCESSMANAGER_H

View File

@ -21,7 +21,7 @@ WebFactory::~WebFactory() {
}
void WebFactory::loadState() {
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
switchJavascript(settings->value(GROUP(Browser), SETTING(Browser::JavascriptEnabled)).toBool(), false);
switchImages(settings->value(GROUP(Browser), SETTING(Browser::ImagesEnabled)).toBool(), false);
@ -30,8 +30,8 @@ void WebFactory::loadState() {
bool WebFactory::sendMessageViaEmail(const Message &message) {
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailEnabled)).toBool()) {
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
return QProcess::startDetached(QString("\"") + browser + QSL("\" ") + arguments.arg(message.m_title,
stripTags(message.m_contents)));
@ -46,21 +46,20 @@ bool WebFactory::sendMessageViaEmail(const Message &message) {
bool WebFactory::openUrlInExternalBrowser(const QString &url) {
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool()) {
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
QString call_line = "\"" + browser + "\" \"" + arguments.arg(url) + "\"";
const QString call_line = "\"" + browser + "\" \"" + arguments.arg(url) + "\"";
qDebug("Running command '%s'.", qPrintable(call_line));
bool result = QProcess::startDetached(call_line);
const bool result = QProcess::startDetached(call_line);
if (!result) {
qDebug("External web browser call failed.");
}
return result;
//return QProcess::startDetached(QString("\"") + browser + QSL("\""), QStringList() << arguments.arg(url));
}
else {
return QDesktopServices::openUrl(url);

View File

@ -63,6 +63,7 @@ void WebPage::finished() {
void WebPage::cleanBlockedObjects() {
AdBlockManager *manager = AdBlockManager::instance();
if (!manager->isEnabled()) {
return;
}
@ -101,6 +102,7 @@ void WebPage::cleanBlockedObjects() {
// Apply domain-specific element hiding rules
QString element_hiding = manager->elementHidingRulesForDomain(mainFrame()->url());
if (element_hiding.isEmpty()) {
return;
}
@ -161,7 +163,7 @@ void WebPage::populateNetworkRequest(QNetworkRequest &request) {
void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
if (reply != NULL) {
QUrl reply_url = reply->url();
const QUrl reply_url = reply->url();
if (reply_url.scheme() == QL1S("abp")) {
return;
@ -187,7 +189,7 @@ QString WebPage::toHtml() const {
bool WebPage::acceptNavigationRequest(QWebFrame *frame,
const QNetworkRequest &request,
QWebPage::NavigationType type) {
QString scheme = request.url().scheme();
const QString scheme = request.url().scheme();
if (scheme == QL1S("mailto") || scheme == QL1S("ftp")) {
qWarning("Received request with scheme '%s', blocking it.", qPrintable(scheme));

View File

@ -43,15 +43,13 @@ class WebPage : public QWebPage {
QString toHtml() const;
QString toPlainText() const;
void populateNetworkRequest(QNetworkRequest &request);
bool isLoading() const;
static bool isPointerSafeToUse(WebPage *page);
void addAdBlockRule(const AdBlockRule *rule, const QUrl &url);
QVector<AdBlockedEntry> adBlockedEntries() const;
void populateNetworkRequest(QNetworkRequest &request);
void addAdBlockRule(const AdBlockRule *rule, const QUrl &url);
static bool isPointerSafeToUse(WebPage *page);
private slots:
void progress(int prog);

View File

@ -85,27 +85,27 @@ void WebView::searchTextViaGoogle() {
void WebView::saveCurrentPageToFile() {
QString selected_file;
QString implicit_file_base_name = tr("source_page");
const QString implicit_file_base_name = tr("source_page");
// NOTE: It is good to always ask for destination here, since download manager
// is not displaying afterwards because this is *not* real download actually.
//if (qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool()) {
QString filter_html = tr("HTML web pages (*.html)");
const QString filter_html = tr("HTML web pages (*.html)");
QString filter;
QString selected_filter;
QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
QDir::separator() + implicit_file_base_name + QL1S(".html");
QString filter;
QString selected_filter;
const QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
QDir::separator() + implicit_file_base_name + QL1S(".html");
// Add more filters here.
filter += filter_html;
selected_file = QFileDialog::getSaveFileName(this, tr("Select destination file for web page"),
filename_for_prompt, filter, &selected_filter);
// Add more filters here.
filter += filter_html;
selected_file = QFileDialog::getSaveFileName(this, tr("Select destination file for web page"),
filename_for_prompt, filter, &selected_filter);
if (!selected_file.isEmpty()) {
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(selected_file).absolutePath()));
}
if (!selected_file.isEmpty()) {
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(selected_file).absolutePath()));
}
/*}
else {
QString base_folder = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetDirectory)).toString();
@ -132,14 +132,14 @@ void WebView::saveCurrentPageToFile() {
QFile selected_file_handle(selected_file);
if (selected_file_handle.open(QIODevice::WriteOnly | QIODevice::Unbuffered)) {
QString html_text = page()->mainFrame()->toHtml();
const QString html_text = page()->mainFrame()->toHtml();
QTextStream str(&selected_file_handle);
str.setCodec("UTF-16");
str << html_text;
selected_file_handle.close();
}
else {
else {
MessageBox::show(this, QMessageBox::Critical, tr("Cannot save web page"),
tr("Web page cannot be saved because destination file is not writtable."));
}
@ -299,8 +299,8 @@ void WebView::popupContextMenu(const QPoint &pos) {
context_menu.addAction(m_actionCopySelectedItem);
context_menu.addAction(m_actionSavePageAs);
QUrl hit_url = hit_result.linkUrl();
QUrl hit_image_url = hit_result.imageUrl();
const QUrl hit_url = hit_result.linkUrl();
const QUrl hit_image_url = hit_result.imageUrl();
if (hit_url.isValid()) {
m_contextLinkUrl = hit_url;
@ -340,7 +340,7 @@ void WebView::popupContextMenu(const QPoint &pos) {
}
void WebView::printCurrentPage() {
QPointer<QPrintPreviewDialog> print_preview = new QPrintPreviewDialog(this);
QScopedPointer<QPrintPreviewDialog> print_preview(new QPrintPreviewDialog(this));
connect(print_preview.data(), SIGNAL(paintRequested(QPrinter*)), this, SLOT(print(QPrinter*)));
print_preview.data()->exec();
}
@ -355,8 +355,8 @@ void WebView::mousePressEvent(QMouseEvent *event) {
// Check if user clicked with middle mouse button on some
// hyperlink.
QUrl link_url = hit_result.linkUrl();
QUrl image_url = hit_result.imageUrl();
const QUrl link_url = hit_result.linkUrl();
const QUrl image_url = hit_result.imageUrl();
if (link_url.isValid()) {
emit linkMiddleClicked(link_url);
@ -377,10 +377,10 @@ void WebView::mousePressEvent(QMouseEvent *event) {
void WebView::mouseReleaseEvent(QMouseEvent *event) {
if (event->button() & Qt::MiddleButton) {
bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
const bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
if (are_gestures_enabled) {
QPoint release_point = event->pos();
const QPoint release_point = event->pos();
int left_move = m_gestureOrigin.x() - release_point.x();
int right_move = -left_move;
int top_move = m_gestureOrigin.y() - release_point.y();
@ -423,7 +423,7 @@ void WebView::wheelEvent(QWheelEvent *event) {
}
bool WebView::increaseWebPageZoom() {
qreal new_factor = zoomFactor() + 0.1;
const qreal new_factor = zoomFactor() + 0.1;
if (new_factor >= 0.0 && new_factor <= MAX_ZOOM_FACTOR) {
setZoomFactor(new_factor);
@ -435,7 +435,7 @@ bool WebView::increaseWebPageZoom() {
}
bool WebView::decreaseWebPageZoom() {
qreal new_factor = zoomFactor() - 0.1;
const qreal new_factor = zoomFactor() - 0.1;
if (new_factor >= 0.0 && new_factor <= MAX_ZOOM_FACTOR) {
setZoomFactor(new_factor);
@ -447,7 +447,7 @@ bool WebView::decreaseWebPageZoom() {
}
bool WebView::resetWebPageZoom() {
qreal new_factor = 1.0;
const qreal new_factor = 1.0;
if (new_factor != zoomFactor()) {
setZoomFactor(new_factor);

View File

@ -47,7 +47,7 @@ int RecycleBin::countOfAllMessages() const {
void RecycleBin::updateCounts(bool update_total_count) {
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query_all(database);
ServiceRoot *parent_root = getParentServiceRoot();
const ServiceRoot *parent_root = getParentServiceRoot();
query_all.setForwardOnly(true);
query_all.prepare("SELECT count(*) FROM Messages "
@ -88,7 +88,7 @@ QVariant RecycleBin::data(int column, int role) const {
QList<Message> RecycleBin::undeletedMessages() const {
QList<Message> messages;
int account_id = const_cast<RecycleBin*>(this)->getParentServiceRoot()->accountId();
const int account_id = getParentServiceRoot()->accountId();
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query_read_msg(database);

View File

@ -51,7 +51,7 @@ QList<QAction*> RootItem::contextMenu() {
return QList<QAction*>();
}
bool RootItem::canBeEdited() {
bool RootItem::canBeEdited() const {
return false;
}
@ -59,7 +59,7 @@ bool RootItem::editViaGui() {
return false;
}
bool RootItem::canBeDeleted() {
bool RootItem::canBeDeleted() const {
return false;
}
@ -359,12 +359,12 @@ bool RootItem::removeChild(RootItem *child) {
return m_childItems.removeOne(child);
}
Category *RootItem::toCategory() {
return static_cast<Category*>(this);
Category *RootItem::toCategory() const {
return static_cast<Category*>(const_cast<RootItem*>(this));
}
Feed *RootItem::toFeed() {
return static_cast<Feed*>(this);
Feed *RootItem::toFeed() const {
return static_cast<Feed*>(const_cast<RootItem*>(this));
}
ServiceRoot *RootItem::toServiceRoot() const {

View File

@ -82,14 +82,14 @@ class RootItem : public QObject {
virtual QList<QAction*> contextMenu();
// Can properties of this item be edited?
virtual bool canBeEdited();
virtual bool canBeEdited() const;
// Performs editing of properties of this item (probably via dialog)
// and returns result status.
virtual bool editViaGui();
// Can the item be deleted?
virtual bool canBeDeleted();
virtual bool canBeDeleted() const;
// Performs deletion of the item, this
// method should NOT display any additional dialogs.
@ -255,8 +255,8 @@ class RootItem : public QObject {
}
// Converters
Category *toCategory();
Feed *toFeed();
Category *toCategory() const;
Feed *toFeed() const;
ServiceRoot *toServiceRoot() const;
private:

View File

@ -41,7 +41,7 @@ class ServiceEntryPoint {
// some kind of first-time configuration dialog inside itself
// before returning the root item.
// Returns NULL if initialization of new root cannot be done.
virtual ServiceRoot *createNewRoot() = 0;
virtual ServiceRoot *createNewRoot() const = 0;
// Performs initialization of all service accounts created using this entry
// point from persistent DB.

View File

@ -36,7 +36,7 @@ ServiceRoot::~ServiceRoot() {
bool ServiceRoot::deleteViaGui() {
QSqlDatabase connection = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query(connection);
int account_id = accountId();
const int account_id = accountId();
query.setForwardOnly(true);
QStringList queries;
@ -84,7 +84,7 @@ bool ServiceRoot::markAsReadUnread(RootItem::ReadStatus status) {
QList<Message> ServiceRoot::undeletedMessages() const {
QList<Message> messages;
int account_id = accountId();
const int account_id = accountId();
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query(database);

View File

@ -82,6 +82,10 @@ class ServiceRoot : public RootItem {
virtual void start(bool freshly_activated) = 0;
virtual void stop() = 0;
// Account ID corresponds with DB attribute Accounts (id).
int accountId() const;
void setAccountId(int account_id);
// Returns the UNIQUE code of the given service.
// NOTE: Keep in sync with ServiceEntryRoot::code().
virtual QString code() const = 0;
@ -156,10 +160,6 @@ class ServiceRoot : public RootItem {
void requestItemReassignment(RootItem *item, RootItem *new_parent);
void requestItemRemoval(RootItem *item);
// Account ID corresponds with DB attribute Accounts (id).
int accountId() const;
void setAccountId(int account_id);
public slots:
virtual void addNewFeed(const QString &url = QString()) = 0;
virtual void addNewCategory() = 0;

View File

@ -201,7 +201,7 @@ void FormStandardCategoryDetails::onUseDefaultIcon() {
}
void FormStandardCategoryDetails::initialize() {
m_ui = new Ui::FormStandardCategoryDetails();
m_ui.reset(new Ui::FormStandardCategoryDetails());
m_ui->setupUi(this);
// Set text boxes.

View File

@ -76,7 +76,7 @@ class FormStandardCategoryDetails : public QDialog {
void loadCategories(const QList<Category *> categories, RootItem *root_item, StandardCategory *input_category);
private:
Ui::FormStandardCategoryDetails *m_ui;
QScopedPointer<Ui::FormStandardCategoryDetails> m_ui;
StandardCategory *m_editableCategory;
StandardServiceRoot *m_serviceRoot;

View File

@ -56,7 +56,6 @@ FormStandardFeedDetails::FormStandardFeedDetails(StandardServiceRoot *service_ro
}
FormStandardFeedDetails::~FormStandardFeedDetails() {
delete m_ui;
}
int FormStandardFeedDetails::exec(StandardFeed *input_feed, RootItem *parent_to_select, const QString &url) {
@ -386,7 +385,7 @@ void FormStandardFeedDetails::setEditableFeed(StandardFeed *editable_feed) {
}
void FormStandardFeedDetails::initialize() {
m_ui = new Ui::FormStandardFeedDetails();
m_ui.reset(new Ui::FormStandardFeedDetails());
m_ui->setupUi(this);
// Set flags and attributes.
@ -419,7 +418,7 @@ void FormStandardFeedDetails::initialize() {
m_ui->m_cmbType->addItem(StandardFeed::typeToString(StandardFeed::Rss2X), QVariant::fromValue((int) StandardFeed::Rss2X));
// Load available encodings.
QList<QByteArray> encodings = QTextCodec::availableCodecs();
const QList<QByteArray> encodings = QTextCodec::availableCodecs();
QStringList encoded_encodings;
foreach (const QByteArray &encoding, encodings) {

View File

@ -81,7 +81,7 @@ class FormStandardFeedDetails : public QDialog {
void loadCategories(const QList<Category*> categories, RootItem *root_item);
private:
Ui::FormStandardFeedDetails *m_ui;
QScopedPointer<Ui::FormStandardFeedDetails> m_ui;
StandardFeed *m_editableFeed;
StandardServiceRoot *m_serviceRoot;

View File

@ -53,7 +53,6 @@ FormStandardImportExport::FormStandardImportExport(StandardServiceRoot *service_
}
FormStandardImportExport::~FormStandardImportExport() {
delete m_ui;
}
void FormStandardImportExport::setMode(const FeedsImportExportModel::Mode &mode) {
@ -141,8 +140,8 @@ void FormStandardImportExport::onParsingProgress(int completed, int total) {
}
void FormStandardImportExport::selectExportFile() {
QString filter_opml20 = tr("OPML 2.0 files (*.opml)");
QString filter_txt_url_per_line = tr("TXT files (one URL per line) (*.txt)");
const QString filter_opml20 = tr("OPML 2.0 files (*.opml)");
const QString filter_txt_url_per_line = tr("TXT files (one URL per line) (*.txt)");
QString filter;
QString selected_filter;
@ -178,8 +177,8 @@ void FormStandardImportExport::selectExportFile() {
}
void FormStandardImportExport::selectImportFile() {
QString filter_opml20 = tr("OPML 2.0 files (*.opml)");
QString filter_txt_url_per_line = tr("TXT files (one URL per line) (*.txt)");
const QString filter_opml20 = tr("OPML 2.0 files (*.opml)");
const QString filter_txt_url_per_line = tr("TXT files (one URL per line) (*.txt)");
QString filter;
QString selected_filter;
@ -189,8 +188,8 @@ void FormStandardImportExport::selectImportFile() {
filter += ";;";
filter += filter_txt_url_per_line;
QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), qApp->homeFolderPath(),
filter, &selected_filter);
const QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), qApp->homeFolderPath(),
filter, &selected_filter);
if (!selected_file.isEmpty()) {
if (selected_filter == filter_opml20) {

View File

@ -60,7 +60,7 @@ class FormStandardImportExport : public QDialog {
void exportFeeds();
void importFeeds();
Ui::FormStandardImportExport *m_ui;
QScopedPointer<Ui::FormStandardImportExport> m_ui;
ConversionType m_conversionType;
FeedsImportExportModel *m_model;
StandardServiceRoot *m_serviceRoot;

View File

@ -100,10 +100,9 @@ bool StandardCategory::performDragDropChange(RootItem *target_item) {
}
bool StandardCategory::editViaGui() {
QPointer<FormStandardCategoryDetails> form_pointer = new FormStandardCategoryDetails(serviceRoot(), qApp->mainForm());
QScopedPointer<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(serviceRoot(), qApp->mainForm()));
form_pointer.data()->exec(this, NULL);
delete form_pointer.data();
return false;
}

View File

@ -47,11 +47,11 @@ class StandardCategory : public Category {
Qt::ItemFlags additionalFlags() const;
bool performDragDropChange(RootItem *target_item);
bool canBeEdited() {
bool canBeEdited() const {
return true;
}
bool canBeDeleted() {
bool canBeDeleted() const {
return true;
}

View File

@ -103,10 +103,9 @@ StandardServiceRoot *StandardFeed::serviceRoot() {
}
bool StandardFeed::editViaGui() {
QPointer<FormStandardFeedDetails> form_pointer = new FormStandardFeedDetails(serviceRoot(), qApp->mainForm());
QScopedPointer<FormStandardFeedDetails> form_pointer(new FormStandardFeedDetails(serviceRoot(), qApp->mainForm()));
form_pointer.data()->exec(this, NULL);
delete form_pointer.data();
return false;
}

View File

@ -63,11 +63,11 @@ class StandardFeed : public Feed {
QList<QAction*> contextMenu();
bool canBeEdited() {
bool canBeEdited() const {
return true;
}
bool canBeDeleted() {
bool canBeDeleted() const {
return true;
}

View File

@ -59,7 +59,7 @@ QString StandardServiceEntryPoint::code() const {
return SERVICE_CODE_STD_RSS;
}
ServiceRoot *StandardServiceEntryPoint::createNewRoot() {
ServiceRoot *StandardServiceEntryPoint::createNewRoot() const {
// Switch DB.
QSqlDatabase database = qApp->database()->connection(QSL("StandardServiceEntryPoint"), DatabaseFactory::FromSettings);
QSqlQuery query(database);

View File

@ -34,7 +34,7 @@ class StandardServiceEntryPoint : public ServiceEntryPoint {
QIcon icon() const;
QString code() const;
ServiceRoot *createNewRoot();
ServiceRoot *createNewRoot() const;
QList<ServiceRoot*> initializeSubtree() const;
};

View File

@ -108,11 +108,11 @@ QString StandardServiceRoot::code() const {
return SERVICE_CODE_STD_RSS;
}
bool StandardServiceRoot::canBeEdited() {
bool StandardServiceRoot::canBeEdited() const {
return false;
}
bool StandardServiceRoot::canBeDeleted() {
bool StandardServiceRoot::canBeDeleted() const {
return true;
}

View File

@ -43,8 +43,8 @@ class StandardServiceRoot : public ServiceRoot {
QString code() const;
bool canBeEdited();
bool canBeDeleted();
bool canBeEdited() const;
bool canBeDeleted() const;
bool deleteViaGui();
bool markAsReadUnread(ReadStatus status);

View File

@ -138,7 +138,7 @@ void TtRssFeed::updateCounts(bool including_total_count) {
}
}
bool TtRssFeed::canBeEdited() {
bool TtRssFeed::canBeEdited() const {
return true;
}

View File

@ -41,7 +41,7 @@ class TtRssFeed : public Feed {
void updateCounts(bool including_total_count);
bool canBeEdited();
bool canBeEdited() const;
bool editViaGui();
int countOfAllMessages() const;

View File

@ -71,7 +71,7 @@ QString TtRssServiceEntryPoint::code() const {
return SERVICE_CODE_TT_RSS;
}
ServiceRoot *TtRssServiceEntryPoint::createNewRoot() {
ServiceRoot *TtRssServiceEntryPoint::createNewRoot() const {
QPointer<FormEditAccount> form_acc = new FormEditAccount(qApp->mainForm());
TtRssServiceRoot *new_root = form_acc.data()->execForCreate();
delete form_acc.data();

View File

@ -35,7 +35,7 @@ class TtRssServiceEntryPoint : public ServiceEntryPoint {
QIcon icon() const;
QString code() const;
ServiceRoot *createNewRoot();
ServiceRoot *createNewRoot() const;
QList<ServiceRoot*> initializeSubtree() const;
};

View File

@ -129,11 +129,11 @@ void TtRssServiceRoot::addNewCategory() {
// Do nothing.
}
bool TtRssServiceRoot::canBeEdited() {
bool TtRssServiceRoot::canBeEdited() const {
return true;
}
bool TtRssServiceRoot::canBeDeleted() {
bool TtRssServiceRoot::canBeDeleted() const {
return true;
}

View File

@ -40,8 +40,8 @@ class TtRssServiceRoot : public ServiceRoot {
QString code() const;
bool canBeEdited();
bool canBeDeleted();
bool canBeEdited() const;
bool canBeDeleted() const;
bool editViaGui();
bool deleteViaGui();