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>
<message> <message>
<source>Not supported</source> <source>Not supported</source>
<translation type="unfinished"/> <translation>Nepodporováno</translation>
</message> </message>
<message> <message>
<source>Give account does not support adding feeds.</source> <source>Given account does not support adding feeds.</source>
<translation type="unfinished"/> <translation type="unfinished"/>
</message> </message>
</context> </context>
@ -584,15 +584,15 @@ or this functionality is not implemented yet.</source>
</message> </message>
<message> <message>
<source>Not supported</source> <source>Not supported</source>
<translation type="unfinished"/> <translation>Nepodporováno</translation>
</message> </message>
<message> <message>
<source>Selected account does not support adding of new feeds.</source> <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>
<message> <message>
<source>Selected account does not support adding of new categories.</source> <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> </message>
</context> </context>
<context> <context>
@ -849,11 +849,11 @@ or this functionality is not implemented yet.</source>
</message> </message>
<message> <message>
<source>unknown</source> <source>unknown</source>
<translation type="unfinished"/> <translation>neznámá</translation>
</message> </message>
<message> <message>
<source>file: %1, data: %2</source> <source>file: %1, data: %2</source>
<translation type="unfinished"/> <translation>soubor: %1, data: %2</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1123,15 +1123,15 @@ or this functionality is not implemented yet.</source>
</message> </message>
<message> <message>
<source>The URL is ok.</source> <source>The URL is ok.</source>
<translation type="unfinished"/> <translation>URL je v pořádku.</translation>
</message> </message>
<message> <message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source> <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>
<message> <message>
<source>The URL is empty.</source> <source>The URL is empty.</source>
<translation type="unfinished"/> <translation>URL je prázdná.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1526,19 +1526,19 @@ or this functionality is not implemented yet.</source>
</message> </message>
<message> <message>
<source>Add new feed into selected account</source> <source>Add new feed into selected account</source>
<translation type="unfinished"/> <translation>Přidat nový kanál do vybraného účtu</translation>
</message> </message>
<message> <message>
<source>Add new category into selected account</source> <source>Add new category into selected account</source>
<translation type="unfinished"/> <translation>Přidat novou kategorii do vybraného účtu</translation>
</message> </message>
<message> <message>
<source>Add new category</source> <source>Add new category</source>
<translation type="unfinished"/> <translation>Přidat novou kategorii</translation>
</message> </message>
<message> <message>
<source>Add new feed</source> <source>Add new feed</source>
<translation type="unfinished"/> <translation>Přidat nový kanál</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2687,15 +2687,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message> </message>
<message> <message>
<source>The URL is ok.</source> <source>The URL is ok.</source>
<translation type="unfinished"/> <translation>URL je v pořádku.</translation>
</message> </message>
<message> <message>
<source>The URL does not meet standard pattern. Does your URL start with &quot;http://&quot; or &quot;https://&quot; prefix.</source> <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>
<message> <message>
<source>The URL is empty.</source> <source>The URL is empty.</source>
<translation type="unfinished"/> <translation>URL je prázdná.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2790,15 +2790,15 @@ File filter for external e-mail selection dialog.</extracomment>
</message> </message>
<message> <message>
<source>Parsing data...</source> <source>Parsing data...</source>
<translation type="unfinished"/> <translation>Zpracovávám data...</translation>
</message> </message>
<message> <message>
<source>TXT files (one URL per line) (*.txt)</source> <source>TXT files (one URL per line) (*.txt)</source>
<translation type="unfinished"/> <translation>TXT soubory (jedna URL na řádek) (*.txt)</translation>
</message> </message>
<message> <message>
<source>Cannot write into destination file: &apos;%1&apos;.</source> <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> </message>
</context> </context>
<context> <context>
@ -3434,7 +3434,7 @@ ID účtu: %1</translation>
</message> </message>
<message> <message>
<source>This new account does not include any feeds. You can now add default set of feeds.</source> <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> </message>
</context> </context>
<context> <context>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -125,5 +125,5 @@ void AdBlockAddSubscriptionDialog::checkInputs() {
} }
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog() { 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; QVector<Subscription> m_knownSubscriptions;
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -34,8 +34,8 @@ NetworkFactory::NetworkFactory() {
QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QUrl &url, const QString &html) { QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QUrl &url, const QString &html) {
QStringList feeds; QStringList feeds;
QRegExp rx(FEED_REGEX_MATCHER, Qt::CaseInsensitive); const QRegExp rx(FEED_REGEX_MATCHER, Qt::CaseInsensitive);
QRegExp rx_href(FEED_HREF_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()) { for (int pos = 0; (pos = rx.indexIn(html, pos)) != -1; pos += rx.matchedLength()) {
QString link_element = html.mid(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) { foreach (const QString &url, urls) {
#if QT_VERSION >= 0x050000 #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 #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 #endif
QByteArray icon_data; QByteArray icon_data;
network_result = downloadFile(google_s2_with_url, timeout, icon_data).first; 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. // Remove this instance from the global list of web browsers.
m_runningWebBrowsers.removeAll(this); m_runningWebBrowsers.removeAll(this);
// Delete members. // Delete members. Do not use scoped pointers here.
delete m_layout; delete m_layout;
delete m_zoomButtons; delete m_zoomButtons;
delete m_actionZoom; 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) { QNetworkReply *WebBrowserNetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData) {
if (m_page != NULL) { if (m_page != NULL) {
QNetworkRequest pageRequest = request; QNetworkRequest page_request = request;
m_page->populateNetworkRequest(pageRequest); m_page->populateNetworkRequest(page_request);
return WebBrowserNetworkAccessManager::instance()->createRequest(op, pageRequest, outgoingData); return WebBrowserNetworkAccessManager::instance()->createRequest(op, page_request, outgoingData);
} }
if (op == QNetworkAccessManager::GetOperation) { if (op == QNetworkAccessManager::GetOperation) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -47,7 +47,7 @@ int RecycleBin::countOfAllMessages() const {
void RecycleBin::updateCounts(bool update_total_count) { void RecycleBin::updateCounts(bool update_total_count) {
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings); QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query_all(database); QSqlQuery query_all(database);
ServiceRoot *parent_root = getParentServiceRoot(); const ServiceRoot *parent_root = getParentServiceRoot();
query_all.setForwardOnly(true); query_all.setForwardOnly(true);
query_all.prepare("SELECT count(*) FROM Messages " 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> RecycleBin::undeletedMessages() const {
QList<Message> messages; 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); QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
QSqlQuery query_read_msg(database); QSqlQuery query_read_msg(database);

View file

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

View file

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

View file

@ -41,7 +41,7 @@ class ServiceEntryPoint {
// some kind of first-time configuration dialog inside itself // some kind of first-time configuration dialog inside itself
// before returning the root item. // before returning the root item.
// Returns NULL if initialization of new root cannot be done. // 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 // Performs initialization of all service accounts created using this entry
// point from persistent DB. // point from persistent DB.

View file

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

View file

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

View file

@ -201,7 +201,7 @@ void FormStandardCategoryDetails::onUseDefaultIcon() {
} }
void FormStandardCategoryDetails::initialize() { void FormStandardCategoryDetails::initialize() {
m_ui = new Ui::FormStandardCategoryDetails(); m_ui.reset(new Ui::FormStandardCategoryDetails());
m_ui->setupUi(this); m_ui->setupUi(this);
// Set text boxes. // 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); void loadCategories(const QList<Category *> categories, RootItem *root_item, StandardCategory *input_category);
private: private:
Ui::FormStandardCategoryDetails *m_ui; QScopedPointer<Ui::FormStandardCategoryDetails> m_ui;
StandardCategory *m_editableCategory; StandardCategory *m_editableCategory;
StandardServiceRoot *m_serviceRoot; StandardServiceRoot *m_serviceRoot;

View file

@ -56,7 +56,6 @@ FormStandardFeedDetails::FormStandardFeedDetails(StandardServiceRoot *service_ro
} }
FormStandardFeedDetails::~FormStandardFeedDetails() { FormStandardFeedDetails::~FormStandardFeedDetails() {
delete m_ui;
} }
int FormStandardFeedDetails::exec(StandardFeed *input_feed, RootItem *parent_to_select, const QString &url) { 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() { void FormStandardFeedDetails::initialize() {
m_ui = new Ui::FormStandardFeedDetails(); m_ui.reset(new Ui::FormStandardFeedDetails());
m_ui->setupUi(this); m_ui->setupUi(this);
// Set flags and attributes. // 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)); m_ui->m_cmbType->addItem(StandardFeed::typeToString(StandardFeed::Rss2X), QVariant::fromValue((int) StandardFeed::Rss2X));
// Load available encodings. // Load available encodings.
QList<QByteArray> encodings = QTextCodec::availableCodecs(); const QList<QByteArray> encodings = QTextCodec::availableCodecs();
QStringList encoded_encodings; QStringList encoded_encodings;
foreach (const QByteArray &encoding, 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); void loadCategories(const QList<Category*> categories, RootItem *root_item);
private: private:
Ui::FormStandardFeedDetails *m_ui; QScopedPointer<Ui::FormStandardFeedDetails> m_ui;
StandardFeed *m_editableFeed; StandardFeed *m_editableFeed;
StandardServiceRoot *m_serviceRoot; StandardServiceRoot *m_serviceRoot;

View file

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

View file

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

View file

@ -100,10 +100,9 @@ bool StandardCategory::performDragDropChange(RootItem *target_item) {
} }
bool StandardCategory::editViaGui() { 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); form_pointer.data()->exec(this, NULL);
delete form_pointer.data();
return false; return false;
} }

View file

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

View file

@ -103,10 +103,9 @@ StandardServiceRoot *StandardFeed::serviceRoot() {
} }
bool StandardFeed::editViaGui() { 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); form_pointer.data()->exec(this, NULL);
delete form_pointer.data();
return false; return false;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -43,8 +43,8 @@ class StandardServiceRoot : public ServiceRoot {
QString code() const; QString code() const;
bool canBeEdited(); bool canBeEdited() const;
bool canBeDeleted(); bool canBeDeleted() const;
bool deleteViaGui(); bool deleteViaGui();
bool markAsReadUnread(ReadStatus status); 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; return true;
} }

View file

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

View file

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

View file

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

View file

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

View file

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