Fix displaying of unread root when loading app.
This commit is contained in:
		
							parent
							
								
									2dc6e51e4b
								
							
						
					
					
						commit
						3812e41d7b
					
				
					 7 changed files with 60 additions and 38 deletions
				
			
		|  | @ -197,7 +197,7 @@ bool FeedsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source | ||||||
| 
 | 
 | ||||||
|   RootItem *item = m_sourceModel->itemForIndex(idx); |   RootItem *item = m_sourceModel->itemForIndex(idx); | ||||||
| 
 | 
 | ||||||
|   if (item->kind() == RootItemKind::Bin) { |   if (item->kind() == RootItemKind::Bin || item->kind() == RootItemKind::ServiceRoot) { | ||||||
|     // Recycle bin is always displayed.
 |     // Recycle bin is always displayed.
 | ||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								src/gui/dialogs/formaddaccount.cpp
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										5
									
								
								src/gui/dialogs/formaddaccount.cpp
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -19,13 +19,16 @@ | ||||||
| 
 | 
 | ||||||
| #include "miscellaneous/application.h" | #include "miscellaneous/application.h" | ||||||
| #include "miscellaneous/iconfactory.h" | #include "miscellaneous/iconfactory.h" | ||||||
|  | #include "core/feedsmodel.h" | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| #if defined(Q_OS_OS2) | #if defined(Q_OS_OS2) | ||||||
| #include "gui/messagebox.h" | #include "gui/messagebox.h" | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| FormAddAccount::FormAddAccount(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAddAccount) { | FormAddAccount::FormAddAccount(const QList<ServiceEntryPoint*> &entry_points, FeedsModel *model, QWidget *parent) | ||||||
|  |   : QDialog(parent), m_ui(new Ui::FormAddAccount), m_model(model), m_entryPoints(entry_points) { | ||||||
|   m_ui->setupUi(this); |   m_ui->setupUi(this); | ||||||
| 
 | 
 | ||||||
|   // Set flags and attributes.
 |   // Set flags and attributes.
 | ||||||
|  |  | ||||||
							
								
								
									
										7
									
								
								src/gui/dialogs/formaddaccount.h
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										7
									
								
								src/gui/dialogs/formaddaccount.h
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -27,15 +27,20 @@ namespace Ui { | ||||||
|   class FormAddAccount; |   class FormAddAccount; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | class ServiceEntryPoint; | ||||||
|  | class FeedsModel; | ||||||
|  | 
 | ||||||
| class FormAddAccount : public QDialog { | class FormAddAccount : public QDialog { | ||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
| 
 | 
 | ||||||
|   public: |   public: | ||||||
|     explicit FormAddAccount(QWidget *parent = 0); |     explicit FormAddAccount(const QList<ServiceEntryPoint*> &entry_points, FeedsModel *model, QWidget *parent = 0); | ||||||
|     virtual ~FormAddAccount(); |     virtual ~FormAddAccount(); | ||||||
| 
 | 
 | ||||||
|   private: |   private: | ||||||
|     Ui::FormAddAccount *m_ui; |     Ui::FormAddAccount *m_ui; | ||||||
|  |     FeedsModel *m_model; | ||||||
|  |     QList<ServiceEntryPoint*> m_entryPoints; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif // FORMADDACCOUNT_H
 | #endif // FORMADDACCOUNT_H
 | ||||||
|  |  | ||||||
|  | @ -6,48 +6,51 @@ | ||||||
|    <rect> |    <rect> | ||||||
|     <x>0</x> |     <x>0</x> | ||||||
|     <y>0</y> |     <y>0</y> | ||||||
|     <width>400</width> |     <width>558</width> | ||||||
|     <height>300</height> |     <height>300</height> | ||||||
|    </rect> |    </rect> | ||||||
|   </property> |   </property> | ||||||
|   <property name="windowTitle"> |   <property name="windowTitle"> | ||||||
|    <string>Add new account</string> |    <string>Add new account</string> | ||||||
|   </property> |   </property> | ||||||
|   <widget class="QDialogButtonBox" name="m_buttonBox"> |   <layout class="QFormLayout" name="formLayout"> | ||||||
|    <property name="geometry"> |    <item row="0" column="0"> | ||||||
|     <rect> |     <widget class="QListWidget" name="m_listEntryPoints"> | ||||||
|      <x>30</x> |      <property name="sizePolicy"> | ||||||
|      <y>240</y> |       <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||||||
|      <width>341</width> |        <horstretch>0</horstretch> | ||||||
|      <height>32</height> |        <verstretch>1</verstretch> | ||||||
|     </rect> |       </sizepolicy> | ||||||
|    </property> |      </property> | ||||||
|    <property name="orientation"> |     </widget> | ||||||
|     <enum>Qt::Horizontal</enum> |    </item> | ||||||
|    </property> |    <item row="0" column="1"> | ||||||
|    <property name="standardButtons"> |     <widget class="QGroupBox" name="m_grpEntryPointDetails"> | ||||||
|     <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |      <property name="sizePolicy"> | ||||||
|    </property> |       <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | ||||||
|   </widget> |        <horstretch>0</horstretch> | ||||||
|  |        <verstretch>1</verstretch> | ||||||
|  |       </sizepolicy> | ||||||
|  |      </property> | ||||||
|  |      <property name="title"> | ||||||
|  |       <string>Details</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="0" colspan="2"> | ||||||
|  |     <widget class="QDialogButtonBox" name="m_buttonBox"> | ||||||
|  |      <property name="orientation"> | ||||||
|  |       <enum>Qt::Horizontal</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="standardButtons"> | ||||||
|  |       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |   </layout> | ||||||
|  </widget> |  </widget> | ||||||
|  <resources/> |  <resources/> | ||||||
|  <connections> |  <connections> | ||||||
|   <connection> |  | ||||||
|    <sender>m_buttonBox</sender> |  | ||||||
|    <signal>accepted()</signal> |  | ||||||
|    <receiver>FormAddAccount</receiver> |  | ||||||
|    <slot>accept()</slot> |  | ||||||
|    <hints> |  | ||||||
|     <hint type="sourcelabel"> |  | ||||||
|      <x>248</x> |  | ||||||
|      <y>254</y> |  | ||||||
|     </hint> |  | ||||||
|     <hint type="destinationlabel"> |  | ||||||
|      <x>157</x> |  | ||||||
|      <y>274</y> |  | ||||||
|     </hint> |  | ||||||
|    </hints> |  | ||||||
|   </connection> |  | ||||||
|   <connection> |   <connection> | ||||||
|    <sender>m_buttonBox</sender> |    <sender>m_buttonBox</sender> | ||||||
|    <signal>rejected()</signal> |    <signal>rejected()</signal> | ||||||
|  |  | ||||||
|  | @ -38,6 +38,7 @@ | ||||||
| #include "gui/dialogs/formupdate.h" | #include "gui/dialogs/formupdate.h" | ||||||
| #include "gui/dialogs/formbackupdatabasesettings.h" | #include "gui/dialogs/formbackupdatabasesettings.h" | ||||||
| #include "gui/dialogs/formrestoredatabasesettings.h" | #include "gui/dialogs/formrestoredatabasesettings.h" | ||||||
|  | #include "gui/dialogs/formaddaccount.h" | ||||||
| #include "gui/notifications/notification.h" | #include "gui/notifications/notification.h" | ||||||
| #include "services/abstract/serviceroot.h" | #include "services/abstract/serviceroot.h" | ||||||
| #include "services/abstract/recyclebin.h" | #include "services/abstract/recyclebin.h" | ||||||
|  | @ -447,6 +448,7 @@ void FormMain::createConnections() { | ||||||
|   connect(m_ui->m_actionRestoreDatabaseSettings, SIGNAL(triggered()), this, SLOT(restoreDatabaseSettings())); |   connect(m_ui->m_actionRestoreDatabaseSettings, SIGNAL(triggered()), this, SLOT(restoreDatabaseSettings())); | ||||||
|   connect(m_ui->m_actionRestart, SIGNAL(triggered()), qApp, SLOT(restart())); |   connect(m_ui->m_actionRestart, SIGNAL(triggered()), qApp, SLOT(restart())); | ||||||
|   connect(m_ui->m_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); |   connect(m_ui->m_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); | ||||||
|  |   connect(m_ui->m_actionServiceAdd, SIGNAL(triggered()), this, SLOT(showAddAccountDialog())); | ||||||
| 
 | 
 | ||||||
|   // Menu "View" connections.
 |   // Menu "View" connections.
 | ||||||
|   connect(m_ui->m_actionFullscreen, SIGNAL(toggled(bool)), this, SLOT(switchFullscreenMode())); |   connect(m_ui->m_actionFullscreen, SIGNAL(toggled(bool)), this, SLOT(switchFullscreenMode())); | ||||||
|  | @ -551,6 +553,14 @@ void FormMain::showWiki() { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void FormMain::showAddAccountDialog() { | ||||||
|  |   QPointer<FormAddAccount> form_update = new FormAddAccount(qApp->feedServices(), | ||||||
|  |                                                             tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), | ||||||
|  |                                                             this); | ||||||
|  |   form_update.data()->exec(); | ||||||
|  |   delete form_update.data(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void FormMain::reportABugOnGitHub() { | void FormMain::reportABugOnGitHub() { | ||||||
|   if (!WebFactory::instance()->openUrlInExternalBrowser(APP_URL_ISSUES_NEW_GITHUB)) { |   if (!WebFactory::instance()->openUrlInExternalBrowser(APP_URL_ISSUES_NEW_GITHUB)) { | ||||||
|     qApp->showGuiMessage(tr("Cannot open external browser"), |     qApp->showGuiMessage(tr("Cannot open external browser"), | ||||||
|  |  | ||||||
|  | @ -90,6 +90,7 @@ class FormMain : public QMainWindow { | ||||||
|     void showAbout(); |     void showAbout(); | ||||||
|     void showUpdates(); |     void showUpdates(); | ||||||
|     void showWiki(); |     void showWiki(); | ||||||
|  |     void showAddAccountDialog(); | ||||||
|     void reportABugOnGitHub(); |     void reportABugOnGitHub(); | ||||||
|     void reportABugOnBitBucket(); |     void reportABugOnBitBucket(); | ||||||
|     void donate(); |     void donate(); | ||||||
|  |  | ||||||
|  | @ -481,12 +481,12 @@ void MessagesView::selectNextUnreadItem() { | ||||||
|     active_row = 0; |     active_row = 0; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   QModelIndex next_unread = m_proxyModel->getNextPreviousUnreadItemIndex(active_row); |   QModelIndex next_unread = moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier); | ||||||
| 
 | 
 | ||||||
|   if (next_unread.isValid()) { |   if (next_unread.isValid()) { | ||||||
|     // We found unread message, mark it.
 |     // We found unread message, mark it.
 | ||||||
|     setCurrentIndex(next_unread); |     setCurrentIndex(next_unread); | ||||||
|     selectionModel()->select(next_unread, QItemSelectionModel::Select | QItemSelectionModel::Rows); |     selectionModel()->select(next_unread, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); | ||||||
|     setFocus(); |     setFocus(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue