Renamed some core classes.

This commit is contained in:
Martin Rotter 2015-07-24 10:05:42 +02:00
parent c3f32119db
commit be51f0c3c1
35 changed files with 1212 additions and 1213 deletions

View File

@ -399,13 +399,13 @@ set(APP_SOURCES
src/core/messagesproxymodel.cpp
src/core/feedsmodel.cpp
src/core/feedsproxymodel.cpp
src/core/feedsmodelcategory.cpp
src/core/feedsmodelrootitem.cpp
src/core/feedsmodelfeed.cpp
src/core/category.cpp
src/core/rootitem.cpp
src/core/feed.cpp
src/core/parsingfactory.cpp
src/core/feeddownloader.cpp
src/core/feedsimportexportmodel.cpp
src/core/feedsmodelrecyclebin.cpp
src/core/recyclebin.cpp
src/core/feedsselection.cpp
# NETWORK-WEB sources.

View File

@ -198,6 +198,29 @@ Berte také na paměti, že některé prostředky webových stránek jsou intern
<translation>Obnovení nastavení nebylo spuštěno. Ujistěte se, že cílový adresář je zapisovatelný.</translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation>%1 (kategorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation>
Tato kategorie neobsahuje žádné položky.</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n nepřečtená zpráva.</numerusform>
<numerusform>%n nepřečtené zprávy.</numerusform>
<numerusform>%n nepřečtených zpráv.</numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -425,6 +448,50 @@ Klikněte sem pro otevření nadřazeného adresáře.</translation>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>nepoužívá auto-aktualizace</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>používá globální nastavení</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>
<numerusform>používá specifické nastavení (%n minuta do další aktualizace)</numerusform>
<numerusform>používá specifické nastavení (%n minuty do další aktualizace)</numerusform>
<numerusform>používá specifické nastavení (%n minut do další aktualizace)</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation>%1 (%2)%3
Síťový status: %6
Kódování: %4
Automatický update: %5</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n nepřečtená zpráva.</numerusform>
<numerusform>%n nepřečtené zprávy.</numerusform>
<numerusform>%n nepřečtených zpráv.</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -518,98 +585,6 @@ Klikněte sem pro otevření nadřazeného adresáře.</translation>
<translation>Import byl zcela úspěšný.</translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n nepřečtená zpráva.</numerusform>
<numerusform>%n nepřečtené zprávy.</numerusform>
<numerusform>%n nepřečtených zpráv.</numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation>%1 (kategorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation>
Tato kategorie neobsahuje žádné položky.</translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>nepoužívá auto-aktualizace</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>používá globální nastavení</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>
<numerusform>používá specifické nastavení (%n minuta do další aktualizace)</numerusform>
<numerusform>používá specifické nastavení (%n minuty do další aktualizace)</numerusform>
<numerusform>používá specifické nastavení (%n minut do další aktualizace)</numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n nepřečtená zpráva.</numerusform>
<numerusform>%n nepřečtené zprávy.</numerusform>
<numerusform>%n nepřečtených zpráv.</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation>%1 (%2)%3
Síťový status: %6
Kódování: %4
Automatický update: %5</translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Koš</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation>Koš obsahuje všechny smazané zprávy ze všech kanálů.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation>Koš
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation>
<numerusform>%n smazaná zpráva.</numerusform>
<numerusform>%n smazané zprávy.</numerusform>
<numerusform>%n smazaných zpráv.</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2981,6 +2956,31 @@ Přejít na web aplikace a stáhnout jej ručně.</translation>
<translation>Vítá vás %1 %2.</translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Koš</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation>Koš obsahuje všechny smazané zprávy ze všech kanálů.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation>Koš
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation>
<numerusform>%n smazaná zpráva.</numerusform>
<numerusform>%n smazané zprávy.</numerusform>
<numerusform>%n smazaných zpráv.</numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,27 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -415,6 +436,44 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -508,88 +567,6 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Mülleimer</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation>Der Mülleimer enthält die gelöschten Nachrichten aus allen Feeds.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2944,6 +2921,29 @@ Go to application website to obtain it manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished">Mülleimer</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished">Der Mülleimer enthält die gelöschten Nachrichten aus allen Feeds.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,27 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -415,6 +436,44 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -508,88 +567,6 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2939,6 +2916,29 @@ Go to application website to obtain it manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -242,6 +242,30 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<location filename="../src/core/category.cpp" line="61"/>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/category.cpp" line="65"/>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/category.cpp" line="70"/>
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -510,6 +534,49 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<location filename="../src/core/feed.cpp" line="331"/>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/feed.cpp" line="336"/>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feed.cpp" line="342"/>
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../src/core/feed.cpp" line="350"/>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feed.cpp" line="363"/>
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -623,100 +690,6 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message>
<location filename="../src/core/feedsmodelcategory.cpp" line="62"/>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/feedsmodelcategory.cpp" line="66"/>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feedsmodelcategory.cpp" line="71"/>
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<location filename="../src/core/feedsmodelfeed.cpp" line="331"/>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/feedsmodelfeed.cpp" line="336"/>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feedsmodelfeed.cpp" line="342"/>
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../src/core/feedsmodelfeed.cpp" line="350"/>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feedsmodelfeed.cpp" line="363"/>
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<location filename="../src/core/feedsmodelrecyclebin.cpp" line="31"/>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/feedsmodelrecyclebin.cpp" line="32"/>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/feedsmodelrecyclebin.cpp" line="96"/>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/feedsmodelrecyclebin.cpp" line="96"/>
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -3662,6 +3635,33 @@ currently installed one.</source>
<translation>rotter.martinos@gmail.com</translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<location filename="../src/core/recyclebin.cpp" line="31"/>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/recyclebin.cpp" line="32"/>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/core/recyclebin.cpp" line="96"/>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/core/recyclebin.cpp" line="96"/>
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,27 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished">%1 (catégorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -415,6 +436,44 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">Ne pas utiliser la mise à jour automatique</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">Utiliser les paramètres globaux</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -508,89 +567,6 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n message(s) non lu(s).</numerusform>
<numerusform>%n message(s) non lu(s).</numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation>%1 (catégorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>Ne pas utiliser la mise à jour automatique</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>Utiliser les paramètres globaux</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform>%n message(s) non lu(s).</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Poubelle</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation>Corbeille
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2956,6 +2932,30 @@ Aller sur le site de l&apos;application pour les obtenir manuellement.</translat
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished">Poubelle</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished">Corbeille
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,27 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -415,6 +436,44 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">non utilizza l&apos;auto-aggiornamento</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">utilizza impostazioni globali</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -508,88 +567,6 @@ Click here to open parent directory.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n messaggio(i) non letto.</numerusform>
<numerusform>%n messaggio(i) non letti.</numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>non utilizza l&apos;auto-aggiornamento</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>utilizza impostazioni globali</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform>%n messaggio(i) non letti.</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2944,6 +2921,29 @@ Go to application website to obtain it manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,29 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation>Herstel van de instellingen werd niet gestart. Zorg ervoor dat de uitvoermap beschrijfbaar is.</translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished">%1 (categorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished">
Deze categorie bevat geen nested items.</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform>%n ongelezen bericht.</numerusform>
<numerusform>%n ongelezen berichten.</numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -417,6 +440,48 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">automatisch bijwerken niet gebruiken</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">gebruik algemene instellingen</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform>gebruik specifieke instellingen (%n minuut voor volgende automatische update)</numerusform>
<numerusform>gebruik specifieke instellingen (%n minuten voor volgende automatische update)</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished">%1 (%2)%3
Netwerk status: %6
Coderen: %4
Auto-update status: %5</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform>%n ongelezen bericht.</numerusform>
<numerusform>%n ongelezen berichten.</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -510,95 +575,6 @@ Click here to open parent directory.</source>
<translation>Importeren is helemaal geslaagd.</translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n ongelezen bericht.</numerusform>
<numerusform>%n ongelezen berichten.</numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation>%1 (categorie)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation>
Deze categorie bevat geen nested items.</translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>automatisch bijwerken niet gebruiken</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>gebruik algemene instellingen</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>
<numerusform>gebruik specifieke instellingen (%n minuut voor volgende automatische update)</numerusform>
<numerusform>gebruik specifieke instellingen (%n minuten voor volgende automatische update)</numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n ongelezen bericht.</numerusform>
<numerusform>%n ongelezen berichten.</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation>%1 (%2)%3
Netwerk status: %6
Coderen: %4
Auto-update status: %5</translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Prullenbak</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation>De prullenbak bevat alle verwijderde berichten van alle feeds.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation>Prullenbak
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation>
<numerusform>%n verwijderde bericht(en).</numerusform>
<numerusform>%n verwijderde bericht(en).</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2981,6 +2957,30 @@ Ga naar RRSguard website en download het handmatig.</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished">Prullenbak</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished">De prullenbak bevat alle verwijderde berichten van alle feeds.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished">Prullenbak
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform>%n verwijderde bericht(en).</numerusform>
<numerusform>%n verwijderde bericht(en).</numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -196,6 +196,28 @@ Also note that some resources are cached by internal web browser. Thus, after ch
<translation>Inställningsåterställning startades inte. Tillse att utdatamappen är skrivbar.</translation>
</message>
</context>
<context>
<name>Category</name>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation type="unfinished">%1 (kategori)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation type="unfinished">
Denna kategori innehåller inga objekt.</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform>%n oläst meddelande.</numerusform>
<numerusform>%n olästa meddelanden.</numerusform>
</translation>
</message>
</context>
<context>
<name>DatabaseCleaner</name>
<message>
@ -417,6 +439,48 @@ Click here to open parent directory.</source>
</translation>
</message>
</context>
<context>
<name>Feed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">Uppdateras inte automatiskt</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">Globala inställningar</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation type="unfinished">
<numerusform>Anpassade inställningar. (%n minut till nästa auto-uppdatering)</numerusform>
<numerusform>Anpassade inställningar. (%n minuter till nästa auto-uppdatering)</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation type="unfinished">%1 (%2)%3
Nätverksstatus: %6
Kodning: %4
Uppdateringsstatus: %5</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation type="unfinished">
<numerusform>%n oläst meddelande.</numerusform>
<numerusform>%n olästa meddelanden.</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedMessageViewer</name>
<message>
@ -510,94 +574,6 @@ Click here to open parent directory.</source>
<translation>Importen slutfördes korrekt.</translation>
</message>
</context>
<context>
<name>FeedsModelCategory</name>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n oläst meddelande.</numerusform>
<numerusform>%n olästa meddelanden.</numerusform>
</translation>
</message>
<message>
<source>%1 (category)%2%3</source>
<extracomment>Tooltip for standard feed.</extracomment>
<translation>%1 (kategori)%2%3</translation>
</message>
<message>
<source>
This category does not contain any nested items.</source>
<translation>
Denna kategori innehåller inga objekt.</translation>
</message>
</context>
<context>
<name>FeedsModelFeed</name>
<message>
<source>does not use auto-update</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>Uppdateras inte automatiskt</translation>
</message>
<message>
<source>uses global settings</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>Globala inställningar</translation>
</message>
<message numerus="yes">
<source>uses specific settings (%n minute(s) to next auto-update)</source>
<extracomment>Describes feed auto-update status.</extracomment>
<translation>
<numerusform>Anpassade inställningar. (%n minut till nästa auto-uppdatering)</numerusform>
<numerusform>Anpassade inställningar. (%n minuter till nästa auto-uppdatering)</numerusform>
</translation>
</message>
<message numerus="yes">
<source>%n unread message(s).</source>
<extracomment>Tooltip for &quot;unread&quot; column of feed list.</extracomment>
<translation>
<numerusform>%n oläst meddelande.</numerusform>
<numerusform>%n olästa meddelanden.</numerusform>
</translation>
</message>
<message>
<source>%1 (%2)%3
Network status: %6
Encoding: %4
Auto-update status: %5</source>
<extracomment>Tooltip for feed.</extracomment>
<translation>%1 (%2)%3
Nätverksstatus: %6
Kodning: %4
Uppdateringsstatus: %5</translation>
</message>
</context>
<context>
<name>FeedsModelRecycleBin</name>
<message>
<source>Recycle bin</source>
<translation>Papperskorgen</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation>Papperskorgen innehåller borttagna meddelanden från samtliga flöden.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation>Papperskorgen
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation>
<numerusform>%n borttaget meddelande.</numerusform>
<numerusform>%n borttagna meddelanden.</numerusform>
</translation>
</message>
</context>
<context>
<name>FeedsToolBar</name>
<message>
@ -2971,6 +2947,30 @@ Gå till programmets hemsida för att hämta den manuellt.</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecycleBin</name>
<message>
<source>Recycle bin</source>
<translation type="unfinished">Papperskorgen</translation>
</message>
<message>
<source>Recycle bin contains all deleted messages from all feeds.</source>
<translation type="unfinished">Papperskorgen innehåller borttagna meddelanden från samtliga flöden.</translation>
</message>
<message>
<source>Recycle bin
%1</source>
<translation type="unfinished">Papperskorgen
%1</translation>
</message>
<message numerus="yes">
<source>%n deleted message(s).</source>
<translation type="unfinished">
<numerusform>%n borttaget meddelande.</numerusform>
<numerusform>%n borttagna meddelanden.</numerusform>
</translation>
</message>
</context>
<context>
<name>ShortcutCatcher</name>
<message>

View File

@ -15,14 +15,13 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "core/feedsmodelcategory.h"
#include "core/category.h"
#include "definitions/definitions.h"
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/iconfactory.h"
#include "gui/dialogs/formcategorydetails.h"
#include "core/feedsmodel.h"
#include <QVariant>
@ -30,12 +29,12 @@
#include <QSqlError>
FeedsModelCategory::FeedsModelCategory(FeedsModelRootItem *parent_item) : FeedsModelRootItem(parent_item) {
Category::Category(RootItem *parent_item) : RootItem(parent_item) {
init();
}
FeedsModelCategory::FeedsModelCategory(const FeedsModelCategory &other)
: FeedsModelRootItem(NULL) {
Category::Category(const Category &other)
: RootItem(NULL) {
m_kind = other.kind();
m_id = other.id();
m_title = other.title();
@ -46,15 +45,15 @@ FeedsModelCategory::FeedsModelCategory(const FeedsModelCategory &other)
m_parentItem = other.parent();
}
FeedsModelCategory::~FeedsModelCategory() {
qDebug("Destroying FeedsModelCategory instance.");
Category::~Category() {
qDebug("Destroying Category instance.");
}
void FeedsModelCategory::init() {
m_kind = FeedsModelRootItem::Category;
void Category::init() {
m_kind = RootItem::Cattegory;
}
QVariant FeedsModelCategory::data(int column, int role) const {
QVariant Category::data(int column, int role) const {
switch (role) {
case Qt::ToolTipRole:
if (column == FDS_MODEL_TITLE_INDEX) {
@ -122,17 +121,17 @@ QVariant FeedsModelCategory::data(int column, int role) const {
}
}
bool FeedsModelCategory::removeItself() {
bool Category::removeItself() {
bool children_removed = true;
// Remove all child items (feeds, categories.)
foreach (FeedsModelRootItem *child, m_childItems) {
foreach (RootItem *child, m_childItems) {
children_removed &= child->removeItself();
}
if (children_removed) {
// Children are removed, remove this standard category too.
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
QSqlDatabase database = qApp->database()->connection(QSL("Category"), DatabaseFactory::FromSettings);
QSqlQuery query_remove(database);
// Remove this category from database.
@ -147,10 +146,10 @@ bool FeedsModelCategory::removeItself() {
}
}
bool FeedsModelCategory::addItself(FeedsModelRootItem *parent) {
bool Category::addItself(RootItem *parent) {
// Now, add category to persistent storage.
// Children are removed, remove this standard category too.
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
QSqlDatabase database = qApp->database()->connection(QSL("Category"), DatabaseFactory::FromSettings);
QSqlQuery query_add(database);
query_add.setForwardOnly(true);
@ -186,11 +185,11 @@ bool FeedsModelCategory::addItself(FeedsModelRootItem *parent) {
return true;
}
bool FeedsModelCategory::editItself(FeedsModelCategory *new_category_data) {
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
bool Category::editItself(Category *new_category_data) {
QSqlDatabase database = qApp->database()->connection(QSL("Category"), DatabaseFactory::FromSettings);
QSqlQuery query_update_category(database);
FeedsModelCategory *original_category = this;
FeedsModelRootItem *new_parent = new_category_data->parent();
Category *original_category = this;
RootItem *new_parent = new_category_data->parent();
query_update_category.setForwardOnly(true);
query_update_category.prepare("UPDATE Categories "
@ -216,7 +215,7 @@ bool FeedsModelCategory::editItself(FeedsModelCategory *new_category_data) {
return true;
}
FeedsModelCategory::FeedsModelCategory(const QSqlRecord &record) : FeedsModelRootItem(NULL) {
Category::Category(const QSqlRecord &record) : RootItem(NULL) {
init();
setId(record.value(CAT_DB_ID_INDEX).toInt());

18
src/core/feedsmodelcategory.h → src/core/category.h Executable file → Normal file
View File

@ -18,7 +18,7 @@
#ifndef FEEDSMODELCATEGORY_H
#define FEEDSMODELCATEGORY_H
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
#include <QSqlRecord>
#include <QCoreApplication>
@ -29,15 +29,15 @@ class FeedsModel;
// Base class for all categories contained in FeedsModel.
// NOTE: This class should be derived to create PARTICULAR category types.
// NOTE: This class should not be instantiated directly.
class FeedsModelCategory : public FeedsModelRootItem {
Q_DECLARE_TR_FUNCTIONS(FeedsModelCategory)
class Category : public RootItem {
Q_DECLARE_TR_FUNCTIONS(Category)
public:
// Constructors and destructors
explicit FeedsModelCategory(FeedsModelRootItem *parent_item = NULL);
explicit FeedsModelCategory(const FeedsModelCategory &other);
explicit FeedsModelCategory(const QSqlRecord &record);
virtual ~FeedsModelCategory();
explicit Category(RootItem *parent_item = NULL);
explicit Category(const Category &other);
explicit Category(const QSqlRecord &record);
virtual ~Category();
// Returns the actual data representation of standard category.
QVariant data(int column, int role) const;
@ -46,8 +46,8 @@ class FeedsModelCategory : public FeedsModelRootItem {
// database.
bool removeItself();
bool addItself(FeedsModelRootItem *parent);
bool editItself(FeedsModelCategory *new_category_data);
bool addItself(RootItem *parent);
bool editItself(Category *new_category_data);
private:
void init();

80
src/core/feedsmodelfeed.cpp → src/core/feed.cpp Executable file → Normal file
View File

@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "core/feedsmodelfeed.h"
#include "core/feed.h"
#include "definitions/definitions.h"
#include "core/parsingfactory.h"
@ -38,7 +38,7 @@
#include <QXmlStreamReader>
void FeedsModelFeed::init() {
void Feed::init() {
m_passwordProtected = false;
m_username = QString();
m_password = QString();
@ -52,16 +52,16 @@ void FeedsModelFeed::init() {
m_autoUpdateRemainingInterval = DEFAULT_AUTO_UPDATE_INTERVAL;
m_encoding = QString();
m_url = QString();
m_kind = FeedsModelRootItem::Feed;
m_kind = RootItem::Feeed;
}
FeedsModelFeed::FeedsModelFeed(FeedsModelRootItem *parent_item)
: FeedsModelRootItem(parent_item) {
Feed::Feed(RootItem *parent_item)
: RootItem(parent_item) {
init();
}
FeedsModelFeed::FeedsModelFeed(const FeedsModelFeed &other)
: FeedsModelRootItem(NULL) {
Feed::Feed(const Feed &other)
: RootItem(NULL) {
m_passwordProtected = other.passwordProtected();
m_username = other.username();
m_password = other.password();
@ -75,7 +75,7 @@ FeedsModelFeed::FeedsModelFeed(const FeedsModelFeed &other)
m_autoUpdateRemainingInterval = other.autoUpdateRemainingInterval();
m_encoding = other.encoding();
m_url = other.url();
m_kind = FeedsModelRootItem::Feed;
m_kind = RootItem::Feeed;
m_title = other.title();
m_id = other.id();
m_icon = other.icon();
@ -85,24 +85,24 @@ FeedsModelFeed::FeedsModelFeed(const FeedsModelFeed &other)
m_description = other.description();
}
FeedsModelFeed::~FeedsModelFeed() {
qDebug("Destroying FeedsModelFeed instance.");
Feed::~Feed() {
qDebug("Destroying Feed instance.");
}
int FeedsModelFeed::childCount() const {
int Feed::childCount() const {
// Because feed has no children.
return 0;
}
int FeedsModelFeed::countOfAllMessages() const {
int Feed::countOfAllMessages() const {
return m_totalCount;
}
int FeedsModelFeed::countOfUnreadMessages() const {
int Feed::countOfUnreadMessages() const {
return m_unreadCount;
}
QString FeedsModelFeed::typeToString(FeedsModelFeed::Type type) {
QString Feed::typeToString(Feed::Type type) {
switch (type) {
case Atom10:
return QSL("ATOM 1.0");
@ -119,8 +119,8 @@ QString FeedsModelFeed::typeToString(FeedsModelFeed::Type type) {
}
}
void FeedsModelFeed::updateCounts(bool including_total_count, bool update_feed_statuses) {
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
void Feed::updateCounts(bool including_total_count, bool update_feed_statuses) {
QSqlDatabase database = qApp->database()->connection(QSL("Feed"), DatabaseFactory::FromSettings);
QSqlQuery query_all(database);
query_all.setForwardOnly(true);
@ -143,10 +143,10 @@ void FeedsModelFeed::updateCounts(bool including_total_count, bool update_feed_s
}
}
QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(const QString &url,
QPair<Feed*, QNetworkReply::NetworkError> Feed::guessFeed(const QString &url,
const QString &username,
const QString &password) {
QPair<FeedsModelFeed*, QNetworkReply::NetworkError> result; result.first = NULL;
QPair<Feed*, QNetworkReply::NetworkError> result; result.first = NULL;
QByteArray feed_contents;
NetworkResult network_result = NetworkFactory::downloadFeedFile(url,
@ -175,7 +175,7 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
}
if (result.first == NULL) {
result.first = new FeedsModelFeed();
result.first = new Feed();
}
QTextCodec *custom_codec = QTextCodec::codecForName(xml_schema_encoding.toLocal8Bit());
@ -287,7 +287,7 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
return result;
}
QVariant FeedsModelFeed::data(int column, int role) const {
QVariant Feed::data(int column, int role) const {
switch (role) {
case Qt::DisplayRole:
if (column == FDS_MODEL_TITLE_INDEX) {
@ -352,7 +352,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
"Network status: %6\n"
"Encoding: %4\n"
"Auto-update status: %5").arg(m_title,
FeedsModelFeed::typeToString(m_type),
Feed::typeToString(m_type),
m_description.isEmpty() ? QString() : QString('\n') + m_description,
m_encoding,
auto_update_string,
@ -394,7 +394,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
}
}
int FeedsModelFeed::update() {
int Feed::update() {
QByteArray feed_contents;
int download_timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
m_networkError = NetworkFactory::downloadFeedFile(url(), download_timeout, feed_contents,
@ -427,16 +427,16 @@ int FeedsModelFeed::update() {
QList<Message> messages;
switch (type()) {
case FeedsModelFeed::Rss0X:
case FeedsModelFeed::Rss2X:
case Feed::Rss0X:
case Feed::Rss2X:
messages = ParsingFactory::parseAsRSS20(formatted_feed_contents);
break;
case FeedsModelFeed::Rdf:
case Feed::Rdf:
messages = ParsingFactory::parseAsRDF(formatted_feed_contents);
break;
case FeedsModelFeed::Atom10:
case Feed::Atom10:
messages = ParsingFactory::parseAsATOM10(formatted_feed_contents);
default:
@ -446,8 +446,8 @@ int FeedsModelFeed::update() {
return updateMessages(messages);
}
bool FeedsModelFeed::removeItself() {
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
bool Feed::removeItself() {
QSqlDatabase database = qApp->database()->connection(QSL("Feed"), DatabaseFactory::FromSettings);
QSqlQuery query_remove(database);
query_remove.setForwardOnly(true);
@ -467,9 +467,9 @@ bool FeedsModelFeed::removeItself() {
return query_remove.exec();
}
bool FeedsModelFeed::addItself(FeedsModelRootItem *parent) {
bool Feed::addItself(RootItem *parent) {
// Now, add feed to persistent storage.
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
QSqlDatabase database = qApp->database()->connection(QSL("Feed"), DatabaseFactory::FromSettings);
QSqlQuery query_add_feed(database);
query_add_feed.setForwardOnly(true);
@ -511,11 +511,11 @@ bool FeedsModelFeed::addItself(FeedsModelRootItem *parent) {
return true;
}
bool FeedsModelFeed::editItself(FeedsModelFeed *new_feed_data) {
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
bool Feed::editItself(Feed *new_feed_data) {
QSqlDatabase database = qApp->database()->connection(QSL("Feed"), DatabaseFactory::FromSettings);
QSqlQuery query_update_feed(database);
FeedsModelFeed *original_feed = this;
FeedsModelRootItem *new_parent = new_feed_data->parent();
Feed *original_feed = this;
RootItem *new_parent = new_feed_data->parent();
query_update_feed.setForwardOnly(true);
query_update_feed.prepare("UPDATE Feeds "
@ -558,10 +558,10 @@ bool FeedsModelFeed::editItself(FeedsModelFeed *new_feed_data) {
return true;
}
int FeedsModelFeed::updateMessages(const QList<Message> &messages) {
int Feed::updateMessages(const QList<Message> &messages) {
int feed_id = id();
int updated_messages = 0;
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
QSqlDatabase database = qApp->database()->connection(QSL("Feed"), DatabaseFactory::FromSettings);
bool remove_duplicates = qApp->settings()->value(GROUP(Messages), SETTING(Messages::RemoveDuplicates)).toBool();
// Prepare queries.
@ -685,12 +685,12 @@ int FeedsModelFeed::updateMessages(const QList<Message> &messages) {
return updated_messages;
}
QNetworkReply::NetworkError FeedsModelFeed::networkError() const {
QNetworkReply::NetworkError Feed::networkError() const {
return m_networkError;
}
FeedsModelFeed::FeedsModelFeed(const QSqlRecord &record) : FeedsModelRootItem(NULL) {
m_kind = FeedsModelRootItem::Feed;
Feed::Feed(const QSqlRecord &record) : RootItem(NULL) {
m_kind = RootItem::Feeed;
setTitle(record.value(FDS_DB_TITLE_INDEX).toString());
setId(record.value(FDS_DB_ID_INDEX).toInt());
@ -702,7 +702,7 @@ FeedsModelFeed::FeedsModelFeed(const QSqlRecord &record) : FeedsModelRootItem(NU
setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool());
setUsername(record.value(FDS_DB_USERNAME_INDEX).toString());
setPassword(TextFactory::decrypt(record.value(FDS_DB_PASSWORD_INDEX).toString()));
setAutoUpdateType(static_cast<FeedsModelFeed::AutoUpdateType>(record.value(FDS_DB_UPDATE_TYPE_INDEX).toInt()));
setAutoUpdateType(static_cast<Feed::AutoUpdateType>(record.value(FDS_DB_UPDATE_TYPE_INDEX).toInt()));
setAutoUpdateInitialInterval(record.value(FDS_DB_UPDATE_INTERVAL_INDEX).toInt());
updateCounts();
}

22
src/core/feedsmodelfeed.h → src/core/feed.h Executable file → Normal file
View File

@ -18,7 +18,7 @@
#ifndef FEEDSMODELFEED_H
#define FEEDSMODELFEED_H
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
#include <QMetaType>
#include <QDateTime>
@ -33,8 +33,8 @@ class FeedsModel;
// Represents BASE class for feeds contained in FeedsModel.
// NOTE: This class should be derived to create PARTICULAR feed types.
class FeedsModelFeed : public FeedsModelRootItem {
Q_DECLARE_TR_FUNCTIONS(FeedsModelFeed)
class Feed : public RootItem {
Q_DECLARE_TR_FUNCTIONS(Feed)
public:
// Describes possible types of feeds.
@ -63,10 +63,10 @@ class FeedsModelFeed : public FeedsModelRootItem {
};
// Constructors and destructors.
explicit FeedsModelFeed(FeedsModelRootItem *parent_item = NULL);
explicit FeedsModelFeed(const FeedsModelFeed &other);
explicit FeedsModelFeed(const QSqlRecord &record);
virtual ~FeedsModelFeed();
explicit Feed(RootItem *parent_item = NULL);
explicit Feed(const Feed &other);
explicit Feed(const QSqlRecord &record);
virtual ~Feed();
// Returns 0, feeds have no children.
int childCount() const;
@ -86,8 +86,8 @@ class FeedsModelFeed : public FeedsModelRootItem {
// Removes this standard feed from persistent
// storage.
bool removeItself();
bool addItself(FeedsModelRootItem *parent);
bool editItself(FeedsModelFeed *new_feed_data);
bool addItself(RootItem *parent);
bool editItself(Feed *new_feed_data);
// Other getters/setters.
inline Type type() const {
@ -180,7 +180,7 @@ class FeedsModelFeed : public FeedsModelRootItem {
// Returns pointer to guessed feed (if at least partially
// guessed) and retrieved error/status code from network layer
// or NULL feed.
static QPair<FeedsModelFeed*, QNetworkReply::NetworkError> guessFeed(const QString &url,
static QPair<Feed*, QNetworkReply::NetworkError> guessFeed(const QString &url,
const QString &username,
const QString &password);
@ -219,6 +219,6 @@ class FeedsModelFeed : public FeedsModelRootItem {
QString m_url;
};
Q_DECLARE_METATYPE(FeedsModelFeed::Type)
Q_DECLARE_METATYPE(Feed::Type)
#endif // FEEDSMODELFEED_H

View File

@ -17,7 +17,7 @@
#include "core/feeddownloader.h"
#include "core/feedsmodelfeed.h"
#include "core/feed.h"
#include "definitions/definitions.h"
#include <QThread>
@ -32,7 +32,7 @@ FeedDownloader::~FeedDownloader() {
qDebug("Destroying FeedDownloader instance.");
}
void FeedDownloader::updateFeeds(const QList<FeedsModelFeed*> &feeds) {
void FeedDownloader::updateFeeds(const QList<Feed*> &feeds) {
qDebug().nospace() << "Performing feed updates in thread: \'" << QThread::currentThreadId() << "\'.";
// Job starts now.

View File

@ -23,7 +23,7 @@
#include <QPair>
class FeedsModelFeed;
class Feed;
// Represents results of batch feed updates.
struct FeedDownloadResults {
@ -55,7 +55,7 @@ class FeedDownloader : public QObject {
// New messages are downloaded for each feed and they
// are stored persistently in the database.
// Appropriate signals are emitted.
void updateFeeds(const QList<FeedsModelFeed*> &feeds);
void updateFeeds(const QList<Feed*> &feeds);
signals:
// Emitted if feed updates started.
@ -69,7 +69,7 @@ class FeedDownloader : public QObject {
// "Current" number indicates count of processed feeds
// and "total" number indicates total number of feeds
// which were in the initial queue.
void progress(FeedsModelFeed *feed, int current, int total);
void progress(Feed *feed, int current, int total);
};
#endif // FEEDDOWNLOADER_H

View File

@ -17,8 +17,8 @@
#include "core/feedsimportexportmodel.h"
#include "core/feedsmodelfeed.h"
#include "core/feedsmodelcategory.h"
#include "core/feed.h"
#include "core/category.h"
#include "definitions/definitions.h"
#include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h"
@ -31,7 +31,7 @@
FeedsImportExportModel::FeedsImportExportModel(QObject *parent)
: QAbstractItemModel(parent), m_checkStates(QHash<FeedsModelRootItem*, Qt::CheckState>()),
: QAbstractItemModel(parent), m_checkStates(QHash<RootItem*, Qt::CheckState>()),
m_rootItem(NULL), m_recursiveChange(false), m_mode(Import) {
}
@ -43,20 +43,20 @@ FeedsImportExportModel::~FeedsImportExportModel() {
}
}
FeedsModelRootItem *FeedsImportExportModel::itemForIndex(const QModelIndex &index) const {
RootItem *FeedsImportExportModel::itemForIndex(const QModelIndex &index) const {
if (index.isValid() && index.model() == this) {
return static_cast<FeedsModelRootItem*>(index.internalPointer());
return static_cast<RootItem*>(index.internalPointer());
}
else {
return m_rootItem;
}
}
FeedsModelRootItem *FeedsImportExportModel::rootItem() const {
RootItem *FeedsImportExportModel::rootItem() const {
return m_rootItem;
}
void FeedsImportExportModel::setRootItem(FeedsModelRootItem *rootItem) {
void FeedsImportExportModel::setRootItem(RootItem *rootItem) {
m_rootItem = rootItem;
}
@ -85,21 +85,21 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
opml_document.documentElement().appendChild(elem_opml_head);
QDomElement elem_opml_body = opml_document.createElement(QSL("body"));
QStack<FeedsModelRootItem*> items_to_process; items_to_process.push(m_rootItem);
QStack<RootItem*> items_to_process; items_to_process.push(m_rootItem);
QStack<QDomElement> elements_to_use; elements_to_use.push(elem_opml_body);
// Process all unprocessed nodes.
while (!items_to_process.isEmpty()) {
QDomElement active_element = elements_to_use.pop();
FeedsModelRootItem *active_item = items_to_process.pop();
RootItem *active_item = items_to_process.pop();
foreach (FeedsModelRootItem *child_item, active_item->childItems()) {
foreach (RootItem *child_item, active_item->childItems()) {
if (!m_checkStates.contains(child_item) || m_checkStates[child_item] != Qt::Checked) {
continue;
}
switch (child_item->kind()) {
case FeedsModelRootItem::Category: {
case RootItem::Cattegory: {
QDomElement outline_category = opml_document.createElement(QSL("outline"));
outline_category.setAttribute(QSL("text"), child_item->title());
outline_category.setAttribute(QSL("description"), child_item->description());
@ -110,8 +110,8 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
break;
}
case FeedsModelRootItem::Feed: {
FeedsModelFeed *child_feed = child_item->toFeed();
case RootItem::Feeed: {
Feed *child_feed = child_item->toFeed();
QDomElement outline_feed = opml_document.createElement("outline");
outline_feed.setAttribute(QSL("text"), child_feed->title());
outline_feed.setAttribute(QSL("xmlUrl"), child_feed->url());
@ -121,16 +121,16 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
outline_feed.setAttribute(QSL("rssguard:icon"), QString(qApp->icons()->toByteArray(child_feed->icon())));
switch (child_feed->type()) {
case FeedsModelFeed::Rss0X:
case FeedsModelFeed::Rss2X:
case Feed::Rss0X:
case Feed::Rss2X:
outline_feed.setAttribute(QSL("version"), QSL("RSS"));
break;
case FeedsModelFeed::Rdf:
case Feed::Rdf:
outline_feed.setAttribute(QSL("version"), QSL("RSS1"));
break;
case FeedsModelFeed::Atom10:
case Feed::Atom10:
outline_feed.setAttribute(QSL("version"), QSL("ATOM"));
break;
@ -166,12 +166,12 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
return false;
}
FeedsModelRootItem *root_item = new FeedsModelRootItem();
QStack<FeedsModelRootItem*> model_items; model_items.push(root_item);
RootItem *root_item = new RootItem();
QStack<RootItem*> model_items; model_items.push(root_item);
QStack<QDomElement> elements_to_process; elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
while (!elements_to_process.isEmpty()) {
FeedsModelRootItem *active_model_item = model_items.pop();
RootItem *active_model_item = model_items.pop();
QDomElement active_element = elements_to_process.pop();
for (int i = 0; i < active_element.childNodes().size(); i++) {
@ -192,23 +192,23 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
QString feed_description = child_element.attribute(QSL("description"));
QIcon feed_icon = qApp->icons()->fromByteArray(child_element.attribute(QSL("rssguard:icon")).toLocal8Bit());
FeedsModelFeed *new_feed = new FeedsModelFeed(active_model_item);
Feed *new_feed = new Feed(active_model_item);
new_feed->setTitle(feed_title);
new_feed->setDescription(feed_description);
new_feed->setEncoding(feed_encoding);
new_feed->setUrl(feed_url);
new_feed->setCreationDate(QDateTime::currentDateTime());
new_feed->setIcon(feed_icon.isNull() ? qApp->icons()->fromTheme(QSL("folder-feed")) : feed_icon);
new_feed->setAutoUpdateType(FeedsModelFeed::DefaultAutoUpdate);
new_feed->setAutoUpdateType(Feed::DefaultAutoUpdate);
if (feed_type == QL1S("RSS1")) {
new_feed->setType(FeedsModelFeed::Rdf);
new_feed->setType(Feed::Rdf);
}
else if (feed_type == QL1S("ATOM")) {
new_feed->setType(FeedsModelFeed::Atom10);
new_feed->setType(Feed::Atom10);
}
else {
new_feed->setType(FeedsModelFeed::Rss2X);
new_feed->setType(Feed::Rss2X);
}
active_model_item->appendChild(new_feed);
@ -230,7 +230,7 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
}
}
FeedsModelCategory *new_category = new FeedsModelCategory(active_model_item);
Category *new_category = new Category(active_model_item);
new_category->setTitle(category_title);
new_category->setIcon(category_icon.isNull() ? qApp->icons()->fromTheme(QSL("folder-category")) : category_icon);
new_category->setCreationDate(QDateTime::currentDateTime());
@ -263,16 +263,16 @@ void FeedsImportExportModel::setMode(const FeedsImportExportModel::Mode &mode) {
}
void FeedsImportExportModel::checkAllItems() {
foreach (FeedsModelRootItem *root_child, m_rootItem->childItems()) {
if (root_child->kind() != FeedsModelRootItem::RecycleBin) {
foreach (RootItem *root_child, m_rootItem->childItems()) {
if (root_child->kind() != RootItem::Bin) {
setData(indexForItem(root_child), Qt::Checked, Qt::CheckStateRole);
}
}
}
void FeedsImportExportModel::uncheckAllItems() {
foreach (FeedsModelRootItem *root_child, m_rootItem->childItems()) {
if (root_child->kind() != FeedsModelRootItem::RecycleBin) {
foreach (RootItem *root_child, m_rootItem->childItems()) {
if (root_child->kind() != RootItem::Bin) {
setData(indexForItem(root_child), Qt::Unchecked, Qt::CheckStateRole);
}
}
@ -283,8 +283,8 @@ QModelIndex FeedsImportExportModel::index(int row, int column, const QModelIndex
return QModelIndex();
}
FeedsModelRootItem *parent_item = itemForIndex(parent);
FeedsModelRootItem *child_item = parent_item->child(row);
RootItem *parent_item = itemForIndex(parent);
RootItem *child_item = parent_item->child(row);
if (child_item) {
return createIndex(row, column, child_item);
@ -294,8 +294,8 @@ QModelIndex FeedsImportExportModel::index(int row, int column, const QModelIndex
}
}
QModelIndex FeedsImportExportModel::indexForItem(FeedsModelRootItem *item) const {
if (item == NULL || item->kind() == FeedsModelRootItem::RootItem) {
QModelIndex FeedsImportExportModel::indexForItem(RootItem *item) const {
if (item == NULL || item->kind() == RootItem::Root) {
// Root item lies on invalid index.
return QModelIndex();
}
@ -312,7 +312,7 @@ QModelIndex FeedsImportExportModel::indexForItem(FeedsModelRootItem *item) const
if (row_count > 0) {
// This index has children.
// Lets take a look if our target item is among them.
FeedsModelRootItem *active_item = itemForIndex(active_index);
RootItem *active_item = itemForIndex(active_index);
int candidate_index = active_item->childItems().indexOf(item);
if (candidate_index >= 0) {
@ -322,9 +322,9 @@ QModelIndex FeedsImportExportModel::indexForItem(FeedsModelRootItem *item) const
else {
// Item is not found, add all "categories" from active_item.
for (int i = 0; i < row_count; i++) {
FeedsModelRootItem *possible_category = active_item->child(i);
RootItem *possible_category = active_item->child(i);
if (possible_category->kind() == FeedsModelRootItem::Category) {
if (possible_category->kind() == RootItem::Cattegory) {
parents << index(i, 0, active_index);
}
}
@ -340,8 +340,8 @@ QModelIndex FeedsImportExportModel::parent(const QModelIndex &child) const {
return QModelIndex();
}
FeedsModelRootItem *child_item = itemForIndex(child);
FeedsModelRootItem *parent_item = child_item->parent();
RootItem *child_item = itemForIndex(child);
RootItem *parent_item = child_item->parent();
if (parent_item == m_rootItem) {
return QModelIndex();
@ -371,7 +371,7 @@ QVariant FeedsImportExportModel::data(const QModelIndex &index, int role) const
return QVariant();
}
FeedsModelRootItem *item = itemForIndex(index);
RootItem *item = itemForIndex(index);
if (role == Qt::CheckStateRole) {
if (m_checkStates.contains(item)) {
@ -383,9 +383,9 @@ QVariant FeedsImportExportModel::data(const QModelIndex &index, int role) const
}
else if (role == Qt::DecorationRole) {
switch (item->kind()) {
case FeedsModelRootItem::Category:
case FeedsModelRootItem::RecycleBin:
case FeedsModelRootItem::Feed:
case RootItem::Cattegory:
case RootItem::Bin:
case RootItem::Feeed:
return item->icon();
default:
@ -394,10 +394,10 @@ QVariant FeedsImportExportModel::data(const QModelIndex &index, int role) const
}
else if (role == Qt::DisplayRole) {
switch (item->kind()) {
case FeedsModelRootItem::Category:
case RootItem::Cattegory:
return QVariant(item->data(index.column(), role).toString() + tr(" (category)"));
case FeedsModelRootItem::Feed:
case RootItem::Feeed:
return QVariant(item->data(index.column(), role).toString() + tr(" (feed)"));
default:
@ -411,7 +411,7 @@ QVariant FeedsImportExportModel::data(const QModelIndex &index, int role) const
bool FeedsImportExportModel::setData(const QModelIndex &index, const QVariant &value, int role) {
if (index.isValid() && index.column() == 0 && role == Qt::CheckStateRole) {
FeedsModelRootItem *item = itemForIndex(index);
RootItem *item = itemForIndex(index);
if (item == m_rootItem) {
// Cannot set data on root item.
@ -427,7 +427,7 @@ bool FeedsImportExportModel::setData(const QModelIndex &index, const QVariant &v
}
// Set new data for all descendants of this actual item.
foreach(FeedsModelRootItem *child, item->childItems()) {
foreach(RootItem *child, item->childItems()) {
setData(indexForItem(child), value, Qt::CheckStateRole);
}
@ -442,7 +442,7 @@ bool FeedsImportExportModel::setData(const QModelIndex &index, const QVariant &v
// Check children of this new parent item.
Qt::CheckState parent_state = Qt::Unchecked;
foreach (FeedsModelRootItem *child_of_parent, item->childItems()) {
foreach (RootItem *child_of_parent, item->childItems()) {
if (m_checkStates.contains(child_of_parent) && m_checkStates[child_of_parent] == Qt::Checked) {
// We found out, that some child of this item is checked,
// therefore this item must be checked too.
@ -462,7 +462,7 @@ bool FeedsImportExportModel::setData(const QModelIndex &index, const QVariant &v
}
Qt::ItemFlags FeedsImportExportModel::flags(const QModelIndex &index) const {
if (!index.isValid() || itemForIndex(index)->kind() == FeedsModelRootItem::RecycleBin) {
if (!index.isValid() || itemForIndex(index)->kind() == RootItem::Bin) {
return Qt::NoItemFlags;
}
@ -475,6 +475,6 @@ Qt::ItemFlags FeedsImportExportModel::flags(const QModelIndex &index) const {
return flags;
}
bool FeedsImportExportModel::isItemChecked(FeedsModelRootItem *item) {
bool FeedsImportExportModel::isItemChecked(RootItem *item) {
return m_checkStates.contains(item) && m_checkStates.value(item, Qt::Unchecked);
}

View File

@ -20,7 +20,7 @@
#include <QAbstractItemModel>
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
class FeedsImportExportModel : public QAbstractItemModel {
@ -44,18 +44,18 @@ class FeedsImportExportModel : public QAbstractItemModel {
bool setData(const QModelIndex &index, const QVariant &value, int role);
Qt::ItemFlags flags(const QModelIndex &index) const;
bool isItemChecked(FeedsModelRootItem *item);
bool isItemChecked(RootItem *item);
// Returns feed/category which lies at the specified index or
// root item if index is invalid.
FeedsModelRootItem *itemForIndex(const QModelIndex &index) const;
RootItem *itemForIndex(const QModelIndex &index) const;
// Returns source QModelIndex on which lies given item.
QModelIndex indexForItem(FeedsModelRootItem *item) const;
QModelIndex indexForItem(RootItem *item) const;
// Root item manipulators.
FeedsModelRootItem *rootItem() const;
void setRootItem(FeedsModelRootItem *rootItem);
RootItem *rootItem() const;
void setRootItem(RootItem *rootItem);
// Exports to OPML 2.0
// NOTE: http://dev.opml.org/spec2.html
@ -70,8 +70,8 @@ class FeedsImportExportModel : public QAbstractItemModel {
void uncheckAllItems();
private:
QHash<FeedsModelRootItem*, Qt::CheckState> m_checkStates;
FeedsModelRootItem *m_rootItem;
QHash<RootItem*, Qt::CheckState> m_checkStates;
RootItem *m_rootItem;
// When it's true, then
bool m_recursiveChange;

View File

@ -18,9 +18,9 @@
#include "core/feedsmodel.h"
#include "definitions/definitions.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "core/feedsmodelrecyclebin.h"
#include "core/category.h"
#include "core/feed.h"
#include "core/recyclebin.h"
#include "core/feedsimportexportmodel.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/databasefactory.h"
@ -38,11 +38,11 @@
FeedsModel::FeedsModel(QObject *parent)
: QAbstractItemModel(parent), m_recycleBin(new FeedsModelRecycleBin()) {
: QAbstractItemModel(parent), m_recycleBin(new RecycleBin()) {
setObjectName(QSL("FeedsModel"));
// Create root item.
m_rootItem = new FeedsModelRootItem();
m_rootItem = new RootItem();
m_rootItem->setId(NO_PARENT_CATEGORY);
//: Name of root item of feed list which can be seen in feed add/edit dialog.
@ -78,9 +78,9 @@ QMimeData *FeedsModel::mimeData(const QModelIndexList &indexes) const {
continue;
}
FeedsModelRootItem *item_for_index = itemForIndex(index);
RootItem *item_for_index = itemForIndex(index);
if (item_for_index->kind() != FeedsModelRootItem::RootItem) {
if (item_for_index->kind() != RootItem::Root) {
stream << (quintptr) item_for_index;
}
}
@ -117,30 +117,30 @@ bool FeedsModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
stream >> pointer_to_item;
// We have item we want to drag, we also determine the target item.
FeedsModelRootItem *dragged_item = (FeedsModelRootItem*) pointer_to_item;
FeedsModelRootItem *target_item = itemForIndex(parent);
RootItem *dragged_item = (RootItem*) pointer_to_item;
RootItem *target_item = itemForIndex(parent);
if (dragged_item == target_item || dragged_item->parent() == target_item) {
qDebug("Dragged item is equal to target item or its parent is equal to target item. Cancelling drag-drop action.");
return false;
}
if (dragged_item->kind() == FeedsModelRootItem::Feed) {
if (dragged_item->kind() == RootItem::Feeed) {
qDebug("Drag-drop action for feed '%s' detected, editing the feed.", qPrintable(dragged_item->title()));
FeedsModelFeed *actual_feed = dragged_item->toFeed();
FeedsModelFeed *feed_new = new FeedsModelFeed(*actual_feed);
Feed *actual_feed = dragged_item->toFeed();
Feed *feed_new = new Feed(*actual_feed);
feed_new->setParent(target_item);
editFeed(actual_feed, feed_new);
emit requireItemValidationAfterDragDrop(indexForItem(actual_feed));
}
else if (dragged_item->kind() == FeedsModelRootItem::Category) {
else if (dragged_item->kind() == RootItem::Cattegory) {
qDebug("Drag-drop action for category '%s' detected, editing the feed.", qPrintable(dragged_item->title()));
FeedsModelCategory *actual_category = dragged_item->toCategory();
FeedsModelCategory *category_new = new FeedsModelCategory(*actual_category);
Category *actual_category = dragged_item->toCategory();
Category *category_new = new Category(*actual_category);
category_new->clearChildren();
category_new->setParent(target_item);
@ -160,19 +160,19 @@ Qt::DropActions FeedsModel::supportedDropActions() const {
Qt::ItemFlags FeedsModel::flags(const QModelIndex &index) const {
Qt::ItemFlags base_flags = QAbstractItemModel::flags(index);
FeedsModelRootItem *item_for_index = itemForIndex(index);
RootItem *item_for_index = itemForIndex(index);
switch (item_for_index->kind()) {
case FeedsModelRootItem::RecycleBin:
case RootItem::Bin:
return base_flags;
case FeedsModelRootItem::Category:
case RootItem::Cattegory:
return base_flags | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
case FeedsModelRootItem::Feed:
case RootItem::Feeed:
return base_flags | Qt::ItemIsDragEnabled;
case FeedsModelRootItem::RootItem:
case RootItem::Root:
default:
return base_flags | Qt::ItemIsDropEnabled;
}
@ -213,8 +213,8 @@ QModelIndex FeedsModel::index(int row, int column, const QModelIndex &parent) co
return QModelIndex();
}
FeedsModelRootItem *parent_item = itemForIndex(parent);
FeedsModelRootItem *child_item = parent_item->child(row);
RootItem *parent_item = itemForIndex(parent);
RootItem *child_item = parent_item->child(row);
if (child_item) {
return createIndex(row, column, child_item);
@ -229,8 +229,8 @@ QModelIndex FeedsModel::parent(const QModelIndex &child) const {
return QModelIndex();
}
FeedsModelRootItem *child_item = itemForIndex(child);
FeedsModelRootItem *parent_item = child_item->parent();
RootItem *child_item = itemForIndex(child);
RootItem *parent_item = child_item->parent();
if (parent_item == m_rootItem) {
return QModelIndex();
@ -252,8 +252,8 @@ int FeedsModel::rowCount(const QModelIndex &parent) const {
bool FeedsModel::removeItem(const QModelIndex &index) {
if (index.isValid()) {
QModelIndex parent_index = index.parent();
FeedsModelRootItem *deleting_item = itemForIndex(index);
FeedsModelRootItem *parent_item = deleting_item->parent();
RootItem *deleting_item = itemForIndex(index);
RootItem *parent_item = deleting_item->parent();
// Try to persistently remove the item.
if (deleting_item->removeItself()) {
@ -272,7 +272,7 @@ bool FeedsModel::removeItem(const QModelIndex &index) {
return false;
}
bool FeedsModel::addCategory(FeedsModelCategory *category, FeedsModelRootItem *parent) {
bool FeedsModel::addCategory(Category *category, RootItem *parent) {
// Get index of parent item (parent standard category).
QModelIndex parent_index = indexForItem(parent);
bool result = category->addItself(parent);
@ -292,9 +292,9 @@ bool FeedsModel::addCategory(FeedsModelCategory *category, FeedsModelRootItem *p
return result;
}
bool FeedsModel::editCategory(FeedsModelCategory *original_category, FeedsModelCategory *new_category_data) {
FeedsModelRootItem *original_parent = original_category->parent();
FeedsModelRootItem *new_parent = new_category_data->parent();
bool FeedsModel::editCategory(Category *original_category, Category *new_category_data) {
RootItem *original_parent = original_category->parent();
RootItem *new_parent = new_category_data->parent();
bool result = original_category->editItself(new_category_data);
if (result && original_parent != new_parent) {
@ -319,7 +319,7 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category, FeedsModelC
return result;
}
bool FeedsModel::addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent) {
bool FeedsModel::addFeed(Feed *feed, RootItem *parent) {
// Get index of parent item (parent standard category or root item).
QModelIndex parent_index = indexForItem(parent);
bool result = feed->addItself(parent);
@ -337,9 +337,9 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent) {
return result;
}
bool FeedsModel::editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_feed_data) {
FeedsModelRootItem *original_parent = original_feed->parent();
FeedsModelRootItem *new_parent = new_feed_data->parent();
bool FeedsModel::editFeed(Feed *original_feed, Feed *new_feed_data) {
RootItem *original_parent = original_feed->parent();
RootItem *new_parent = new_feed_data->parent();
bool result = original_feed->editItself(new_feed_data);
if (result && original_parent != new_parent) {
@ -363,23 +363,23 @@ bool FeedsModel::editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_fee
return result;
}
QList<FeedsModelFeed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
QList<FeedsModelFeed*> feeds_for_update;
QList<Feed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
QList<Feed*> feeds_for_update;
foreach (FeedsModelFeed *feed, allFeeds()) {
foreach (Feed *feed, allFeeds()) {
switch (feed->autoUpdateType()) {
case FeedsModelFeed::DontAutoUpdate:
case Feed::DontAutoUpdate:
// Do not auto-update this feed ever.
continue;
case FeedsModelFeed::DefaultAutoUpdate:
case Feed::DefaultAutoUpdate:
if (auto_update_now) {
feeds_for_update.append(feed);
}
break;
case FeedsModelFeed::SpecificAutoUpdate:
case Feed::SpecificAutoUpdate:
default:
int remaining_interval = feed->autoUpdateRemainingInterval();
@ -402,7 +402,7 @@ QList<FeedsModelFeed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now)
return feeds_for_update;
}
QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds) {
QList<Message> FeedsModel::messagesForFeeds(const QList<Feed*> &feeds) {
QList<Message> messages;
QSqlDatabase database = qApp->database()->connection(objectName(),
@ -413,7 +413,7 @@ QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds)
"FROM Messages "
"WHERE is_deleted = 0 AND feed = :feed;");
foreach (FeedsModelFeed *feed, feeds) {
foreach (Feed *feed, feeds) {
query_read_msg.bindValue(QSL(":feed"), feed->id());
if (query_read_msg.exec()) {
@ -441,19 +441,19 @@ int FeedsModel::columnCount(const QModelIndex &parent) const {
return FEEDS_VIEW_COLUMN_COUNT;
}
FeedsModelRootItem *FeedsModel::itemForIndex(const QModelIndex &index) const {
RootItem *FeedsModel::itemForIndex(const QModelIndex &index) const {
if (index.isValid() && index.model() == this) {
return static_cast<FeedsModelRootItem*>(index.internalPointer());
return static_cast<RootItem*>(index.internalPointer());
}
else {
return m_rootItem;
}
}
FeedsModelCategory *FeedsModel::categoryForIndex(const QModelIndex &index) const {
FeedsModelRootItem *item = itemForIndex(index);
Category *FeedsModel::categoryForIndex(const QModelIndex &index) const {
RootItem *item = itemForIndex(index);
if (item->kind() == FeedsModelRootItem::Category) {
if (item->kind() == RootItem::Cattegory) {
return item->toCategory();
}
else {
@ -461,10 +461,10 @@ FeedsModelCategory *FeedsModel::categoryForIndex(const QModelIndex &index) const
}
}
FeedsModelRecycleBin *FeedsModel::recycleBinForIndex(const QModelIndex &index) const {
FeedsModelRootItem *item = itemForIndex(index);
RecycleBin *FeedsModel::recycleBinForIndex(const QModelIndex &index) const {
RootItem *item = itemForIndex(index);
if (item->kind() == FeedsModelRootItem::RecycleBin) {
if (item->kind() == RootItem::Bin) {
return item->toRecycleBin();
}
else {
@ -472,15 +472,15 @@ FeedsModelRecycleBin *FeedsModel::recycleBinForIndex(const QModelIndex &index) c
}
}
QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
if (item == NULL || item->kind() == FeedsModelRootItem::RootItem) {
QModelIndex FeedsModel::indexForItem(RootItem *item) const {
if (item == NULL || item->kind() == RootItem::Root) {
// Root item lies on invalid index.
return QModelIndex();
}
QStack<FeedsModelRootItem*> chain;
QStack<RootItem*> chain;
while (item->kind() != FeedsModelRootItem::RootItem) {
while (item->kind() != RootItem::Root) {
chain.push(item);
item = item->parent();
}
@ -490,7 +490,7 @@ QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
// We go through the stack and create our target index.
while (!chain.isEmpty()) {
FeedsModelRootItem *parent_item = chain.pop();
RootItem *parent_item = chain.pop();
target_index = index(parent_item->parent()->childItems().indexOf(parent_item), 0, target_index);
}
@ -498,8 +498,8 @@ QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
}
bool FeedsModel::hasAnyFeedNewMessages() {
foreach (const FeedsModelFeed *feed, allFeeds()) {
if (feed->status() == FeedsModelFeed::NewMessages) {
foreach (const Feed *feed, allFeeds()) {
if (feed->status() == Feed::NewMessages) {
return true;
}
}
@ -514,8 +514,8 @@ bool FeedsModel::mergeModel(FeedsImportExportModel *model, QString &output_messa
return false;
}
QStack<FeedsModelRootItem*> original_parents; original_parents.push(m_rootItem);
QStack<FeedsModelRootItem*> new_parents; new_parents.push(model->rootItem());
QStack<RootItem*> original_parents; original_parents.push(m_rootItem);
QStack<RootItem*> new_parents; new_parents.push(model->rootItem());
bool some_feed_category_error = false;
// We are definitely about to add some new items into the model.
@ -523,19 +523,19 @@ bool FeedsModel::mergeModel(FeedsImportExportModel *model, QString &output_messa
// Iterate all new items we would like to merge into current model.
while (!new_parents.isEmpty()) {
FeedsModelRootItem *target_parent = original_parents.pop();
FeedsModelRootItem *source_parent = new_parents.pop();
RootItem *target_parent = original_parents.pop();
RootItem *source_parent = new_parents.pop();
foreach (FeedsModelRootItem *source_item, source_parent->childItems()) {
foreach (RootItem *source_item, source_parent->childItems()) {
if (!model->isItemChecked(source_item)) {
// We can skip this item, because it is not checked and should not be imported.
// NOTE: All descendants are thus skipped too.
continue;
}
if (source_item->kind() == FeedsModelRootItem::Category) {
FeedsModelCategory *source_category = source_item->toCategory();
FeedsModelCategory *new_category = new FeedsModelCategory(*source_category);
if (source_item->kind() == RootItem::Cattegory) {
Category *source_category = source_item->toCategory();
Category *new_category = new Category(*source_category);
// Add category to model.
new_category->clearChildren();
@ -549,7 +549,7 @@ bool FeedsModel::mergeModel(FeedsImportExportModel *model, QString &output_messa
// Add category failed, but this can mean that the same category (with same title)
// already exists. If such a category exists in current parent, then find it and
// add descendants to it.
FeedsModelRootItem *existing_category = target_parent->child(FeedsModelRootItem::Category, new_category->title());
RootItem *existing_category = target_parent->child(RootItem::Cattegory, new_category->title());
if (existing_category != NULL) {
original_parents.push(existing_category);
@ -560,9 +560,9 @@ bool FeedsModel::mergeModel(FeedsImportExportModel *model, QString &output_messa
}
}
}
else if (source_item->kind() == FeedsModelRootItem::Feed) {
FeedsModelFeed *source_feed = source_item->toFeed();
FeedsModelFeed *new_feed = new FeedsModelFeed(*source_feed);
else if (source_item->kind() == RootItem::Feeed) {
Feed *source_feed = source_item->toFeed();
Feed *new_feed = new Feed(*source_feed);
// Append this feed and end this iteration.
if (!addFeed(new_feed, target_parent)) {
@ -595,11 +595,11 @@ void FeedsModel::reloadChangedLayout(QModelIndexList list) {
}
}
QStringList FeedsModel::textualFeedIds(const QList<FeedsModelFeed*> &feeds) {
QStringList FeedsModel::textualFeedIds(const QList<Feed*> &feeds) {
QStringList stringy_ids;
stringy_ids.reserve(feeds.size());
foreach (FeedsModelFeed *feed, feeds) {
foreach (Feed *feed, feeds) {
stringy_ids.append(QString::number(feed->id()));
}
@ -632,7 +632,7 @@ void FeedsModel::loadFromDatabase() {
while (query_categories.next()) {
CategoryAssignmentItem pair;
pair.first = query_categories.value(CAT_DB_PARENT_ID_INDEX).toInt();
pair.second = new FeedsModelCategory(query_categories.record());
pair.second = new Category(query_categories.record());
categories << pair;
}
@ -648,16 +648,16 @@ void FeedsModel::loadFromDatabase() {
while (query_feeds.next()) {
// Process this feed.
FeedsModelFeed::Type type = static_cast<FeedsModelFeed::Type>(query_feeds.value(FDS_DB_TYPE_INDEX).toInt());
Feed::Type type = static_cast<Feed::Type>(query_feeds.value(FDS_DB_TYPE_INDEX).toInt());
switch (type) {
case FeedsModelFeed::Atom10:
case FeedsModelFeed::Rdf:
case FeedsModelFeed::Rss0X:
case FeedsModelFeed::Rss2X: {
case Feed::Atom10:
case Feed::Rdf:
case Feed::Rss0X:
case Feed::Rss2X: {
FeedAssignmentItem pair;
pair.first = query_feeds.value(FDS_DB_CATEGORY_INDEX).toInt();
pair.second = new FeedsModelFeed(query_feeds.record());
pair.second = new Feed(query_feeds.record());
pair.second->setType(type);
feeds << pair;
@ -677,15 +677,15 @@ void FeedsModel::loadFromDatabase() {
m_rootItem->appendChild(m_recycleBin);
}
QList<FeedsModelFeed*> FeedsModel::feedsForIndex(const QModelIndex &index) {
FeedsModelRootItem *item = itemForIndex(index);
QList<Feed*> FeedsModel::feedsForIndex(const QModelIndex &index) {
RootItem *item = itemForIndex(index);
return feedsForItem(item);
}
FeedsModelFeed *FeedsModel::feedForIndex(const QModelIndex &index) {
FeedsModelRootItem *item = itemForIndex(index);
Feed *FeedsModel::feedForIndex(const QModelIndex &index) {
RootItem *item = itemForIndex(index);
if (item->kind() == FeedsModelRootItem::Feed) {
if (item->kind() == RootItem::Feeed) {
return item->toFeed();
}
else {
@ -693,8 +693,8 @@ FeedsModelFeed *FeedsModel::feedForIndex(const QModelIndex &index) {
}
}
QList<FeedsModelFeed*> FeedsModel::feedsForIndexes(const QModelIndexList &indexes) {
QList<FeedsModelFeed*> feeds;
QList<Feed*> FeedsModel::feedsForIndexes(const QModelIndexList &indexes) {
QList<Feed*> feeds;
// Get selected feeds for each index.
foreach (const QModelIndex &index, indexes) {
@ -706,14 +706,14 @@ QList<FeedsModelFeed*> FeedsModel::feedsForIndexes(const QModelIndexList &indexe
// Selection contains duplicate feeds (for
// example situation where feed and its parent category are both
// selected). So, remove duplicates from the list.
qSort(feeds.begin(), feeds.end(), FeedsModelRootItem::lessThan);
feeds.erase(std::unique(feeds.begin(), feeds.end(), FeedsModelRootItem::isEqual), feeds.end());
qSort(feeds.begin(), feeds.end(), RootItem::lessThan);
feeds.erase(std::unique(feeds.begin(), feeds.end(), RootItem::isEqual), feeds.end());
}
return feeds;
}
bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read) {
bool FeedsModel::markFeedsRead(const QList<Feed*> &feeds, int read) {
QSqlDatabase db_handle = qApp->database()->connection(objectName(), DatabaseFactory::FromSettings);
if (!db_handle.transaction()) {
@ -748,7 +748,7 @@ bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read) {
}
}
bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int deleted, bool read_only) {
bool FeedsModel::markFeedsDeleted(const QList<Feed*> &feeds, int deleted, bool read_only) {
QSqlDatabase db_handle = qApp->database()->connection(objectName(), DatabaseFactory::FromSettings);
if (!db_handle.transaction()) {
@ -794,24 +794,24 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
}
}
QHash<int, FeedsModelCategory*> FeedsModel::allCategories() {
QHash<int, Category*> FeedsModel::allCategories() {
return categoriesForItem(m_rootItem);
}
QHash<int, FeedsModelCategory*> FeedsModel::categoriesForItem(FeedsModelRootItem *root) {
QHash<int, FeedsModelCategory*> categories;
QList<FeedsModelRootItem*> parents;
QHash<int, Category*> FeedsModel::categoriesForItem(RootItem *root) {
QHash<int, Category*> categories;
QList<RootItem*> parents;
parents.append(root->childItems());
while (!parents.isEmpty()) {
FeedsModelRootItem *item = parents.takeFirst();
RootItem *item = parents.takeFirst();
if (item->kind() == FeedsModelRootItem::Category) {
if (item->kind() == RootItem::Cattegory) {
// This item is category, add it to the output list and
// scan its children.
int category_id = item->id();
FeedsModelCategory *category = item->toCategory();
Category *category = item->toCategory();
if (!categories.contains(category_id)) {
categories.insert(category_id, category);
@ -824,16 +824,16 @@ QHash<int, FeedsModelCategory*> FeedsModel::categoriesForItem(FeedsModelRootItem
return categories;
}
QList<FeedsModelFeed*> FeedsModel::allFeeds() {
QList<Feed*> FeedsModel::allFeeds() {
return feedsForItem(m_rootItem);
}
QList<FeedsModelFeed*> FeedsModel::feedsForItem(FeedsModelRootItem *root) {
QList<FeedsModelRootItem*> children = root->getRecursiveChildren();
QList<FeedsModelFeed*> feeds;
QList<Feed*> FeedsModel::feedsForItem(RootItem *root) {
QList<RootItem*> children = root->getRecursiveChildren();
QList<Feed*> feeds;
foreach (FeedsModelRootItem *child, children) {
if (child->kind() == FeedsModelRootItem::Feed) {
foreach (RootItem *child, children) {
if (child->kind() == RootItem::Feeed) {
feeds.append(child->toFeed());
}
}
@ -842,7 +842,7 @@ QList<FeedsModelFeed*> FeedsModel::feedsForItem(FeedsModelRootItem *root) {
}
void FeedsModel::assembleFeeds(FeedAssignment feeds) {
QHash<int, FeedsModelCategory*> categories = allCategories();
QHash<int, Category*> categories = allCategories();
foreach (const FeedAssignmentItem &feed, feeds) {
if (feed.first == NO_PARENT_CATEGORY) {
@ -859,12 +859,12 @@ void FeedsModel::assembleFeeds(FeedAssignment feeds) {
}
}
FeedsModelRecycleBin *FeedsModel::recycleBin() const {
RecycleBin *FeedsModel::recycleBin() const {
return m_recycleBin;
}
void FeedsModel::assembleCategories(CategoryAssignment categories) {
QHash<int, FeedsModelRootItem*> assignments;
QHash<int, RootItem*> assignments;
assignments.insert(NO_PARENT_CATEGORY, m_rootItem);
// Add top-level categories.

View File

@ -21,27 +21,27 @@
#include <QAbstractItemModel>
#include "core/messagesmodel.h"
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
#include <QIcon>
class FeedsModelCategory;
class FeedsModelFeed;
class FeedsModelRecycleBin;
class Category;
class Feed;
class RecycleBin;
class FeedsImportExportModel;
typedef QList<QPair<int, FeedsModelCategory*> > CategoryAssignment;
typedef QPair<int, FeedsModelCategory*> CategoryAssignmentItem;
typedef QList<QPair<int, Category*> > CategoryAssignment;
typedef QPair<int, Category*> CategoryAssignmentItem;
typedef QList<QPair<int, FeedsModelFeed*> > FeedAssignment;
typedef QPair<int, FeedsModelFeed*> FeedAssignmentItem;
typedef QList<QPair<int, Feed*> > FeedAssignment;
typedef QPair<int, Feed*> FeedAssignmentItem;
class FeedsModel : public QAbstractItemModel {
Q_OBJECT
friend class FeedsModelFeed;
friend class FeedsModelCategory;
friend class Feed;
friend class Category;
public:
// Constructors and destructors.
@ -78,73 +78,73 @@ class FeedsModel : public QAbstractItemModel {
bool removeItem(const QModelIndex &index);
// Standard category manipulators.
bool addCategory(FeedsModelCategory *category, FeedsModelRootItem *parent);
bool editCategory(FeedsModelCategory *original_category, FeedsModelCategory *new_category_data);
bool addCategory(Category *category, RootItem *parent);
bool editCategory(Category *original_category, Category *new_category_data);
// Standard feed manipulators.
bool addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent);
bool addFeed(Feed *feed, RootItem *parent);
// New feed is just temporary feed, it is not added to the model.
// It is used to fetch its data to the original feed
// and the original feed is moved if needed.
bool editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_feed_data);
bool editFeed(Feed *original_feed, Feed *new_feed_data);
// Returns the list of updates which should be updated
// according to auto-update schedule.
// Variable "auto_update_now" is true, when global timeout
// for scheduled auto-update was met so feeds with "default"
// auto-update strategy should be updated.
QList<FeedsModelFeed*> feedsForScheduledUpdate(bool auto_update_now);
QList<Feed*> feedsForScheduledUpdate(bool auto_update_now);
// Returns (undeleted) messages for given feeds.
// This is usually used for displaying whole feeds
// in "newspaper" mode.
QList<Message> messagesForFeeds(const QList<FeedsModelFeed*> &feeds);
QList<Message> messagesForFeeds(const QList<Feed*> &feeds);
// Returns all categories, each pair
// consists of ID of parent item and pointer to category.
QHash<int, FeedsModelCategory*> allCategories();
QHash<int, Category*> allCategories();
// Returns categories from the subtree with given root node, each pair
// consists of ID of parent item and pointer to category.
QHash<int, FeedsModelCategory*> categoriesForItem(FeedsModelRootItem *root);
QHash<int, Category*> categoriesForItem(RootItem *root);
// Returns list of all feeds contained in the model.
QList<FeedsModelFeed*> allFeeds();
QList<Feed*> allFeeds();
// Get list of feeds from tree with particular item
// as root. If root itself is a feed, then it is returned.
QList<FeedsModelFeed*> feedsForItem(FeedsModelRootItem *root);
QList<Feed*> feedsForItem(RootItem *root);
// Returns list of ALL CHILD feeds which belong to given parent indexes.
QList<FeedsModelFeed*> feedsForIndexes(const QModelIndexList &indexes);
QList<Feed*> feedsForIndexes(const QModelIndexList &indexes);
// Returns ALL CHILD feeds contained within single index.
QList<FeedsModelFeed*> feedsForIndex(const QModelIndex &index);
QList<Feed*> feedsForIndex(const QModelIndex &index);
// Returns pointer to feed if it lies on given index
// or NULL if no feed lies on given index.
FeedsModelFeed *feedForIndex(const QModelIndex &index);
Feed *feedForIndex(const QModelIndex &index);
// Returns pointer to category if it lies on given index
// or NULL if no category lies on given index.
FeedsModelCategory *categoryForIndex(const QModelIndex &index) const;
Category *categoryForIndex(const QModelIndex &index) const;
// Returns pointer to recycle bin if lies on given index
// or NULL if no recycle bin lies on given index.
FeedsModelRecycleBin *recycleBinForIndex(const QModelIndex &index) const;
RecycleBin *recycleBinForIndex(const QModelIndex &index) const;
// Returns feed/category which lies at the specified index or
// root item if index is invalid.
FeedsModelRootItem *itemForIndex(const QModelIndex &index) const;
RootItem *itemForIndex(const QModelIndex &index) const;
// Returns source QModelIndex on which lies given item.
QModelIndex indexForItem(FeedsModelRootItem *item) const;
QModelIndex indexForItem(RootItem *item) const;
bool hasAnyFeedNewMessages();
// Access to root item.
inline FeedsModelRootItem *rootItem() const {
inline RootItem *rootItem() const {
return m_rootItem;
}
@ -153,12 +153,12 @@ class FeedsModel : public QAbstractItemModel {
bool mergeModel(FeedsImportExportModel *model, QString &output_message);
// Access to recycle bin.
FeedsModelRecycleBin *recycleBin() const;
RecycleBin *recycleBin() const;
public slots:
// Feeds operations.
bool markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read);
bool markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int deleted, bool read_only);
bool markFeedsRead(const QList<Feed*> &feeds, int read);
bool markFeedsDeleted(const QList<Feed*> &feeds, int deleted, bool read_only);
// Signals that properties (probably counts)
// of ALL items have changed.
@ -172,7 +172,7 @@ class FeedsModel : public QAbstractItemModel {
protected:
// Returns converted ids of given feeds
// which are suitable as IN clause for SQL queries.
QStringList textualFeedIds(const QList<FeedsModelFeed*> &feeds);
QStringList textualFeedIds(const QList<Feed*> &feeds);
// Loads feed/categories from the database.
void loadFromDatabase();
@ -186,8 +186,8 @@ class FeedsModel : public QAbstractItemModel {
void requireItemValidationAfterDragDrop(const QModelIndex &source_index);
private:
FeedsModelRootItem *m_rootItem;
FeedsModelRecycleBin *m_recycleBin;
RootItem *m_rootItem;
RecycleBin *m_recycleBin;
QList<QString> m_headerData;
QList<QString> m_tooltipData;
QIcon m_countsIcon;

View File

@ -19,9 +19,9 @@
#include "definitions/definitions.h"
#include "core/feedsmodel.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "core/feedsmodelrootitem.h"
#include "core/category.h"
#include "core/feed.h"
#include "core/rootitem.h"
FeedsProxyModel::FeedsProxyModel(QObject *parent)
@ -134,8 +134,8 @@ QModelIndexList FeedsProxyModel::match(const QModelIndex &start, int role, const
bool FeedsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const {
if (left.isValid() && right.isValid()) {
// Make necessary castings.
FeedsModelRootItem *left_item = m_sourceModel->itemForIndex(left);
FeedsModelRootItem *right_item = m_sourceModel->itemForIndex(right);
RootItem *left_item = m_sourceModel->itemForIndex(left);
RootItem *right_item = m_sourceModel->itemForIndex(right);
// NOTE: Here we want to accomplish that ALL
// categories are queued one after another and all
@ -154,15 +154,15 @@ bool FeedsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right
return QString::localeAwareCompare(left_item->title(), right_item->title()) < 0;
}
}
else if (left_item->kind() == FeedsModelRootItem::RecycleBin) {
else if (left_item->kind() == RootItem::Bin) {
// Left item is recycle bin. Make sure it is "biggest" item if we have selected ascending order.
return sortOrder() == Qt::DescendingOrder;
}
else if (right_item->kind() == FeedsModelRootItem::RecycleBin) {
else if (right_item->kind() == RootItem::Bin) {
// Right item is recycle bin. Make sure it is "smallest" item if we have selected descending order.
return sortOrder() == Qt::AscendingOrder;
}
else if (left_item->kind() == FeedsModelRootItem::Feed) {
else if (left_item->kind() == RootItem::Feeed) {
// Left item is feed, right item is category.
return false;
}
@ -190,9 +190,9 @@ bool FeedsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source
return false;
}
FeedsModelRootItem *item = m_sourceModel->itemForIndex(idx);
RootItem *item = m_sourceModel->itemForIndex(idx);
if (item->kind() == FeedsModelRootItem::RecycleBin) {
if (item->kind() == RootItem::Bin) {
// Recycle bin is always displayed.
return true;
}
@ -205,11 +205,11 @@ bool FeedsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source
}
}
FeedsModelRootItem *FeedsProxyModel::selectedItem() const {
RootItem *FeedsProxyModel::selectedItem() const {
return m_selectedItem;
}
void FeedsProxyModel::setSelectedItem(FeedsModelRootItem *selected_item) {
void FeedsProxyModel::setSelectedItem(RootItem *selected_item) {
m_selectedItem = selected_item;
}

View File

@ -18,7 +18,7 @@
#ifndef FEEDSPROXYMODEL_H
#define FEEDSPROXYMODEL_H
#include "feedsmodelrootitem.h"
#include "rootitem.h"
#include <QSortFilterProxyModel>
@ -46,8 +46,8 @@ class FeedsProxyModel : public QSortFilterProxyModel {
bool showUnreadOnly() const;
void setShowUnreadOnly(bool show_unread_only);
FeedsModelRootItem *selectedItem() const;
void setSelectedItem(FeedsModelRootItem *selected_item);
RootItem *selectedItem() const;
void setSelectedItem(RootItem *selected_item);
public slots:
void invalidateFilter();
@ -61,7 +61,7 @@ class FeedsProxyModel : public QSortFilterProxyModel {
// Source model pointer.
FeedsModel *m_sourceModel;
FeedsModelRootItem *m_selectedItem;
RootItem *m_selectedItem;
bool m_showUnreadOnly;
};

View File

@ -17,13 +17,13 @@
#include "core/feedsselection.h"
#include "core/feedsmodelrootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "core/rootitem.h"
#include "core/category.h"
#include "core/feed.h"
#include "definitions/definitions.h"
FeedsSelection::FeedsSelection(FeedsModelRootItem *root_of_selection) : m_selectedItem(root_of_selection) {
FeedsSelection::FeedsSelection(RootItem *root_of_selection) : m_selectedItem(root_of_selection) {
}
FeedsSelection::FeedsSelection(const FeedsSelection &other) {
@ -39,11 +39,11 @@ FeedsSelection::SelectionMode FeedsSelection::mode() {
}
switch (m_selectedItem->kind()) {
case FeedsModelRootItem::RecycleBin:
case RootItem::Bin:
return FeedsSelection::MessagesFromRecycleBin;
case FeedsModelRootItem::Category:
case FeedsModelRootItem::Feed:
case RootItem::Cattegory:
case RootItem::Feeed:
return FeedsSelection::MessagesFromFeeds;
default:
@ -51,18 +51,18 @@ FeedsSelection::SelectionMode FeedsSelection::mode() {
}
}
FeedsModelRootItem *FeedsSelection::selectedItem() const {
RootItem *FeedsSelection::selectedItem() const {
return m_selectedItem;
}
QString FeedsSelection::generateListOfIds() {
if (m_selectedItem != NULL &&
(m_selectedItem->kind() == FeedsModelRootItem::Feed || m_selectedItem->kind() == FeedsModelRootItem::Category)) {
QList<FeedsModelRootItem*> children = m_selectedItem->getRecursiveChildren();
(m_selectedItem->kind() == RootItem::Feeed || m_selectedItem->kind() == RootItem::Cattegory)) {
QList<RootItem*> children = m_selectedItem->getRecursiveChildren();
QStringList stringy_ids;
foreach (FeedsModelRootItem *child, children) {
if (child->kind() == FeedsModelRootItem::Feed) {
foreach (RootItem *child, children) {
if (child->kind() == RootItem::Feeed) {
stringy_ids.append(QString::number(child->id()));
}
}

View File

@ -22,8 +22,8 @@
#include <QMetaType>
class FeedsModelRootItem;
class FeedsModelFeed;
class RootItem;
class Feed;
class FeedsSelection {
public:
@ -33,16 +33,16 @@ class FeedsSelection {
MessagesFromRecycleBin
};
explicit FeedsSelection(FeedsModelRootItem *root_of_selection = NULL);
explicit FeedsSelection(RootItem *root_of_selection = NULL);
FeedsSelection(const FeedsSelection &other);
virtual ~FeedsSelection();
SelectionMode mode();
FeedsModelRootItem *selectedItem() const;
RootItem *selectedItem() const;
QString generateListOfIds();
private:
FeedsModelRootItem *m_selectedItem;
RootItem *m_selectedItem;
};
Q_DECLARE_METATYPE(FeedsSelection::SelectionMode)

View File

@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "core/feedsmodelrecyclebin.h"
#include "core/recyclebin.h"
#include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h"
@ -23,9 +23,9 @@
#include <QSqlQuery>
FeedsModelRecycleBin::FeedsModelRecycleBin(FeedsModelRootItem *parent)
: FeedsModelRootItem(parent) {
m_kind = FeedsModelRootItem::RecycleBin;
RecycleBin::RecycleBin(RootItem *parent)
: RootItem(parent) {
m_kind = RootItem::Bin;
m_icon = qApp->icons()->fromTheme(QSL("folder-recycle-bin"));
m_id = ID_RECYCLE_BIN;
m_title = tr("Recycle bin");
@ -35,27 +35,27 @@ FeedsModelRecycleBin::FeedsModelRecycleBin(FeedsModelRootItem *parent)
updateCounts(true);
}
FeedsModelRecycleBin::~FeedsModelRecycleBin() {
qDebug("Destroying FeedsModelRecycleBin instance.");
RecycleBin::~RecycleBin() {
qDebug("Destroying RecycleBin instance.");
}
int FeedsModelRecycleBin::childCount() const {
int RecycleBin::childCount() const {
return 0;
}
void FeedsModelRecycleBin::appendChild(FeedsModelRootItem *child) {
void RecycleBin::appendChild(RootItem *child) {
Q_UNUSED(child)
}
int FeedsModelRecycleBin::countOfUnreadMessages() const {
int RecycleBin::countOfUnreadMessages() const {
return m_unreadCount;
}
int FeedsModelRecycleBin::countOfAllMessages() const {
int RecycleBin::countOfAllMessages() const {
return m_totalCount;
}
QVariant FeedsModelRecycleBin::data(int column, int role) const {
QVariant RecycleBin::data(int column, int role) const {
switch (role) {
case Qt::DisplayRole:
if (column == FDS_MODEL_TITLE_INDEX) {
@ -108,8 +108,8 @@ QVariant FeedsModelRecycleBin::data(int column, int role) const {
}
}
bool FeedsModelRecycleBin::empty() {
QSqlDatabase db_handle = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
bool RecycleBin::empty() {
QSqlDatabase db_handle = qApp->database()->connection(QSL("RecycleBin"), DatabaseFactory::FromSettings);
if (!db_handle.transaction()) {
qWarning("Starting transaction for recycle bin emptying.");
@ -135,8 +135,8 @@ bool FeedsModelRecycleBin::empty() {
}
}
bool FeedsModelRecycleBin::restore() {
QSqlDatabase db_handle = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
bool RecycleBin::restore() {
QSqlDatabase db_handle = qApp->database()->connection(QSL("RecycleBin"), DatabaseFactory::FromSettings);
if (!db_handle.transaction()) {
qWarning("Starting transaction for recycle bin restoring.");
@ -162,8 +162,8 @@ bool FeedsModelRecycleBin::restore() {
}
}
void FeedsModelRecycleBin::updateCounts(bool update_total_count) {
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
void RecycleBin::updateCounts(bool update_total_count) {
QSqlDatabase database = qApp->database()->connection(QSL("RecycleBin"), DatabaseFactory::FromSettings);
QSqlQuery query_all(database);
query_all.setForwardOnly(true);

View File

@ -15,23 +15,23 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef FEEDSMODELRECYCLEBIN_H
#define FEEDSMODELRECYCLEBIN_H
#ifndef RECYCLEBIN_H
#define RECYCLEBIN_H
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
#include <QCoreApplication>
class FeedsModelRecycleBin : public FeedsModelRootItem {
Q_DECLARE_TR_FUNCTIONS(FeedsModelRecycleBin)
class RecycleBin : public RootItem {
Q_DECLARE_TR_FUNCTIONS(RecycleBin)
public:
explicit FeedsModelRecycleBin(FeedsModelRootItem *parent = NULL);
virtual ~FeedsModelRecycleBin();
explicit RecycleBin(RootItem *parent = NULL);
virtual ~RecycleBin();
int childCount() const;
void appendChild(FeedsModelRootItem *child);
void appendChild(RootItem *child);
int countOfUnreadMessages() const;
int countOfAllMessages() const;
QVariant data(int column, int role) const;
@ -47,4 +47,4 @@ class FeedsModelRecycleBin : public FeedsModelRootItem {
int m_unreadCount;
};
#endif // FEEDSMODELRECYCLEBIN_H
#endif // RECYCLEBIN_H

View File

@ -15,41 +15,41 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "core/feedsmodelrootitem.h"
#include "core/rootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "core/feedsmodelrecyclebin.h"
#include "core/category.h"
#include "core/feed.h"
#include "core/recyclebin.h"
#include "miscellaneous/application.h"
#include <QVariant>
FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item)
: m_kind(FeedsModelRootItem::RootItem),
RootItem::RootItem(RootItem *parent_item)
: m_kind(RootItem::Root),
m_id(NO_PARENT_CATEGORY),
m_title(QString()),
m_description(QString()),
m_icon(QIcon()),
m_creationDate(QDateTime()),
m_childItems(QList<FeedsModelRootItem*>()),
m_childItems(QList<RootItem*>()),
m_parentItem(parent_item) {
setupFonts();
}
FeedsModelRootItem::~FeedsModelRootItem() {
RootItem::~RootItem() {
qDeleteAll(m_childItems);
}
void FeedsModelRootItem::setupFonts() {
void RootItem::setupFonts() {
m_normalFont = Application::font("FeedsView");
m_boldFont = m_normalFont;
m_boldFont.setBold(true);
}
int FeedsModelRootItem::row() const {
int RootItem::row() const {
if (m_parentItem) {
return m_parentItem->m_childItems.indexOf(const_cast<FeedsModelRootItem*>(this));
return m_parentItem->m_childItems.indexOf(const_cast<RootItem*>(this));
}
else {
// This item has no parent. Therefore, its row index is 0.
@ -57,7 +57,7 @@ int FeedsModelRootItem::row() const {
}
}
QVariant FeedsModelRootItem::data(int column, int role) const {
QVariant RootItem::data(int column, int role) const {
Q_UNUSED(column)
Q_UNUSED(role)
@ -65,11 +65,11 @@ QVariant FeedsModelRootItem::data(int column, int role) const {
return QVariant();
}
int FeedsModelRootItem::countOfAllMessages() const {
int RootItem::countOfAllMessages() const {
int total_count = 0;
foreach (FeedsModelRootItem *child_item, m_childItems) {
if (child_item->kind() != FeedsModelRootItem::RecycleBin) {
foreach (RootItem *child_item, m_childItems) {
if (child_item->kind() != RootItem::Bin) {
total_count += child_item->countOfAllMessages();
}
}
@ -77,29 +77,29 @@ int FeedsModelRootItem::countOfAllMessages() const {
return total_count;
}
QList<FeedsModelRootItem*> FeedsModelRootItem::getRecursiveChildren() {
QList<FeedsModelRootItem*> children;
QList<RootItem*> RootItem::getRecursiveChildren() {
QList<RootItem*> children;
if (kind() == FeedsModelRootItem::Feed) {
if (kind() == RootItem::Feeed) {
// Root itself is a FEED.
children.append(this);
}
else {
// Root itself is a CATEGORY or ROOT item.
QList<FeedsModelRootItem*> traversable_items;
QList<RootItem*> traversable_items;
traversable_items.append(this);
// Iterate all nested categories.
while (!traversable_items.isEmpty()) {
FeedsModelRootItem *active_category = traversable_items.takeFirst();
RootItem *active_category = traversable_items.takeFirst();
foreach (FeedsModelRootItem *child, active_category->childItems()) {
if (child->kind() == FeedsModelRootItem::Feed) {
foreach (RootItem *child, active_category->childItems()) {
if (child->kind() == RootItem::Feeed) {
// This child is feed.
children.append(child);
}
else if (child->kind() == FeedsModelRootItem::Category) {
else if (child->kind() == RootItem::Cattegory) {
// This child is category, add its child feeds too.
traversable_items.append(child);
}
@ -110,27 +110,27 @@ QList<FeedsModelRootItem*> FeedsModelRootItem::getRecursiveChildren() {
return children;
}
bool FeedsModelRootItem::removeChild(FeedsModelRootItem *child) {
bool RootItem::removeChild(RootItem *child) {
return m_childItems.removeOne(child);
}
FeedsModelRecycleBin *FeedsModelRootItem::toRecycleBin() {
return static_cast<FeedsModelRecycleBin*>(this);
RecycleBin *RootItem::toRecycleBin() {
return static_cast<RecycleBin*>(this);
}
FeedsModelCategory *FeedsModelRootItem::toCategory() {
return static_cast<FeedsModelCategory*>(this);
Category *RootItem::toCategory() {
return static_cast<Category*>(this);
}
FeedsModelFeed *FeedsModelRootItem::toFeed() {
return static_cast<FeedsModelFeed*>(this);
Feed *RootItem::toFeed() {
return static_cast<Feed*>(this);
}
FeedsModelRootItem *FeedsModelRootItem::child(FeedsModelRootItem::Kind kind_of_child, const QString &identifier) {
foreach (FeedsModelRootItem *child, childItems()) {
RootItem *RootItem::child(RootItem::Kind kind_of_child, const QString &identifier) {
foreach (RootItem *child, childItems()) {
if (child->kind() == kind_of_child) {
if ((kind_of_child == Category && child->title() == identifier) ||
(kind_of_child == Feed && child->toFeed()->url() == identifier)) {
if ((kind_of_child == Cattegory && child->title() == identifier) ||
(kind_of_child == Feeed && child->toFeed()->url() == identifier)) {
return child;
}
}
@ -139,11 +139,11 @@ FeedsModelRootItem *FeedsModelRootItem::child(FeedsModelRootItem::Kind kind_of_c
return NULL;
}
int FeedsModelRootItem::countOfUnreadMessages() const {
int RootItem::countOfUnreadMessages() const {
int total_count = 0;
foreach (FeedsModelRootItem *child_item, m_childItems) {
if (child_item->kind() != FeedsModelRootItem::RecycleBin) {
foreach (RootItem *child_item, m_childItems) {
if (child_item->kind() != RootItem::Bin) {
total_count += child_item->countOfUnreadMessages();
}
}
@ -151,7 +151,7 @@ int FeedsModelRootItem::countOfUnreadMessages() const {
return total_count;
}
bool FeedsModelRootItem::removeChild(int index) {
bool RootItem::removeChild(int index) {
if (index >= 0 && index < m_childItems.size()) {
m_childItems.removeAt(index);
return true;
@ -161,11 +161,11 @@ bool FeedsModelRootItem::removeChild(int index) {
}
}
bool FeedsModelRootItem::isEqual(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs) {
bool RootItem::isEqual(RootItem *lhs, RootItem *rhs) {
return (lhs->kind() == rhs->kind()) && (lhs->id() == rhs->id());
}
bool FeedsModelRootItem::lessThan(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs) {
bool RootItem::lessThan(RootItem *lhs, RootItem *rhs) {
if (lhs->kind() == rhs->kind()) {
return lhs->id() < rhs->id();
}

64
src/core/feedsmodelrootitem.h → src/core/rootitem.h Executable file → Normal file
View File

@ -15,55 +15,55 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef FEEDSMODELROOTITEM_H
#define FEEDSMODELROOTITEM_H
#ifndef ROOTITEM_H
#define ROOTITEM_H
#include <QIcon>
#include <QDateTime>
#include <QFont>
class FeedsModelRecycleBin;
class FeedsModelCategory;
class FeedsModelFeed;
class RecycleBin;
class Category;
class Feed;
// Represents ROOT item of FeedsModel.
// NOTE: This class is derived to add functionality for
// all other non-root items of FeedsModel.
class FeedsModelRootItem {
class RootItem {
public:
// Describes the kind of the item.
enum Kind {
RootItem = 1001,
RecycleBin = 1002,
Feed = 1003,
Category = 1004
Root = 1001,
Bin = 1002,
Feeed = 1003,
Cattegory = 1004
};
// Constructors and destructors.
explicit FeedsModelRootItem(FeedsModelRootItem *parent_item = NULL);
virtual ~FeedsModelRootItem();
explicit RootItem(RootItem *parent_item = NULL);
virtual ~RootItem();
// Basic operations.
inline virtual FeedsModelRootItem *parent() const {
inline virtual RootItem *parent() const {
return m_parentItem;
}
inline virtual void setParent(FeedsModelRootItem *parent_item) {
inline virtual void setParent(RootItem *parent_item) {
m_parentItem = parent_item;
}
inline virtual FeedsModelRootItem *child(int row) {
inline virtual RootItem *child(int row) {
return m_childItems.value(row);
}
virtual FeedsModelRootItem *child(FeedsModelRootItem::Kind kind_of_child, const QString &identifier);
virtual RootItem *child(RootItem::Kind kind_of_child, const QString &identifier);
inline virtual int childCount() const {
return m_childItems.size();
}
inline virtual void appendChild(FeedsModelRootItem *child) {
inline virtual void appendChild(RootItem *child) {
m_childItems.append(child);
child->setParent(this);
}
@ -87,20 +87,20 @@ class FeedsModelRootItem {
}
// Access to children.
inline QList<FeedsModelRootItem*> childItems() const {
inline QList<RootItem*> childItems() const {
return m_childItems;
}
// Checks whether THIS object is child (direct or indirect)
// of the given root.
bool isChildOf(FeedsModelRootItem *root) {
bool isChildOf(RootItem *root) {
if (root == NULL) {
return false;
}
FeedsModelRootItem *this_item = this;
RootItem *this_item = this;
while (this_item->kind() != FeedsModelRootItem::RootItem) {
while (this_item->kind() != RootItem::Root) {
if (root->childItems().contains(this_item)) {
return true;
}
@ -112,7 +112,7 @@ class FeedsModelRootItem {
return false;
}
bool isParentOf(FeedsModelRootItem *child) {
bool isParentOf(RootItem *child) {
if (child == NULL) {
return false;
}
@ -127,12 +127,12 @@ class FeedsModelRootItem {
m_childItems.clear();
}
QList<FeedsModelRootItem*> getRecursiveChildren();
QList<RootItem*> getRecursiveChildren();
// Removes particular child at given index.
// NOTE: Child is NOT freed from the memory.
bool removeChild(int index);
bool removeChild(FeedsModelRootItem *child);
bool removeChild(RootItem *child);
inline Kind kind() const {
return m_kind;
@ -182,13 +182,13 @@ class FeedsModelRootItem {
}
// Converters
FeedsModelRecycleBin *toRecycleBin();
FeedsModelCategory *toCategory();
FeedsModelFeed *toFeed();
RecycleBin *toRecycleBin();
Category *toCategory();
Feed *toFeed();
// Compares two model items.
static bool isEqual(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs);
static bool lessThan(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs);
static bool isEqual(RootItem *lhs, RootItem *rhs);
static bool lessThan(RootItem *lhs, RootItem *rhs);
protected:
void setupFonts();
@ -203,8 +203,8 @@ class FeedsModelRootItem {
QFont m_normalFont;
QFont m_boldFont;
QList<FeedsModelRootItem*> m_childItems;
FeedsModelRootItem *m_parentItem;
QList<RootItem*> m_childItems;
RootItem *m_parentItem;
};
#endif // FEEDMODELROOTITEM_H
#endif // ROOTITEM_H

View File

@ -18,8 +18,8 @@
#include "gui/dialogs/formcategorydetails.h"
#include "definitions/definitions.h"
#include "core/feedsmodelrootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/rootitem.h"
#include "core/category.h"
#include "core/feedsmodel.h"
#include "miscellaneous/iconfactory.h"
#include "gui/feedsview.h"
@ -67,7 +67,7 @@ void FormCategoryDetails::createConnections() {
connect(m_actionUseDefaultIcon, SIGNAL(triggered()), this, SLOT(onUseDefaultIcon()));
}
void FormCategoryDetails::setEditableCategory(FeedsModelCategory *editable_category) {
void FormCategoryDetails::setEditableCategory(Category *editable_category) {
m_editableCategory = editable_category;
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) editable_category->parent())));
@ -76,7 +76,7 @@ void FormCategoryDetails::setEditableCategory(FeedsModelCategory *editable_categ
m_ui->m_btnIcon->setIcon(editable_category->icon());
}
int FormCategoryDetails::exec(FeedsModelCategory *input_category, FeedsModelRootItem *parent_to_select) {
int FormCategoryDetails::exec(Category *input_category, RootItem *parent_to_select) {
// Load categories.
loadCategories(m_feedsModel->allCategories().values(), m_feedsModel->rootItem(), input_category);
@ -90,10 +90,10 @@ int FormCategoryDetails::exec(FeedsModelCategory *input_category, FeedsModelRoot
// Load parent from suggested item.
if (parent_to_select != NULL) {
if (parent_to_select->kind() == FeedsModelRootItem::Category) {
if (parent_to_select->kind() == RootItem::Cattegory) {
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select)));
}
else if (parent_to_select->kind() == FeedsModelRootItem::Feed) {
else if (parent_to_select->kind() == RootItem::Feeed) {
int target_item = m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select->parent()));
if (target_item >= 0) {
@ -113,8 +113,8 @@ int FormCategoryDetails::exec(FeedsModelCategory *input_category, FeedsModelRoot
}
void FormCategoryDetails::apply() {
FeedsModelRootItem *parent = static_cast<FeedsModelRootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
FeedsModelCategory *new_category = new FeedsModelCategory();
RootItem *parent = static_cast<RootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
Category *new_category = new Category();
new_category->setTitle(m_ui->m_txtTitle->lineEdit()->text());
new_category->setCreationDate(QDateTime::currentDateTime());
@ -241,14 +241,14 @@ void FormCategoryDetails::initialize() {
m_ui->m_txtTitle->lineEdit()->setFocus(Qt::TabFocusReason);
}
void FormCategoryDetails::loadCategories(const QList<FeedsModelCategory*> categories,
FeedsModelRootItem *root_item,
FeedsModelCategory *input_category) {
void FormCategoryDetails::loadCategories(const QList<Category*> categories,
RootItem *root_item,
Category *input_category) {
m_ui->m_cmbParentCategory->addItem(root_item->icon(),
root_item->title(),
QVariant::fromValue((void*) root_item));
foreach (FeedsModelCategory *category, categories) {
foreach (Category *category, categories) {
if (input_category != NULL && (category == input_category || category->isChildOf(input_category))) {
// This category cannot be selected as the new
// parent for currently edited category, so

View File

@ -27,10 +27,10 @@ namespace Ui {
class FormCategoryDetails;
}
class FeedsModelCategory;
class FeedsModelCategory;
class Category;
class Category;
class FeedsModel;
class FeedsModelRootItem;
class RootItem;
class QMenu;
class QAction;
@ -44,7 +44,7 @@ class FormCategoryDetails : public QDialog {
public slots:
// Executes add/edit standard category dialog.
int exec(FeedsModelCategory *input_category, FeedsModelRootItem *parent_to_select);
int exec(Category *input_category, RootItem *parent_to_select);
protected slots:
// Applies changes.
@ -64,7 +64,7 @@ class FormCategoryDetails : public QDialog {
void createConnections();
// Sets the category which will be edited.
void setEditableCategory(FeedsModelCategory *editable_category);
void setEditableCategory(Category *editable_category);
// Initializes the dialog.
void initialize();
@ -72,11 +72,11 @@ class FormCategoryDetails : public QDialog {
// Loads categories into the dialog + give root "category"
// and make sure that no childs of input category (including)
// input category are loaded.
void loadCategories(const QList<FeedsModelCategory*> categories, FeedsModelRootItem *root_item, FeedsModelCategory *input_category);
void loadCategories(const QList<Category*> categories, RootItem *root_item, Category *input_category);
private:
Ui::FormCategoryDetails *m_ui;
FeedsModelCategory *m_editableCategory;
Category *m_editableCategory;
FeedsModel *m_feedsModel;
QMenu *m_iconMenu;

View File

@ -19,9 +19,9 @@
#include "definitions/definitions.h"
#include "core/feedsmodel.h"
#include "core/feedsmodelrootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "core/rootitem.h"
#include "core/category.h"
#include "core/feed.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/networkfactory.h"
@ -58,7 +58,7 @@ FormFeedDetails::~FormFeedDetails() {
delete m_ui;
}
int FormFeedDetails::exec(FeedsModelFeed *input_feed, FeedsModelRootItem *parent_to_select) {
int FormFeedDetails::exec(Feed *input_feed, RootItem *parent_to_select) {
// Load categories.
loadCategories(m_feedsModel->allCategories().values(), m_feedsModel->rootItem());
@ -77,10 +77,10 @@ int FormFeedDetails::exec(FeedsModelFeed *input_feed, FeedsModelRootItem *parent
}
if (parent_to_select != NULL) {
if (parent_to_select->kind() == FeedsModelRootItem::Category) {
if (parent_to_select->kind() == RootItem::Cattegory) {
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select)));
}
else if (parent_to_select->kind() == FeedsModelRootItem::Feed) {
else if (parent_to_select->kind() == RootItem::Feeed) {
int target_item = m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select->parent()));
if (target_item >= 0) {
@ -168,15 +168,15 @@ void FormFeedDetails::onAuthenticationSwitched() {
}
void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
FeedsModelFeed::AutoUpdateType auto_update_type = static_cast<FeedsModelFeed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(new_index).toInt());
Feed::AutoUpdateType auto_update_type = static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(new_index).toInt());
switch (auto_update_type) {
case FeedsModelFeed::DontAutoUpdate:
case FeedsModelFeed::DefaultAutoUpdate:
case Feed::DontAutoUpdate:
case Feed::DefaultAutoUpdate:
m_ui->m_spinAutoUpdateInterval->setEnabled(false);
break;
case FeedsModelFeed::SpecificAutoUpdate:
case Feed::SpecificAutoUpdate:
default:
m_ui->m_spinAutoUpdateInterval->setEnabled(true);
}
@ -219,9 +219,9 @@ void FormFeedDetails::onUseDefaultIcon() {
}
void FormFeedDetails::apply() {
FeedsModelRootItem *parent = static_cast<FeedsModelRootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
FeedsModelFeed::Type type = static_cast<FeedsModelFeed::Type>(m_ui->m_cmbType->itemData(m_ui->m_cmbType->currentIndex()).value<int>());
FeedsModelFeed *new_feed = new FeedsModelFeed();
RootItem *parent = static_cast<RootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
Feed::Type type = static_cast<Feed::Type>(m_ui->m_cmbType->itemData(m_ui->m_cmbType->currentIndex()).value<int>());
Feed *new_feed = new Feed();
// Setup data for new_feed.
new_feed->setTitle(m_ui->m_txtTitle->lineEdit()->text());
@ -234,7 +234,7 @@ void FormFeedDetails::apply() {
new_feed->setPasswordProtected(m_ui->m_gbAuthentication->isChecked());
new_feed->setUsername(m_ui->m_txtUsername->lineEdit()->text());
new_feed->setPassword(m_ui->m_txtPassword->lineEdit()->text());
new_feed->setAutoUpdateType(static_cast<FeedsModelFeed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
new_feed->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
new_feed->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value());
new_feed->setParent(parent);
@ -263,7 +263,7 @@ void FormFeedDetails::apply() {
}
void FormFeedDetails::guessFeed() {
QPair<FeedsModelFeed*, QNetworkReply::NetworkError> result = FeedsModelFeed::guessFeed(m_ui->m_txtUrl->lineEdit()->text(),
QPair<Feed*, QNetworkReply::NetworkError> result = Feed::guessFeed(m_ui->m_txtUrl->lineEdit()->text(),
m_ui->m_txtUsername->lineEdit()->text(),
m_ui->m_txtPassword->lineEdit()->text());
@ -307,7 +307,7 @@ void FormFeedDetails::guessFeed() {
}
void FormFeedDetails::guessIconOnly() {
QPair<FeedsModelFeed*, QNetworkReply::NetworkError> result = FeedsModelFeed::guessFeed(m_ui->m_txtUrl->lineEdit()->text(),
QPair<Feed*, QNetworkReply::NetworkError> result = Feed::guessFeed(m_ui->m_txtUrl->lineEdit()->text(),
m_ui->m_txtUsername->lineEdit()->text(),
m_ui->m_txtPassword->lineEdit()->text());
@ -356,7 +356,7 @@ void FormFeedDetails::createConnections() {
connect(m_actionUseDefaultIcon, SIGNAL(triggered()), this, SLOT(onUseDefaultIcon()));
}
void FormFeedDetails::setEditableFeed(FeedsModelFeed *editable_feed) {
void FormFeedDetails::setEditableFeed(Feed *editable_feed) {
m_editableFeed = editable_feed;
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) editable_feed->parent())));
@ -405,10 +405,10 @@ void FormFeedDetails::initialize() {
#endif
// Add standard feed types.
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::Atom10), QVariant::fromValue((int) FeedsModelFeed::Atom10));
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::Rdf), QVariant::fromValue((int) FeedsModelFeed::Rdf));
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::Rss0X), QVariant::fromValue((int) FeedsModelFeed::Rss0X));
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::Rss2X), QVariant::fromValue((int) FeedsModelFeed::Rss2X));
m_ui->m_cmbType->addItem(Feed::typeToString(Feed::Atom10), QVariant::fromValue((int) Feed::Atom10));
m_ui->m_cmbType->addItem(Feed::typeToString(Feed::Rdf), QVariant::fromValue((int) Feed::Rdf));
m_ui->m_cmbType->addItem(Feed::typeToString(Feed::Rss0X), QVariant::fromValue((int) Feed::Rss0X));
m_ui->m_cmbType->addItem(Feed::typeToString(Feed::Rss2X), QVariant::fromValue((int) Feed::Rss2X));
// Load available encodings.
QList<QByteArray> encodings = QTextCodec::availableCodecs();
@ -449,9 +449,9 @@ void FormFeedDetails::initialize() {
// Setup auto-update options.
m_ui->m_spinAutoUpdateInterval->setValue(DEFAULT_AUTO_UPDATE_INTERVAL);
m_ui->m_cmbAutoUpdateType->addItem(tr("Auto-update using global interval"), QVariant::fromValue((int) FeedsModelFeed::DefaultAutoUpdate));
m_ui->m_cmbAutoUpdateType->addItem(tr("Auto-update every"), QVariant::fromValue((int) FeedsModelFeed::SpecificAutoUpdate));
m_ui->m_cmbAutoUpdateType->addItem(tr("Do not auto-update at all"), QVariant::fromValue((int) FeedsModelFeed::DontAutoUpdate));
m_ui->m_cmbAutoUpdateType->addItem(tr("Auto-update using global interval"), QVariant::fromValue((int) Feed::DefaultAutoUpdate));
m_ui->m_cmbAutoUpdateType->addItem(tr("Auto-update every"), QVariant::fromValue((int) Feed::SpecificAutoUpdate));
m_ui->m_cmbAutoUpdateType->addItem(tr("Do not auto-update at all"), QVariant::fromValue((int) Feed::DontAutoUpdate));
// Set tab order.
setTabOrder(m_ui->m_cmbParentCategory, m_ui->m_cmbType);
@ -475,13 +475,13 @@ void FormFeedDetails::initialize() {
m_ui->m_txtUrl->lineEdit()->setFocus(Qt::TabFocusReason);
}
void FormFeedDetails::loadCategories(const QList<FeedsModelCategory*> categories,
FeedsModelRootItem *root_item) {
void FormFeedDetails::loadCategories(const QList<Category*> categories,
RootItem *root_item) {
m_ui->m_cmbParentCategory->addItem(root_item->icon(),
root_item->title(),
QVariant::fromValue((void*) root_item));
foreach (FeedsModelCategory *category, categories) {
foreach (Category *category, categories) {
m_ui->m_cmbParentCategory->addItem(category->data(FDS_MODEL_TITLE_INDEX,
Qt::DecorationRole).value<QIcon>(),
category->title(),

View File

@ -28,9 +28,9 @@ namespace Ui {
}
class FeedsModel;
class FeedsModelFeed;
class FeedsModelCategory;
class FeedsModelRootItem;
class Feed;
class Category;
class RootItem;
class FormFeedDetails : public QDialog {
Q_OBJECT
@ -42,7 +42,7 @@ class FormFeedDetails : public QDialog {
public slots:
// Executes add/edit standard feed dialog.
int exec(FeedsModelFeed *input_feed, FeedsModelRootItem *parent_to_select);
int exec(Feed *input_feed, RootItem *parent_to_select);
protected slots:
// Applies changes.
@ -72,18 +72,18 @@ class FormFeedDetails : public QDialog {
void createConnections();
// Sets the feed which will be edited.
void setEditableFeed(FeedsModelFeed *editable_feed);
void setEditableFeed(Feed *editable_feed);
// Initializes the dialog.
void initialize();
// Loads categories into the dialog from the model.
void loadCategories(const QList<FeedsModelCategory*> categories,
FeedsModelRootItem *root_item);
void loadCategories(const QList<Category*> categories,
RootItem *root_item);
private:
Ui::FormFeedDetails *m_ui;
FeedsModelFeed *m_editableFeed;
Feed *m_editableFeed;
FeedsModel *m_feedsModel;
QMenu *m_iconMenu;

View File

@ -25,7 +25,7 @@
#include "miscellaneous/databasecleaner.h"
#include "core/messagesproxymodel.h"
#include "core/feeddownloader.h"
#include "core/feedsmodelfeed.h"
#include "core/feed.h"
#include "core/feedsselection.h"
#include "core/feedsimportexportmodel.h"
#include "network-web/webbrowser.h"
@ -252,7 +252,7 @@ void FeedMessageViewer::onFeedUpdatesStarted() {
qApp->mainForm()->statusBar()->showProgressFeeds(0, tr("Feed update started"));
}
void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed, int current, int total) {
void FeedMessageViewer::onFeedUpdatesProgress(Feed *feed, int current, int total) {
// Some feed got updated.
m_feedsView->updateCountsOfParticularFeed(feed, true);
qApp->mainForm()->statusBar()->showProgressFeeds((current * 100.0) / total,
@ -360,7 +360,7 @@ void FeedMessageViewer::createConnections() {
form_main->m_ui->m_tabWidget, SLOT(addBrowserWithMessages(QList<Message>)));
// Downloader connections.
connect(m_feedsView, SIGNAL(feedsUpdateRequested(QList<FeedsModelFeed*>)), this, SLOT(updateFeeds(QList<FeedsModelFeed*>)));
connect(m_feedsView, SIGNAL(feedsUpdateRequested(QList<Feed*>)), this, SLOT(updateFeeds(QList<Feed*>)));
// Toolbar forwardings.
connect(form_main->m_ui->m_actionCleanupDatabase,
@ -535,7 +535,7 @@ void FeedMessageViewer::refreshVisualProperties() {
m_toolBarMessages->setToolButtonStyle(button_style);
}
void FeedMessageViewer::updateFeeds(QList<FeedsModelFeed *> feeds) {
void FeedMessageViewer::updateFeeds(QList<Feed *> feeds) {
if (!qApp->feedUpdateLock()->tryLock()) {
qApp->showGuiMessage(tr("Cannot update all items"),
tr("You cannot update all items because another another critical operation is ongoing."),
@ -548,14 +548,14 @@ void FeedMessageViewer::updateFeeds(QList<FeedsModelFeed *> feeds) {
m_feedDownloaderThread = new QThread();
// Downloader setup.
qRegisterMetaType<QList<FeedsModelFeed*> >("QList<FeedsModelFeed*>");
qRegisterMetaType<QList<Feed*> >("QList<Feed*>");
m_feedDownloader->moveToThread(m_feedDownloaderThread);
connect(this, SIGNAL(feedsUpdateRequested(QList<FeedsModelFeed*>)), m_feedDownloader, SLOT(updateFeeds(QList<FeedsModelFeed*>)));
connect(this, SIGNAL(feedsUpdateRequested(QList<Feed*>)), m_feedDownloader, SLOT(updateFeeds(QList<Feed*>)));
connect(m_feedDownloaderThread, SIGNAL(finished()), m_feedDownloaderThread, SLOT(deleteLater()));
connect(m_feedDownloader, SIGNAL(finished(FeedDownloadResults)), this, SLOT(onFeedUpdatesFinished(FeedDownloadResults)));
connect(m_feedDownloader, SIGNAL(started()), this, SLOT(onFeedUpdatesStarted()));
connect(m_feedDownloader, SIGNAL(progress(FeedsModelFeed*,int,int)), this, SLOT(onFeedUpdatesProgress(FeedsModelFeed*,int,int)));
connect(m_feedDownloader, SIGNAL(progress(Feed*,int,int)), this, SLOT(onFeedUpdatesProgress(Feed*,int,int)));
// Connections are made, start the feed downloader thread.
m_feedDownloaderThread->start();

View File

@ -30,7 +30,7 @@ class MessagesToolBar;
class FeedsToolBar;
class FeedsView;
class DatabaseCleaner;
class FeedsModelFeed;
class Feed;
class QToolBar;
class QSplitter;
class QProgressBar;
@ -103,7 +103,7 @@ class FeedMessageViewer : public TabContent {
// Reloads some changeable visual settings.
void refreshVisualProperties();
void updateFeeds(QList<FeedsModelFeed*> feeds);
void updateFeeds(QList<Feed*> feeds);
private slots:
// Updates counts of messages for example in tray icon.
@ -111,7 +111,7 @@ class FeedMessageViewer : public TabContent {
// Reacts on feed updates.
void onFeedUpdatesStarted();
void onFeedUpdatesProgress(FeedsModelFeed *feed, int current, int total);
void onFeedUpdatesProgress(Feed *feed, int current, int total);
void onFeedUpdatesFinished(FeedDownloadResults results);
// Switches visibility of feed list and related
@ -135,7 +135,7 @@ class FeedMessageViewer : public TabContent {
signals:
// Emitted if user/application requested updating of some feeds.
void feedsUpdateRequested(const QList<FeedsModelFeed*> feeds);
void feedsUpdateRequested(const QList<Feed*> feeds);
private:
bool m_toolBarsEnabled;

View File

@ -18,13 +18,13 @@
#include "gui/feedsview.h"
#include "definitions/definitions.h"
#include "core/feedsmodelfeed.h"
#include "core/feed.h"
#include "core/feedsmodel.h"
#include "core/feedsproxymodel.h"
#include "core/feedsmodelrootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelrecyclebin.h"
#include "core/feedsmodelfeed.h"
#include "core/rootitem.h"
#include "core/category.h"
#include "core/recyclebin.h"
#include "core/feed.h"
#include "miscellaneous/systemfactory.h"
#include "miscellaneous/mutex.h"
#include "gui/systemtrayicon.h"
@ -103,43 +103,43 @@ void FeedsView::updateAutoUpdateStatus() {
}
}
QList<FeedsModelFeed*> FeedsView::selectedFeeds() const {
QList<Feed*> FeedsView::selectedFeeds() const {
QModelIndex current_index = currentIndex();
if (current_index.isValid()) {
return m_sourceModel->feedsForIndex(m_proxyModel->mapToSource(current_index));
}
else {
return QList<FeedsModelFeed*>();
return QList<Feed*>();
}
}
QList<FeedsModelFeed*> FeedsView::allFeeds() const {
QList<Feed*> FeedsView::allFeeds() const {
return m_sourceModel->allFeeds();
}
FeedsModelRootItem *FeedsView::selectedItem() const {
RootItem *FeedsView::selectedItem() const {
QModelIndexList selected_rows = selectionModel()->selectedRows();
if (selected_rows.isEmpty()) {
return NULL;
}
FeedsModelRootItem *selected_item = m_sourceModel->itemForIndex(m_proxyModel->mapToSource(selected_rows.at(0)));
RootItem *selected_item = m_sourceModel->itemForIndex(m_proxyModel->mapToSource(selected_rows.at(0)));
return selected_item == m_sourceModel->rootItem() ? NULL : selected_item;
}
FeedsModelCategory *FeedsView::selectedCategory() const {
Category *FeedsView::selectedCategory() const {
QModelIndex current_mapped = m_proxyModel->mapToSource(currentIndex());
return m_sourceModel->categoryForIndex(current_mapped);
}
FeedsModelFeed *FeedsView::selectedFeed() const {
Feed *FeedsView::selectedFeed() const {
QModelIndex current_mapped = m_proxyModel->mapToSource(currentIndex());
return m_sourceModel->feedForIndex(current_mapped);
}
FeedsModelRecycleBin *FeedsView::selectedRecycleBin() const{
RecycleBin *FeedsView::selectedRecycleBin() const{
QModelIndex current_mapped = m_proxyModel->mapToSource(currentIndex());
return m_sourceModel->recycleBinForIndex(current_mapped);
}
@ -148,7 +148,7 @@ void FeedsView::saveExpandedStates() {
Settings *settings = qApp->settings();
// Iterate all categories and save their expand statuses.
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
foreach (Category *category, sourceModel()->allCategories().values()) {
settings->setValue(GROUP(Categories),
QString::number(category->id()),
isExpanded(model()->mapFromSource(sourceModel()->indexForItem(category))));
@ -159,7 +159,7 @@ void FeedsView::loadExpandedStates() {
Settings *settings = qApp->settings();
// Iterate all categories and save their expand statuses.
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
foreach (Category *category, sourceModel()->allCategories().values()) {
setExpanded(model()->mapFromSource(sourceModel()->indexForItem(category)),
settings->value(GROUP(Categories), QString::number(category->id()), true).toBool());
}
@ -207,7 +207,7 @@ void FeedsView::executeNextAutoUpdate() {
// Pass needed interval data and lets the model decide which feeds
// should be updated in this pass.
QList<FeedsModelFeed*> feeds_for_update = m_sourceModel->feedsForScheduledUpdate(m_globalAutoUpdateEnabled &&
QList<Feed*> feeds_for_update = m_sourceModel->feedsForScheduledUpdate(m_globalAutoUpdateEnabled &&
m_globalAutoUpdateRemainingInterval == 0);
if (feeds_for_update.isEmpty()) {
@ -266,7 +266,7 @@ void FeedsView::addNewCategory() {
qApp->feedUpdateLock()->unlock();
}
void FeedsView::editCategory(FeedsModelCategory *category) {
void FeedsView::editCategory(Category *category) {
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
form_pointer.data()->exec(category, NULL);
@ -295,7 +295,7 @@ void FeedsView::addNewFeed() {
qApp->feedUpdateLock()->unlock();
}
void FeedsView::editFeed(FeedsModelFeed *feed) {
void FeedsView::editFeed(Feed *feed) {
QPointer<FormFeedDetails> form_pointer = new FormFeedDetails(m_sourceModel, this);
form_pointer.data()->exec(feed, NULL);
@ -354,8 +354,8 @@ void FeedsView::editSelectedItem() {
return;
}
FeedsModelCategory *category;
FeedsModelFeed *feed;
Category *category;
Feed *feed;
if ((category = selectedCategory()) != NULL) {
editCategory(category);
@ -472,7 +472,7 @@ void FeedsView::restoreRecycleBin() {
}
void FeedsView::updateCountsOfSelectedFeeds(bool update_total_too) {
foreach (FeedsModelFeed *feed, selectedFeeds()) {
foreach (Feed *feed, selectedFeeds()) {
feed->updateCounts(update_total_too);
}
@ -498,7 +498,7 @@ void FeedsView::updateCountsOfRecycleBin(bool update_total_too) {
}
void FeedsView::updateCountsOfAllFeeds(bool update_total_too) {
foreach (FeedsModelFeed *feed, allFeeds()) {
foreach (Feed *feed, allFeeds()) {
feed->updateCounts(update_total_too);
}
@ -512,7 +512,7 @@ void FeedsView::updateCountsOfAllFeeds(bool update_total_too) {
notifyWithCounts();
}
void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed, bool update_total_too) {
void FeedsView::updateCountsOfParticularFeed(Feed *feed, bool update_total_too) {
QModelIndex index = m_sourceModel->indexForItem(feed);
if (index.isValid()) {
@ -620,7 +620,7 @@ void FeedsView::setupAppearance() {
}
void FeedsView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) {
FeedsModelRootItem *selected_item = selectedItem();
RootItem *selected_item = selectedItem();
m_proxyModel->setSelectedItem(selected_item);
QTreeView::selectionChanged(selected, deselected);
@ -641,9 +641,9 @@ void FeedsView::contextMenuEvent(QContextMenuEvent *event) {
if (clicked_index.isValid()) {
QModelIndex mapped_index = model()->mapToSource(clicked_index);
FeedsModelRootItem *clicked_item = sourceModel()->itemForIndex(mapped_index);
RootItem *clicked_item = sourceModel()->itemForIndex(mapped_index);
if (clicked_item->kind() == FeedsModelRootItem::Category || clicked_item->kind() == FeedsModelRootItem::Feed) {
if (clicked_item->kind() == RootItem::Cattegory || clicked_item->kind() == RootItem::Feeed) {
// Display context menu for categories.
if (m_contextMenuCategoriesFeeds == NULL) {
// Context menu is not initialized, initialize.
@ -652,7 +652,7 @@ void FeedsView::contextMenuEvent(QContextMenuEvent *event) {
m_contextMenuCategoriesFeeds->exec(event->globalPos());
}
else if (clicked_item->kind() == FeedsModelRootItem::RecycleBin) {
else if (clicked_item->kind() == RootItem::Bin) {
// Display context menu for recycle bin.
if (m_contextMenuRecycleBin == NULL) {
initializeContextMenuRecycleBin();

View File

@ -28,8 +28,8 @@
class FeedsProxyModel;
class FeedsModelFeed;
class FeedsModelCategory;
class Feed;
class Category;
class QTimer;
class FeedsView : public QTreeView {
@ -60,15 +60,15 @@ class FeedsView : public QTreeView {
// Returns list of selected/all feeds.
// NOTE: This is recursive method which returns all descendants.
QList<FeedsModelFeed*> selectedFeeds() const;
QList<FeedsModelFeed*> allFeeds() const;
QList<Feed*> selectedFeeds() const;
QList<Feed*> allFeeds() const;
// Returns pointers to selected feed/category if they are really
// selected.
FeedsModelRootItem *selectedItem() const;
FeedsModelCategory *selectedCategory() const;
FeedsModelFeed *selectedFeed() const;
FeedsModelRecycleBin *selectedRecycleBin() const;
RootItem *selectedItem() const;
Category *selectedCategory() const;
Feed *selectedFeed() const;
RecycleBin *selectedRecycleBin() const;
// Saves/loads expand states of all nodes (feeds/categories) of the list to/from settings.
void saveExpandedStates();
@ -112,11 +112,11 @@ class FeedsView : public QTreeView {
// Standard category manipulators.
void addNewCategory();
void editCategory(FeedsModelCategory *category);
void editCategory(Category *category);
// Standard feed manipulators.
void addNewFeed();
void editFeed(FeedsModelFeed *feed);
void editFeed(Feed *feed);
// Is called when counts of messages are changed externally,
// typically from message view.
@ -132,7 +132,7 @@ class FeedsView : public QTreeView {
void updateCountsOfAllFeeds(bool update_total_too);
// Reloads counts for particular feed.
void updateCountsOfParticularFeed(FeedsModelFeed *feed, bool update_total_too);
void updateCountsOfParticularFeed(Feed *feed, bool update_total_too);
// Notifies other components about messages
// counts.
@ -175,7 +175,7 @@ class FeedsView : public QTreeView {
signals:
// Emitted if user/application requested updating of some feeds.
void feedsUpdateRequested(const QList<FeedsModelFeed*> feeds);
void feedsUpdateRequested(const QList<Feed*> feeds);
// Emitted if counts of messages are changed.
void messageCountsChanged(int unread_messages, int total_messages, bool any_feed_has_unread_messages);