Save.
This commit is contained in:
		
							parent
							
								
									c1ba3c7bbf
								
							
						
					
					
						commit
						644968256b
					
				
					 14 changed files with 650 additions and 505 deletions
				
			
		|  | @ -132,6 +132,7 @@ HEADERS += core/feeddownloader.h \ | ||||||
|            services/abstract/cacheforserviceroot.h \ |            services/abstract/cacheforserviceroot.h \ | ||||||
|            services/abstract/category.h \ |            services/abstract/category.h \ | ||||||
|            services/abstract/feed.h \ |            services/abstract/feed.h \ | ||||||
|  |            services/abstract/gui/formaccountdetails.h \ | ||||||
|            services/abstract/gui/formfeeddetails.h \ |            services/abstract/gui/formfeeddetails.h \ | ||||||
|            services/abstract/importantnode.h \ |            services/abstract/importantnode.h \ | ||||||
|            services/abstract/label.h \ |            services/abstract/label.h \ | ||||||
|  | @ -177,6 +178,7 @@ HEADERS += core/feeddownloader.h \ | ||||||
|            services/tt-rss/definitions.h \ |            services/tt-rss/definitions.h \ | ||||||
|            services/tt-rss/gui/formeditttrssaccount.h \ |            services/tt-rss/gui/formeditttrssaccount.h \ | ||||||
|            services/tt-rss/gui/formttrssfeeddetails.h \ |            services/tt-rss/gui/formttrssfeeddetails.h \ | ||||||
|  |            services/tt-rss/gui/ttrssaccountdetails.h \ | ||||||
|            services/tt-rss/gui/ttrssfeeddetails.h \ |            services/tt-rss/gui/ttrssfeeddetails.h \ | ||||||
|            services/tt-rss/network/ttrssnetworkfactory.h \ |            services/tt-rss/network/ttrssnetworkfactory.h \ | ||||||
|            services/tt-rss/ttrssfeed.h \ |            services/tt-rss/ttrssfeed.h \ | ||||||
|  | @ -287,6 +289,7 @@ SOURCES += core/feeddownloader.cpp \ | ||||||
|            services/abstract/cacheforserviceroot.cpp \ |            services/abstract/cacheforserviceroot.cpp \ | ||||||
|            services/abstract/category.cpp \ |            services/abstract/category.cpp \ | ||||||
|            services/abstract/feed.cpp \ |            services/abstract/feed.cpp \ | ||||||
|  |            services/abstract/gui/formaccountdetails.cpp \ | ||||||
|            services/abstract/gui/formfeeddetails.cpp \ |            services/abstract/gui/formfeeddetails.cpp \ | ||||||
|            services/abstract/importantnode.cpp \ |            services/abstract/importantnode.cpp \ | ||||||
|            services/abstract/label.cpp \ |            services/abstract/label.cpp \ | ||||||
|  | @ -327,6 +330,7 @@ SOURCES += core/feeddownloader.cpp \ | ||||||
|            services/standard/standardserviceroot.cpp \ |            services/standard/standardserviceroot.cpp \ | ||||||
|            services/tt-rss/gui/formeditttrssaccount.cpp \ |            services/tt-rss/gui/formeditttrssaccount.cpp \ | ||||||
|            services/tt-rss/gui/formttrssfeeddetails.cpp \ |            services/tt-rss/gui/formttrssfeeddetails.cpp \ | ||||||
|  |            services/tt-rss/gui/ttrssaccountdetails.cpp \ | ||||||
|            services/tt-rss/gui/ttrssfeeddetails.cpp \ |            services/tt-rss/gui/ttrssfeeddetails.cpp \ | ||||||
|            services/tt-rss/network/ttrssnetworkfactory.cpp \ |            services/tt-rss/network/ttrssnetworkfactory.cpp \ | ||||||
|            services/tt-rss/ttrssfeed.cpp \ |            services/tt-rss/ttrssfeed.cpp \ | ||||||
|  | @ -365,6 +369,7 @@ FORMS += gui/dialogs/formabout.ui \ | ||||||
|          gui/toolbareditor.ui \ |          gui/toolbareditor.ui \ | ||||||
|          network-web/downloaditem.ui \ |          network-web/downloaditem.ui \ | ||||||
|          network-web/downloadmanager.ui \ |          network-web/downloadmanager.ui \ | ||||||
|  |          services/abstract/gui/formaccountdetails.ui \ | ||||||
|          services/abstract/gui/formfeeddetails.ui \ |          services/abstract/gui/formfeeddetails.ui \ | ||||||
|          services/gmail/gui/formeditgmailaccount.ui \ |          services/gmail/gui/formeditgmailaccount.ui \ | ||||||
|          services/inoreader/gui/formeditinoreaderaccount.ui \ |          services/inoreader/gui/formeditinoreaderaccount.ui \ | ||||||
|  | @ -373,11 +378,11 @@ FORMS += gui/dialogs/formabout.ui \ | ||||||
|          services/standard/gui/formstandardcategorydetails.ui \ |          services/standard/gui/formstandardcategorydetails.ui \ | ||||||
|          services/standard/gui/formstandardimportexport.ui \ |          services/standard/gui/formstandardimportexport.ui \ | ||||||
|          services/standard/gui/standardfeeddetails.ui \ |          services/standard/gui/standardfeeddetails.ui \ | ||||||
|          services/tt-rss/gui/formeditttrssaccount.ui \ |  | ||||||
|          services/gmail/gui/formdownloadattachment.ui \ |          services/gmail/gui/formdownloadattachment.ui \ | ||||||
|          services/gmail/gui/formaddeditemail.ui \ |          services/gmail/gui/formaddeditemail.ui \ | ||||||
|          gui/searchtextwidget.ui \ |          gui/searchtextwidget.ui \ | ||||||
|          gui/newspaperpreviewer.ui \ |          gui/newspaperpreviewer.ui \ | ||||||
|  |          services/tt-rss/gui/ttrssaccountdetails.ui \ | ||||||
|          services/tt-rss/gui/ttrssfeeddetails.ui |          services/tt-rss/gui/ttrssfeeddetails.ui | ||||||
| 
 | 
 | ||||||
| equals(USE_WEBENGINE, true) { | equals(USE_WEBENGINE, true) { | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | ||||||
|  | // For license of this file, see <project-root-folder>/LICENSE.md.
 | ||||||
|  | 
 | ||||||
|  | #include "services/abstract/gui/formaccountdetails.h" | ||||||
|  | 
 | ||||||
|  | #include "gui/guiutilities.h" | ||||||
|  | #include "miscellaneous/application.h" | ||||||
|  | #include "miscellaneous/iconfactory.h" | ||||||
|  | #include "services/abstract/serviceroot.h" | ||||||
|  | 
 | ||||||
|  | FormAccountDetails::FormAccountDetails(const QIcon& icon, QWidget* parent) : QDialog(parent), m_account(nullptr) { | ||||||
|  |   m_ui.setupUi(this); | ||||||
|  | 
 | ||||||
|  |   GuiUtilities::applyDialogProperties(*this, icon.isNull() | ||||||
|  |                                       ? qApp->icons()->fromTheme(QSL("emblem-system")) | ||||||
|  |                                       : icon); | ||||||
|  |   createConnections(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::apply() {} | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::insertCustomTab(QWidget* custom_tab, const QString& title, int index) { | ||||||
|  |   m_ui.m_tabWidget->insertTab(index, custom_tab, title); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::activateTab(int index) { | ||||||
|  |   m_ui.m_tabWidget->setCurrentIndex(index); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::clearTabs() { | ||||||
|  |   m_ui.m_tabWidget->clear(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::setEditableAccount(ServiceRoot* editable_account) { | ||||||
|  |   setWindowTitle(tr("Edit account '%1'").arg(editable_account->title())); | ||||||
|  |   m_account = editable_account; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void FormAccountDetails::createConnections() { | ||||||
|  |   connect(m_ui.m_buttonBox, &QDialogButtonBox::accepted, this, &FormAccountDetails::apply); | ||||||
|  | } | ||||||
							
								
								
									
										43
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | ||||||
|  | // For license of this file, see <project-root-folder>/LICENSE.md.
 | ||||||
|  | 
 | ||||||
|  | #ifndef FORMACCOUNTDETAILS_H | ||||||
|  | #define FORMACCOUNTDETAILS_H | ||||||
|  | 
 | ||||||
|  | #include <QDialog> | ||||||
|  | 
 | ||||||
|  | #include "ui_formaccountdetails.h" | ||||||
|  | 
 | ||||||
|  | class ServiceRoot; | ||||||
|  | 
 | ||||||
|  | class FormAccountDetails : public QDialog { | ||||||
|  |   Q_OBJECT | ||||||
|  | 
 | ||||||
|  |   public: | ||||||
|  |     explicit FormAccountDetails(const QIcon& icon, QWidget* parent = nullptr); | ||||||
|  | 
 | ||||||
|  |   protected slots: | ||||||
|  | 
 | ||||||
|  |     // Applies changes.
 | ||||||
|  |     // NOTE: This must be reimplemented in subclasses. Also this
 | ||||||
|  |     // base implementation must be called first.
 | ||||||
|  |     virtual void apply(); | ||||||
|  | 
 | ||||||
|  |   protected: | ||||||
|  |     void activateTab(int index); | ||||||
|  |     void clearTabs(); | ||||||
|  |     void insertCustomTab(QWidget* custom_tab, const QString& title, int index); | ||||||
|  | 
 | ||||||
|  |     // Sets the account which will be edited.
 | ||||||
|  |     // NOTE: This must be reimplemented in subclasses. Also this
 | ||||||
|  |     // base implementation must be called first.
 | ||||||
|  |     virtual void setEditableAccount(ServiceRoot* editable_account); | ||||||
|  | 
 | ||||||
|  |   private: | ||||||
|  |     void createConnections(); | ||||||
|  | 
 | ||||||
|  |   protected: | ||||||
|  |     Ui::FormAccountDetails m_ui; | ||||||
|  |     ServiceRoot* m_account; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif // FORMACCOUNTDETAILS_H
 | ||||||
							
								
								
									
										58
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/librssguard/services/abstract/gui/formaccountdetails.ui
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <ui version="4.0"> | ||||||
|  |  <class>FormAccountDetails</class> | ||||||
|  |  <widget class="QDialog" name="FormAccountDetails"> | ||||||
|  |   <property name="geometry"> | ||||||
|  |    <rect> | ||||||
|  |     <x>0</x> | ||||||
|  |     <y>0</y> | ||||||
|  |     <width>400</width> | ||||||
|  |     <height>300</height> | ||||||
|  |    </rect> | ||||||
|  |   </property> | ||||||
|  |   <property name="windowTitle"> | ||||||
|  |    <string>Dialog</string> | ||||||
|  |   </property> | ||||||
|  |   <layout class="QFormLayout" name="formLayout_2"> | ||||||
|  |    <item row="0" column="0" colspan="2"> | ||||||
|  |     <widget class="QTabWidget" name="m_tabWidget"> | ||||||
|  |      <property name="currentIndex"> | ||||||
|  |       <number>-1</number> | ||||||
|  |      </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> | ||||||
|  |      <property name="centerButtons"> | ||||||
|  |       <bool>false</bool> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |   </layout> | ||||||
|  |  </widget> | ||||||
|  |  <resources/> | ||||||
|  |  <connections> | ||||||
|  |   <connection> | ||||||
|  |    <sender>m_buttonBox</sender> | ||||||
|  |    <signal>rejected()</signal> | ||||||
|  |    <receiver>FormAccountDetails</receiver> | ||||||
|  |    <slot>reject()</slot> | ||||||
|  |    <hints> | ||||||
|  |     <hint type="sourcelabel"> | ||||||
|  |      <x>199</x> | ||||||
|  |      <y>279</y> | ||||||
|  |     </hint> | ||||||
|  |     <hint type="destinationlabel"> | ||||||
|  |      <x>199</x> | ||||||
|  |      <y>149</y> | ||||||
|  |     </hint> | ||||||
|  |    </hints> | ||||||
|  |   </connection> | ||||||
|  |  </connections> | ||||||
|  | </ui> | ||||||
|  | @ -83,7 +83,6 @@ void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FormFeedDetails::createConnections() { | void FormFeedDetails::createConnections() { | ||||||
|   // General connections.
 |  | ||||||
|   connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::apply); |   connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::apply); | ||||||
|   connect(m_ui->m_cmbAutoUpdateType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, |   connect(m_ui->m_cmbAutoUpdateType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, | ||||||
|           &FormFeedDetails::onAutoUpdateTypeChanged); |           &FormFeedDetails::onAutoUpdateTypeChanged); | ||||||
|  |  | ||||||
|  | @ -29,26 +29,25 @@ class FormFeedDetails : public QDialog { | ||||||
|   protected slots: |   protected slots: | ||||||
|     void activateTab(int index); |     void activateTab(int index); | ||||||
|     void clearTabs(); |     void clearTabs(); | ||||||
|     void insertCustomTab(QWidget* custom_tab, const QString& title, int index); |  | ||||||
| 
 | 
 | ||||||
|     // Applies changes.
 |     // Applies changes.
 | ||||||
|     // NOTE: This must be reimplemented in subclasses. Also this
 |     // NOTE: This must be reimplemented in subclasses. Also this
 | ||||||
|     // base implementation must be called first.
 |     // base implementation must be called first.
 | ||||||
|     virtual void apply(); |     virtual void apply(); | ||||||
| 
 | 
 | ||||||
|     void onAutoUpdateTypeChanged(int new_index); |  | ||||||
| 
 |  | ||||||
|   protected: |   protected: | ||||||
|  |     void insertCustomTab(QWidget* custom_tab, const QString& title, int index); | ||||||
| 
 | 
 | ||||||
|     // Sets the feed which will be edited.
 |     // Sets the feed which will be edited.
 | ||||||
|     // NOTE: This must be reimplemented in subclasses. Also this
 |     // NOTE: This must be reimplemented in subclasses. Also this
 | ||||||
|     // base implementation must be called first.
 |     // base implementation must be called first.
 | ||||||
|     void virtual setEditableFeed(Feed* editable_feed); |     void virtual setEditableFeed(Feed* editable_feed); | ||||||
| 
 | 
 | ||||||
|     // Creates needed connections.
 |   private slots: | ||||||
|     void createConnections(); |     void onAutoUpdateTypeChanged(int new_index); | ||||||
| 
 | 
 | ||||||
|     // Initializes the dialog.
 |   private: | ||||||
|  |     void createConnections(); | ||||||
|     void initialize(); |     void initialize(); | ||||||
| 
 | 
 | ||||||
|   protected: |   protected: | ||||||
|  |  | ||||||
|  | @ -2,254 +2,75 @@ | ||||||
| 
 | 
 | ||||||
| #include "services/tt-rss/gui/formeditttrssaccount.h" | #include "services/tt-rss/gui/formeditttrssaccount.h" | ||||||
| 
 | 
 | ||||||
| #include "gui/guiutilities.h" |  | ||||||
| #include "miscellaneous/iconfactory.h" | #include "miscellaneous/iconfactory.h" | ||||||
| #include "network-web/networkfactory.h" |  | ||||||
| #include "services/tt-rss/definitions.h" | #include "services/tt-rss/definitions.h" | ||||||
|  | #include "services/tt-rss/gui/ttrssaccountdetails.h" | ||||||
| #include "services/tt-rss/network/ttrssnetworkfactory.h" | #include "services/tt-rss/network/ttrssnetworkfactory.h" | ||||||
| #include "services/tt-rss/ttrssserviceroot.h" | #include "services/tt-rss/ttrssserviceroot.h" | ||||||
| 
 | 
 | ||||||
| FormEditTtRssAccount::FormEditTtRssAccount(QWidget* parent) | FormEditTtRssAccount::FormEditTtRssAccount(QWidget* parent) | ||||||
|   : QDialog(parent), m_ui(new Ui::FormEditTtRssAccount), m_editableRoot(nullptr) { |   : FormAccountDetails(qApp->icons()->miscIcon(QSL("tt-rss")), parent), m_details(new TtRssAccountDetails(this)) { | ||||||
|   m_ui->setupUi(this); |   insertCustomTab(m_details, tr("Server setup"), 0); | ||||||
|   m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok); |   activateTab(0); | ||||||
| 
 |  | ||||||
|   GuiUtilities::applyDialogProperties(*this, qApp->icons()->miscIcon(QSL("tt-rss"))); |  | ||||||
| 
 |  | ||||||
|   m_ui->m_lblTestResult->label()->setWordWrap(true); |  | ||||||
|   m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates " |  | ||||||
|                                                      "of feeds will be probably much slower and may time-out often.")); |  | ||||||
|   m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(TTRSS_MINIMAL_API_LEVEL)); |  | ||||||
|   m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username")); |  | ||||||
|   m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password")); |  | ||||||
|   m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account")); |  | ||||||
|   m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account")); |  | ||||||
|   m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your TT-RSS instance WITHOUT trailing \"/api/\" string")); |  | ||||||
|   m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information, |  | ||||||
|                                    tr("No test done yet."), |  | ||||||
|                                    tr("Here, results of connection test are shown.")); |  | ||||||
| 
 |  | ||||||
|   GuiUtilities::setLabelAsNotice(*m_ui->m_lblDescription, false); |  | ||||||
|   GuiUtilities::setLabelAsNotice(*m_ui->m_lblServerSideUpdateInformation, false); |  | ||||||
| 
 |  | ||||||
|   setTabOrder(m_ui->m_txtUrl->lineEdit(), m_ui->m_checkServerSideUpdate); |  | ||||||
|   setTabOrder(m_ui->m_checkServerSideUpdate, m_ui->m_txtUsername->lineEdit()); |  | ||||||
|   setTabOrder(m_ui->m_txtUsername->lineEdit(), m_ui->m_txtPassword->lineEdit()); |  | ||||||
|   setTabOrder(m_ui->m_txtPassword->lineEdit(), m_ui->m_checkShowPassword); |  | ||||||
|   setTabOrder(m_ui->m_checkShowPassword, m_ui->m_gbHttpAuthentication); |  | ||||||
|   setTabOrder(m_ui->m_gbHttpAuthentication, m_ui->m_txtHttpUsername->lineEdit()); |  | ||||||
|   setTabOrder(m_ui->m_txtHttpUsername->lineEdit(), m_ui->m_txtHttpPassword->lineEdit()); |  | ||||||
|   setTabOrder(m_ui->m_txtHttpPassword->lineEdit(), m_ui->m_checkShowHttpPassword); |  | ||||||
|   setTabOrder(m_ui->m_checkShowHttpPassword, m_ui->m_btnTestSetup); |  | ||||||
|   setTabOrder(m_ui->m_btnTestSetup, m_ui->m_buttonBox); |  | ||||||
| 
 |  | ||||||
|   connect(m_ui->m_checkShowPassword, &QCheckBox::toggled, this, &FormEditTtRssAccount::displayPassword); |  | ||||||
|   connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormEditTtRssAccount::onClickedOk); |  | ||||||
|   connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &FormEditTtRssAccount::onClickedCancel); |  | ||||||
|   connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onPasswordChanged); |  | ||||||
|   connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onUsernameChanged); |  | ||||||
|   connect(m_ui->m_txtHttpPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onHttpPasswordChanged); |  | ||||||
|   connect(m_ui->m_txtHttpUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onHttpUsernameChanged); |  | ||||||
|   connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::onUrlChanged); |  | ||||||
|   connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); |  | ||||||
|   connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); |  | ||||||
|   connect(m_ui->m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &FormEditTtRssAccount::checkOkButton); |  | ||||||
|   connect(m_ui->m_btnTestSetup, &QPushButton::clicked, this, &FormEditTtRssAccount::performTest); |  | ||||||
|   connect(m_ui->m_gbHttpAuthentication, &QGroupBox::toggled, this, &FormEditTtRssAccount::onHttpPasswordChanged); |  | ||||||
|   connect(m_ui->m_gbHttpAuthentication, &QGroupBox::toggled, this, &FormEditTtRssAccount::onHttpUsernameChanged); |  | ||||||
|   connect(m_ui->m_checkShowHttpPassword, &QCheckBox::toggled, this, &FormEditTtRssAccount::displayHttpPassword); |  | ||||||
| 
 |  | ||||||
|   onPasswordChanged(); |  | ||||||
|   onUsernameChanged(); |  | ||||||
|   onUrlChanged(); |  | ||||||
|   onHttpPasswordChanged(); |  | ||||||
|   onHttpUsernameChanged(); |  | ||||||
|   checkOkButton(); |  | ||||||
|   displayPassword(false); |  | ||||||
|   displayHttpPassword(false); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FormEditTtRssAccount::~FormEditTtRssAccount() = default; | TtRssServiceRoot* FormEditTtRssAccount::addEditAccount(TtRssServiceRoot* account_to_edit) { | ||||||
|  |   if (account_to_edit == nullptr) { | ||||||
|  |     // User is adding new TT-RSS account.
 | ||||||
|  |     setWindowTitle(tr("Add new TT-RSS account")); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     setEditableAccount(account_to_edit); | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
| TtRssServiceRoot* FormEditTtRssAccount::execForCreate() { |  | ||||||
|   setWindowTitle(tr("Add new Tiny Tiny RSS account")); |  | ||||||
|   exec(); |   exec(); | ||||||
|   return m_editableRoot; |   return ttRssAccount(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FormEditTtRssAccount::execForEdit(TtRssServiceRoot* existing_root) { | void FormEditTtRssAccount::apply() { | ||||||
|   setWindowTitle(tr("Edit existing Tiny Tiny RSS account")); |  | ||||||
|   m_editableRoot = existing_root; |  | ||||||
|   m_ui->m_gbHttpAuthentication->setChecked(existing_root->network()->authIsUsed()); |  | ||||||
|   m_ui->m_txtHttpPassword->lineEdit()->setText(existing_root->network()->authPassword()); |  | ||||||
|   m_ui->m_txtHttpUsername->lineEdit()->setText(existing_root->network()->authUsername()); |  | ||||||
|   m_ui->m_txtUsername->lineEdit()->setText(existing_root->network()->username()); |  | ||||||
|   m_ui->m_txtPassword->lineEdit()->setText(existing_root->network()->password()); |  | ||||||
|   m_ui->m_txtUrl->lineEdit()->setText(existing_root->network()->url()); |  | ||||||
|   m_ui->m_checkServerSideUpdate->setChecked(existing_root->network()->forceServerSideUpdate()); |  | ||||||
|   m_ui->m_checkDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages()); |  | ||||||
|   exec(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::displayPassword(bool display) { |  | ||||||
|   m_ui->m_txtPassword->lineEdit()->setEchoMode(display ? QLineEdit::Normal : QLineEdit::Password); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::displayHttpPassword(bool display) { |  | ||||||
|   m_ui->m_txtHttpPassword->lineEdit()->setEchoMode(display ? QLineEdit::Normal : QLineEdit::Password); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::performTest() { |  | ||||||
|   TtRssNetworkFactory factory; |  | ||||||
| 
 |  | ||||||
|   factory.setUsername(m_ui->m_txtUsername->lineEdit()->text()); |  | ||||||
|   factory.setPassword(m_ui->m_txtPassword->lineEdit()->text()); |  | ||||||
|   factory.setUrl(m_ui->m_txtUrl->lineEdit()->text()); |  | ||||||
|   factory.setAuthIsUsed(m_ui->m_gbHttpAuthentication->isChecked()); |  | ||||||
|   factory.setAuthUsername(m_ui->m_txtHttpUsername->lineEdit()->text()); |  | ||||||
|   factory.setAuthPassword(m_ui->m_txtHttpPassword->lineEdit()->text()); |  | ||||||
|   factory.setForceServerSideUpdate(m_ui->m_checkServerSideUpdate->isChecked()); |  | ||||||
| 
 |  | ||||||
|   TtRssLoginResponse result = factory.login(); |  | ||||||
| 
 |  | ||||||
|   if (result.isLoaded()) { |  | ||||||
|     if (result.hasError()) { |  | ||||||
|       QString error = result.error(); |  | ||||||
| 
 |  | ||||||
|       if (error == TTRSS_API_DISABLED) { |  | ||||||
|         m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                          tr("API access on selected server is not enabled."), |  | ||||||
|                                          tr("API access on selected server is not enabled.")); |  | ||||||
|       } |  | ||||||
|       else if (error == TTRSS_LOGIN_ERROR) { |  | ||||||
|         m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                          tr("Entered credentials are incorrect."), |  | ||||||
|                                          tr("Entered credentials are incorrect.")); |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                          tr("Other error occurred, contact developers."), |  | ||||||
|                                          tr("Other error occurred, contact developers.")); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) { |  | ||||||
|       m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                        tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()), |  | ||||||
|                                                                                                QString::number(TTRSS_MINIMAL_API_LEVEL)), |  | ||||||
|                                        tr("Selected Tiny Tiny RSS server is running unsupported version of API.")); |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok, |  | ||||||
|                                        tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()), |  | ||||||
|                                                                                                QString::number(TTRSS_MINIMAL_API_LEVEL)), |  | ||||||
|                                        tr("Tiny Tiny RSS server is okay.")); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   else if (factory.lastError()  != QNetworkReply::NoError) { |  | ||||||
|     m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                      tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())), |  | ||||||
|                                      tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?")); |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, |  | ||||||
|                                      tr("Unspecified error, did you enter correct URL?"), |  | ||||||
|                                      tr("Unspecified error, did you enter correct URL?")); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::onClickedOk() { |  | ||||||
|   bool editing_account = true; |   bool editing_account = true; | ||||||
| 
 | 
 | ||||||
|   if (m_editableRoot == nullptr) { |   if (m_account == nullptr) { | ||||||
|     // We want to confirm newly created account.
 |     // We want to confirm newly created account.
 | ||||||
|     // So save new account into DB, setup its properties.
 |     // So save new account into DB, setup its properties.
 | ||||||
|     m_editableRoot = new TtRssServiceRoot(); |     m_account = new TtRssServiceRoot(); | ||||||
|     editing_account = false; |     editing_account = false; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   m_editableRoot->network()->setUrl(m_ui->m_txtUrl->lineEdit()->text()); |   ttRssAccount()->network()->setUrl(m_details->m_ui.m_txtUrl->lineEdit()->text()); | ||||||
|   m_editableRoot->network()->setUsername(m_ui->m_txtUsername->lineEdit()->text()); |   ttRssAccount()->network()->setUsername(m_details->m_ui.m_txtUsername->lineEdit()->text()); | ||||||
|   m_editableRoot->network()->setPassword(m_ui->m_txtPassword->lineEdit()->text()); |   ttRssAccount()->network()->setPassword(m_details->m_ui.m_txtPassword->lineEdit()->text()); | ||||||
|   m_editableRoot->network()->setAuthIsUsed(m_ui->m_gbHttpAuthentication->isChecked()); |   ttRssAccount()->network()->setAuthIsUsed(m_details->m_ui.m_gbHttpAuthentication->isChecked()); | ||||||
|   m_editableRoot->network()->setAuthUsername(m_ui->m_txtHttpUsername->lineEdit()->text()); |   ttRssAccount()->network()->setAuthUsername(m_details->m_ui.m_txtHttpUsername->lineEdit()->text()); | ||||||
|   m_editableRoot->network()->setAuthPassword(m_ui->m_txtHttpPassword->lineEdit()->text()); |   ttRssAccount()->network()->setAuthPassword(m_details->m_ui.m_txtHttpPassword->lineEdit()->text()); | ||||||
|   m_editableRoot->network()->setForceServerSideUpdate(m_ui->m_checkServerSideUpdate->isChecked()); |   ttRssAccount()->network()->setForceServerSideUpdate(m_details->m_ui.m_checkServerSideUpdate->isChecked()); | ||||||
|   m_editableRoot->network()->setDownloadOnlyUnreadMessages(m_ui->m_checkDownloadOnlyUnreadMessages->isChecked()); |   ttRssAccount()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_checkDownloadOnlyUnreadMessages->isChecked()); | ||||||
| 
 | 
 | ||||||
|   m_editableRoot->saveAccountDataToDatabase(); |   ttRssAccount()->saveAccountDataToDatabase(); | ||||||
|   accept(); |   accept(); | ||||||
| 
 | 
 | ||||||
|   if (editing_account) { |   if (editing_account) { | ||||||
|     m_editableRoot->network()->logout(); |     ttRssAccount()->network()->logout(); | ||||||
|     m_editableRoot->completelyRemoveAllData(); |     ttRssAccount()->completelyRemoveAllData(); | ||||||
|     m_editableRoot->syncIn(); |     ttRssAccount()->syncIn(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FormEditTtRssAccount::onClickedCancel() { | void FormEditTtRssAccount::setEditableAccount(ServiceRoot* editable_account) { | ||||||
|   reject(); |   FormAccountDetails::setEditableAccount(editable_account); | ||||||
|  | 
 | ||||||
|  |   TtRssServiceRoot* existing_root = qobject_cast<TtRssServiceRoot*>(editable_account); | ||||||
|  | 
 | ||||||
|  |   m_details->m_ui.m_gbHttpAuthentication->setChecked(existing_root->network()->authIsUsed()); | ||||||
|  |   m_details->m_ui.m_txtHttpPassword->lineEdit()->setText(existing_root->network()->authPassword()); | ||||||
|  |   m_details->m_ui.m_txtHttpUsername->lineEdit()->setText(existing_root->network()->authUsername()); | ||||||
|  |   m_details->m_ui.m_txtUsername->lineEdit()->setText(existing_root->network()->username()); | ||||||
|  |   m_details->m_ui.m_txtPassword->lineEdit()->setText(existing_root->network()->password()); | ||||||
|  |   m_details->m_ui.m_txtUrl->lineEdit()->setText(existing_root->network()->url()); | ||||||
|  |   m_details->m_ui.m_checkServerSideUpdate->setChecked(existing_root->network()->forceServerSideUpdate()); | ||||||
|  |   m_details->m_ui.m_checkDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FormEditTtRssAccount::onUsernameChanged() { | TtRssServiceRoot* FormEditTtRssAccount::ttRssAccount() const { | ||||||
|   const QString username = m_ui->m_txtUsername->lineEdit()->text(); |   return qobject_cast<TtRssServiceRoot*>(m_account); | ||||||
| 
 |  | ||||||
|   if (username.isEmpty()) { |  | ||||||
|     m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Error, tr("Username cannot be empty.")); |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     m_ui->m_txtUsername->setStatus(WidgetWithStatus::StatusType::Ok, tr("Username is okay.")); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::onPasswordChanged() { |  | ||||||
|   const QString password = m_ui->m_txtPassword->lineEdit()->text(); |  | ||||||
| 
 |  | ||||||
|   if (password.isEmpty()) { |  | ||||||
|     m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Error, tr("Password cannot be empty.")); |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     m_ui->m_txtPassword->setStatus(WidgetWithStatus::StatusType::Ok, tr("Password is okay.")); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::onHttpUsernameChanged() { |  | ||||||
|   const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpUsername->lineEdit()->text().isEmpty(); |  | ||||||
| 
 |  | ||||||
|   m_ui->m_txtHttpUsername->setStatus(is_username_ok ? |  | ||||||
|                                      LineEditWithStatus::StatusType::Ok : |  | ||||||
|                                      LineEditWithStatus::StatusType::Warning, |  | ||||||
|                                      is_username_ok ? |  | ||||||
|                                      tr("Username is ok or it is not needed.") : |  | ||||||
|                                      tr("Username is empty.")); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::onHttpPasswordChanged() { |  | ||||||
|   const bool is_username_ok = !m_ui->m_gbHttpAuthentication->isChecked() || !m_ui->m_txtHttpPassword->lineEdit()->text().isEmpty(); |  | ||||||
| 
 |  | ||||||
|   m_ui->m_txtHttpPassword->setStatus(is_username_ok ? |  | ||||||
|                                      LineEditWithStatus::StatusType::Ok : |  | ||||||
|                                      LineEditWithStatus::StatusType::Warning, |  | ||||||
|                                      is_username_ok ? |  | ||||||
|                                      tr("Password is ok or it is not needed.") : |  | ||||||
|                                      tr("Password is empty.")); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::onUrlChanged() { |  | ||||||
|   const QString url = m_ui->m_txtUrl->lineEdit()->text(); |  | ||||||
| 
 |  | ||||||
|   if (url.isEmpty()) { |  | ||||||
|     m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Error, tr("URL cannot be empty.")); |  | ||||||
|   } |  | ||||||
|   else if (url.endsWith(QL1S("/api/")) || url.endsWith(QL1S("/api"))) { |  | ||||||
|     m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Warning, tr("URL should NOT end with \"/api/\".")); |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     m_ui->m_txtUrl->setStatus(WidgetWithStatus::StatusType::Ok, tr("URL is okay.")); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void FormEditTtRssAccount::checkOkButton() { |  | ||||||
|   m_btnOk->setEnabled(!m_ui->m_txtUsername->lineEdit()->text().isEmpty() && |  | ||||||
|                       !m_ui->m_txtPassword->lineEdit()->text().isEmpty() && |  | ||||||
|                       !m_ui->m_txtUrl->lineEdit()->text().isEmpty()); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,45 +3,31 @@ | ||||||
| #ifndef FORMEDITACCOUNT_H | #ifndef FORMEDITACCOUNT_H | ||||||
| #define FORMEDITACCOUNT_H | #define FORMEDITACCOUNT_H | ||||||
| 
 | 
 | ||||||
| #include <QDialog> | #include "services/abstract/gui/formaccountdetails.h" | ||||||
| 
 |  | ||||||
| #include "ui_formeditttrssaccount.h" |  | ||||||
| 
 |  | ||||||
| namespace Ui { |  | ||||||
|   class FormEditTtRssAccount; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
|  | class RootItem; | ||||||
| class TtRssServiceRoot; | class TtRssServiceRoot; | ||||||
|  | class TtRssAccountDetails; | ||||||
| 
 | 
 | ||||||
| class FormEditTtRssAccount : public QDialog { | class FormEditTtRssAccount : public FormAccountDetails { | ||||||
|   Q_OBJECT |   Q_OBJECT | ||||||
| 
 | 
 | ||||||
|   public: |   public: | ||||||
|     explicit FormEditTtRssAccount(QWidget* parent = 0); |     explicit FormEditTtRssAccount(QWidget* parent = nullptr); | ||||||
|     virtual ~FormEditTtRssAccount(); |  | ||||||
| 
 | 
 | ||||||
|     TtRssServiceRoot* execForCreate(); |     TtRssServiceRoot* addEditAccount(TtRssServiceRoot* account_to_edit = nullptr); | ||||||
| 
 | 
 | ||||||
|     void execForEdit(TtRssServiceRoot* existing_root); |   protected slots: | ||||||
|  |     virtual void apply(); | ||||||
| 
 | 
 | ||||||
|   private slots: |   protected: | ||||||
|     void displayPassword(bool display); |     virtual void setEditableAccount(ServiceRoot* editable_account); | ||||||
|     void displayHttpPassword(bool display); |  | ||||||
|     void performTest(); |  | ||||||
|     void onClickedOk(); |  | ||||||
|     void onClickedCancel(); |  | ||||||
| 
 |  | ||||||
|     void onUsernameChanged(); |  | ||||||
|     void onPasswordChanged(); |  | ||||||
|     void onHttpUsernameChanged(); |  | ||||||
|     void onHttpPasswordChanged(); |  | ||||||
|     void onUrlChanged(); |  | ||||||
|     void checkOkButton(); |  | ||||||
| 
 | 
 | ||||||
|   private: |   private: | ||||||
|     QScopedPointer<Ui::FormEditTtRssAccount> m_ui; |     TtRssServiceRoot* ttRssAccount() const; | ||||||
|     TtRssServiceRoot* m_editableRoot; | 
 | ||||||
|     QPushButton* m_btnOk; |   private: | ||||||
|  |     TtRssAccountDetails* m_details; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif // FORMEDITACCOUNT_H
 | #endif // FORMEDITACCOUNT_H
 | ||||||
|  |  | ||||||
|  | @ -1,246 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <ui version="4.0"> |  | ||||||
|  <class>FormEditTtRssAccount</class> |  | ||||||
|  <widget class="QDialog" name="FormEditTtRssAccount"> |  | ||||||
|   <property name="geometry"> |  | ||||||
|    <rect> |  | ||||||
|     <x>0</x> |  | ||||||
|     <y>0</y> |  | ||||||
|     <width>604</width> |  | ||||||
|     <height>517</height> |  | ||||||
|    </rect> |  | ||||||
|   </property> |  | ||||||
|   <property name="windowTitle"> |  | ||||||
|    <string notr="true">Dialog</string> |  | ||||||
|   </property> |  | ||||||
|   <layout class="QVBoxLayout" name="verticalLayout"> |  | ||||||
|    <item> |  | ||||||
|     <layout class="QFormLayout" name="formLayout"> |  | ||||||
|      <item row="7" column="0"> |  | ||||||
|       <widget class="QPushButton" name="m_btnTestSetup"> |  | ||||||
|        <property name="text"> |  | ||||||
|         <string>&Test setup</string> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="5" column="0" colspan="2"> |  | ||||||
|       <widget class="QGroupBox" name="m_gbAuthentication"> |  | ||||||
|        <property name="toolTip"> |  | ||||||
|         <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> |  | ||||||
|        </property> |  | ||||||
|        <property name="title"> |  | ||||||
|         <string>Authentication</string> |  | ||||||
|        </property> |  | ||||||
|        <property name="flat"> |  | ||||||
|         <bool>false</bool> |  | ||||||
|        </property> |  | ||||||
|        <property name="checked"> |  | ||||||
|         <bool>false</bool> |  | ||||||
|        </property> |  | ||||||
|        <layout class="QFormLayout" name="formLayout_2"> |  | ||||||
|         <item row="0" column="0"> |  | ||||||
|          <widget class="QLabel" name="label_4"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Username</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="buddy"> |  | ||||||
|            <cstring>m_txtUsername</cstring> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item row="1" column="0"> |  | ||||||
|          <widget class="QLabel" name="label_5"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Password</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="buddy"> |  | ||||||
|            <cstring>m_txtPassword</cstring> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item row="1" column="1"> |  | ||||||
|          <widget class="LineEditWithStatus" name="m_txtPassword" native="true"/> |  | ||||||
|         </item> |  | ||||||
|         <item row="0" column="1"> |  | ||||||
|          <widget class="LineEditWithStatus" name="m_txtUsername" native="true"/> |  | ||||||
|         </item> |  | ||||||
|         <item row="2" column="1"> |  | ||||||
|          <widget class="QCheckBox" name="m_checkShowPassword"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Show password</string> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|        </layout> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="6" column="0" colspan="2"> |  | ||||||
|       <widget class="QGroupBox" name="m_gbHttpAuthentication"> |  | ||||||
|        <property name="toolTip"> |  | ||||||
|         <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> |  | ||||||
|        </property> |  | ||||||
|        <property name="title"> |  | ||||||
|         <string>Requires HTTP authentication</string> |  | ||||||
|        </property> |  | ||||||
|        <property name="flat"> |  | ||||||
|         <bool>false</bool> |  | ||||||
|        </property> |  | ||||||
|        <property name="checkable"> |  | ||||||
|         <bool>true</bool> |  | ||||||
|        </property> |  | ||||||
|        <property name="checked"> |  | ||||||
|         <bool>false</bool> |  | ||||||
|        </property> |  | ||||||
|        <layout class="QFormLayout" name="formLayout_3"> |  | ||||||
|         <item row="0" column="0"> |  | ||||||
|          <widget class="QLabel" name="label_6"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Username</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="buddy"> |  | ||||||
|            <cstring>m_txtHttpUsername</cstring> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item row="0" column="1"> |  | ||||||
|          <widget class="LineEditWithStatus" name="m_txtHttpUsername" native="true"/> |  | ||||||
|         </item> |  | ||||||
|         <item row="1" column="0"> |  | ||||||
|          <widget class="QLabel" name="label_7"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Password</string> |  | ||||||
|           </property> |  | ||||||
|           <property name="buddy"> |  | ||||||
|            <cstring>m_txtHttpPassword</cstring> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item row="1" column="1"> |  | ||||||
|          <widget class="LineEditWithStatus" name="m_txtHttpPassword" native="true"/> |  | ||||||
|         </item> |  | ||||||
|         <item row="2" column="1"> |  | ||||||
|          <widget class="QCheckBox" name="m_checkShowHttpPassword"> |  | ||||||
|           <property name="text"> |  | ||||||
|            <string>Show password</string> |  | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|        </layout> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="0" column="0" colspan="2"> |  | ||||||
|       <layout class="QHBoxLayout" name="horizontalLayout"> |  | ||||||
|        <item> |  | ||||||
|         <widget class="QLabel" name="m_lblTitle"> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>URL</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="buddy"> |  | ||||||
|           <cstring>m_txtUrl</cstring> |  | ||||||
|          </property> |  | ||||||
|         </widget> |  | ||||||
|        </item> |  | ||||||
|        <item> |  | ||||||
|         <widget class="LineEditWithStatus" name="m_txtUrl" native="true"/> |  | ||||||
|        </item> |  | ||||||
|       </layout> |  | ||||||
|      </item> |  | ||||||
|      <item row="1" column="0" colspan="2"> |  | ||||||
|       <widget class="QLabel" name="m_lblDescription"> |  | ||||||
|        <property name="text"> |  | ||||||
|         <string/> |  | ||||||
|        </property> |  | ||||||
|        <property name="wordWrap"> |  | ||||||
|         <bool>true</bool> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="4" column="0" colspan="2"> |  | ||||||
|       <widget class="QLabel" name="m_lblServerSideUpdateInformation"> |  | ||||||
|        <property name="text"> |  | ||||||
|         <string/> |  | ||||||
|        </property> |  | ||||||
|        <property name="wordWrap"> |  | ||||||
|         <bool>true</bool> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="3" column="0" colspan="2"> |  | ||||||
|       <widget class="QCheckBox" name="m_checkServerSideUpdate"> |  | ||||||
|        <property name="text"> |  | ||||||
|         <string>Force execution of server-side update when updating feeds from RSS Guard</string> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="2" column="0" colspan="2"> |  | ||||||
|       <widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages"> |  | ||||||
|        <property name="text"> |  | ||||||
|         <string>Download only unread messages</string> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="7" column="1"> |  | ||||||
|       <widget class="LabelWithStatus" name="m_lblTestResult" native="true"> |  | ||||||
|        <property name="sizePolicy"> |  | ||||||
|         <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |  | ||||||
|          <horstretch>0</horstretch> |  | ||||||
|          <verstretch>0</verstretch> |  | ||||||
|         </sizepolicy> |  | ||||||
|        </property> |  | ||||||
|        <property name="layoutDirection"> |  | ||||||
|         <enum>Qt::RightToLeft</enum> |  | ||||||
|        </property> |  | ||||||
|       </widget> |  | ||||||
|      </item> |  | ||||||
|      <item row="8" column="0" colspan="2"> |  | ||||||
|       <spacer name="verticalSpacer"> |  | ||||||
|        <property name="orientation"> |  | ||||||
|         <enum>Qt::Vertical</enum> |  | ||||||
|        </property> |  | ||||||
|        <property name="sizeHint" stdset="0"> |  | ||||||
|         <size> |  | ||||||
|          <width>20</width> |  | ||||||
|          <height>68</height> |  | ||||||
|         </size> |  | ||||||
|        </property> |  | ||||||
|       </spacer> |  | ||||||
|      </item> |  | ||||||
|     </layout> |  | ||||||
|    </item> |  | ||||||
|    <item> |  | ||||||
|     <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> |  | ||||||
|  <customwidgets> |  | ||||||
|   <customwidget> |  | ||||||
|    <class>LineEditWithStatus</class> |  | ||||||
|    <extends>QWidget</extends> |  | ||||||
|    <header>lineeditwithstatus.h</header> |  | ||||||
|    <container>1</container> |  | ||||||
|   </customwidget> |  | ||||||
|   <customwidget> |  | ||||||
|    <class>LabelWithStatus</class> |  | ||||||
|    <extends>QWidget</extends> |  | ||||||
|    <header>labelwithstatus.h</header> |  | ||||||
|    <container>1</container> |  | ||||||
|   </customwidget> |  | ||||||
|  </customwidgets> |  | ||||||
|  <tabstops> |  | ||||||
|   <tabstop>m_checkDownloadOnlyUnreadMessages</tabstop> |  | ||||||
|   <tabstop>m_checkServerSideUpdate</tabstop> |  | ||||||
|   <tabstop>m_checkShowPassword</tabstop> |  | ||||||
|   <tabstop>m_gbHttpAuthentication</tabstop> |  | ||||||
|   <tabstop>m_checkShowHttpPassword</tabstop> |  | ||||||
|   <tabstop>m_btnTestSetup</tabstop> |  | ||||||
|  </tabstops> |  | ||||||
|  <resources/> |  | ||||||
|  <connections/> |  | ||||||
| </ui> |  | ||||||
							
								
								
									
										181
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,181 @@ | ||||||
|  | // For license of this file, see <project-root-folder>/LICENSE.md.
 | ||||||
|  | 
 | ||||||
|  | #include "services/tt-rss/gui/ttrssaccountdetails.h" | ||||||
|  | 
 | ||||||
|  | #include "gui/guiutilities.h" | ||||||
|  | #include "network-web/networkfactory.h" | ||||||
|  | #include "services/tt-rss/definitions.h" | ||||||
|  | #include "services/tt-rss/network/ttrssnetworkfactory.h" | ||||||
|  | 
 | ||||||
|  | TtRssAccountDetails::TtRssAccountDetails(QWidget* parent) : QWidget(parent) { | ||||||
|  |   m_ui.setupUi(this); | ||||||
|  | 
 | ||||||
|  |   m_ui.m_lblTestResult->label()->setWordWrap(true); | ||||||
|  |   m_ui.m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates " | ||||||
|  |                                                     "of feeds will be probably much slower and may time-out often.")); | ||||||
|  |   m_ui.m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(TTRSS_MINIMAL_API_LEVEL)); | ||||||
|  |   m_ui.m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username")); | ||||||
|  |   m_ui.m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password")); | ||||||
|  |   m_ui.m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account")); | ||||||
|  |   m_ui.m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account")); | ||||||
|  |   m_ui.m_txtUrl->lineEdit()->setPlaceholderText(tr("URL of your TT-RSS instance WITHOUT trailing \"/api/\" string")); | ||||||
|  |   m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Information, | ||||||
|  |                                   tr("No test done yet."), | ||||||
|  |                                   tr("Here, results of connection test are shown.")); | ||||||
|  | 
 | ||||||
|  |   GuiUtilities::setLabelAsNotice(*m_ui.m_lblDescription, false); | ||||||
|  |   GuiUtilities::setLabelAsNotice(*m_ui.m_lblServerSideUpdateInformation, false); | ||||||
|  | 
 | ||||||
|  |   setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkServerSideUpdate); | ||||||
|  |   setTabOrder(m_ui.m_checkServerSideUpdate, m_ui.m_txtUsername->lineEdit()); | ||||||
|  |   setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit()); | ||||||
|  |   setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_checkShowPassword); | ||||||
|  |   setTabOrder(m_ui.m_checkShowPassword, m_ui.m_gbHttpAuthentication); | ||||||
|  |   setTabOrder(m_ui.m_gbHttpAuthentication, m_ui.m_txtHttpUsername->lineEdit()); | ||||||
|  |   setTabOrder(m_ui.m_txtHttpUsername->lineEdit(), m_ui.m_txtHttpPassword->lineEdit()); | ||||||
|  |   setTabOrder(m_ui.m_txtHttpPassword->lineEdit(), m_ui.m_checkShowHttpPassword); | ||||||
|  |   setTabOrder(m_ui.m_checkShowHttpPassword, m_ui.m_btnTestSetup); | ||||||
|  | 
 | ||||||
|  |   connect(m_ui.m_checkShowPassword, &QCheckBox::toggled, this, &TtRssAccountDetails::displayPassword); | ||||||
|  |   connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onPasswordChanged); | ||||||
|  |   connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onUsernameChanged); | ||||||
|  |   connect(m_ui.m_txtHttpPassword->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onHttpPasswordChanged); | ||||||
|  |   connect(m_ui.m_txtHttpUsername->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onHttpUsernameChanged); | ||||||
|  |   connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onUrlChanged); | ||||||
|  |   connect(m_ui.m_btnTestSetup, &QPushButton::clicked, this, &TtRssAccountDetails::performTest); | ||||||
|  |   connect(m_ui.m_gbHttpAuthentication, &QGroupBox::toggled, this, &TtRssAccountDetails::onHttpPasswordChanged); | ||||||
|  |   connect(m_ui.m_gbHttpAuthentication, &QGroupBox::toggled, this, &TtRssAccountDetails::onHttpUsernameChanged); | ||||||
|  |   connect(m_ui.m_checkShowHttpPassword, &QCheckBox::toggled, this, &TtRssAccountDetails::displayHttpPassword); | ||||||
|  | 
 | ||||||
|  |   onPasswordChanged(); | ||||||
|  |   onUsernameChanged(); | ||||||
|  |   onUrlChanged(); | ||||||
|  |   onHttpPasswordChanged(); | ||||||
|  |   onHttpUsernameChanged(); | ||||||
|  |   displayPassword(false); | ||||||
|  |   displayHttpPassword(false); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::displayPassword(bool display) { | ||||||
|  |   m_ui.m_txtPassword->lineEdit()->setEchoMode(display ? QLineEdit::Normal : QLineEdit::Password); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::displayHttpPassword(bool display) { | ||||||
|  |   m_ui.m_txtHttpPassword->lineEdit()->setEchoMode(display ? QLineEdit::Normal : QLineEdit::Password); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::performTest() { | ||||||
|  |   TtRssNetworkFactory factory; | ||||||
|  | 
 | ||||||
|  |   factory.setUsername(m_ui.m_txtUsername->lineEdit()->text()); | ||||||
|  |   factory.setPassword(m_ui.m_txtPassword->lineEdit()->text()); | ||||||
|  |   factory.setUrl(m_ui.m_txtUrl->lineEdit()->text()); | ||||||
|  |   factory.setAuthIsUsed(m_ui.m_gbHttpAuthentication->isChecked()); | ||||||
|  |   factory.setAuthUsername(m_ui.m_txtHttpUsername->lineEdit()->text()); | ||||||
|  |   factory.setAuthPassword(m_ui.m_txtHttpPassword->lineEdit()->text()); | ||||||
|  |   factory.setForceServerSideUpdate(m_ui.m_checkServerSideUpdate->isChecked()); | ||||||
|  | 
 | ||||||
|  |   TtRssLoginResponse result = factory.login(); | ||||||
|  | 
 | ||||||
|  |   if (result.isLoaded()) { | ||||||
|  |     if (result.hasError()) { | ||||||
|  |       QString error = result.error(); | ||||||
|  | 
 | ||||||
|  |       if (error == TTRSS_API_DISABLED) { | ||||||
|  |         m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                         tr("API access on selected server is not enabled."), | ||||||
|  |                                         tr("API access on selected server is not enabled.")); | ||||||
|  |       } | ||||||
|  |       else if (error == TTRSS_LOGIN_ERROR) { | ||||||
|  |         m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                         tr("Entered credentials are incorrect."), | ||||||
|  |                                         tr("Entered credentials are incorrect.")); | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                         tr("Other error occurred, contact developers."), | ||||||
|  |                                         tr("Other error occurred, contact developers.")); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) { | ||||||
|  |       m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                       tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()), | ||||||
|  |                                                                                               QString::number(TTRSS_MINIMAL_API_LEVEL)), | ||||||
|  |                                       tr("Selected Tiny Tiny RSS server is running unsupported version of API.")); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok, | ||||||
|  |                                       tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()), | ||||||
|  |                                                                                               QString::number(TTRSS_MINIMAL_API_LEVEL)), | ||||||
|  |                                       tr("Tiny Tiny RSS server is okay.")); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   else if (factory.lastError()  != QNetworkReply::NoError) { | ||||||
|  |     m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                     tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())), | ||||||
|  |                                     tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?")); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error, | ||||||
|  |                                     tr("Unspecified error, did you enter correct URL?"), | ||||||
|  |                                     tr("Unspecified error, did you enter correct URL?")); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::onUsernameChanged() { | ||||||
|  |   const QString username = m_ui.m_txtUsername->lineEdit()->text(); | ||||||
|  | 
 | ||||||
|  |   if (username.isEmpty()) { | ||||||
|  |     m_ui.m_txtUsername->setStatus(WidgetWithStatus::StatusType::Error, tr("Username cannot be empty.")); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     m_ui.m_txtUsername->setStatus(WidgetWithStatus::StatusType::Ok, tr("Username is okay.")); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::onPasswordChanged() { | ||||||
|  |   const QString password = m_ui.m_txtPassword->lineEdit()->text(); | ||||||
|  | 
 | ||||||
|  |   if (password.isEmpty()) { | ||||||
|  |     m_ui.m_txtPassword->setStatus(WidgetWithStatus::StatusType::Error, tr("Password cannot be empty.")); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     m_ui.m_txtPassword->setStatus(WidgetWithStatus::StatusType::Ok, tr("Password is okay.")); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::onHttpUsernameChanged() { | ||||||
|  |   const bool is_username_ok = !m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpUsername->lineEdit()->text().isEmpty(); | ||||||
|  | 
 | ||||||
|  |   m_ui.m_txtHttpUsername->setStatus(is_username_ok ? | ||||||
|  |                                     LineEditWithStatus::StatusType::Ok : | ||||||
|  |                                     LineEditWithStatus::StatusType::Warning, | ||||||
|  |                                     is_username_ok ? | ||||||
|  |                                     tr("Username is ok or it is not needed.") : | ||||||
|  |                                     tr("Username is empty.")); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::onHttpPasswordChanged() { | ||||||
|  |   const bool is_username_ok = !m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpPassword->lineEdit()->text().isEmpty(); | ||||||
|  | 
 | ||||||
|  |   m_ui.m_txtHttpPassword->setStatus(is_username_ok ? | ||||||
|  |                                     LineEditWithStatus::StatusType::Ok : | ||||||
|  |                                     LineEditWithStatus::StatusType::Warning, | ||||||
|  |                                     is_username_ok ? | ||||||
|  |                                     tr("Password is ok or it is not needed.") : | ||||||
|  |                                     tr("Password is empty.")); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TtRssAccountDetails::onUrlChanged() { | ||||||
|  |   const QString url = m_ui.m_txtUrl->lineEdit()->text(); | ||||||
|  | 
 | ||||||
|  |   if (url.isEmpty()) { | ||||||
|  |     m_ui.m_txtUrl->setStatus(WidgetWithStatus::StatusType::Error, tr("URL cannot be empty.")); | ||||||
|  |   } | ||||||
|  |   else if (url.endsWith(QL1S("/api/")) || url.endsWith(QL1S("/api"))) { | ||||||
|  |     m_ui.m_txtUrl->setStatus(WidgetWithStatus::StatusType::Warning, tr("URL should NOT end with \"/api/\".")); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     m_ui.m_txtUrl->setStatus(WidgetWithStatus::StatusType::Ok, tr("URL is okay.")); | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | // For license of this file, see <project-root-folder>/LICENSE.md.
 | ||||||
|  | 
 | ||||||
|  | #ifndef TTRSSACCOUNTDETAILS_H | ||||||
|  | #define TTRSSACCOUNTDETAILS_H | ||||||
|  | 
 | ||||||
|  | #include <QWidget> | ||||||
|  | 
 | ||||||
|  | #include "ui_ttrssaccountdetails.h" | ||||||
|  | 
 | ||||||
|  | class TtRssServiceRoot; | ||||||
|  | 
 | ||||||
|  | class TtRssAccountDetails : public QWidget { | ||||||
|  |   Q_OBJECT | ||||||
|  | 
 | ||||||
|  |   friend class FormEditTtRssAccount; | ||||||
|  | 
 | ||||||
|  |   public: | ||||||
|  |     explicit TtRssAccountDetails(QWidget* parent = nullptr); | ||||||
|  | 
 | ||||||
|  |   private slots: | ||||||
|  |     void displayPassword(bool display); | ||||||
|  |     void displayHttpPassword(bool display); | ||||||
|  |     void performTest(); | ||||||
|  | 
 | ||||||
|  |     void onUsernameChanged(); | ||||||
|  |     void onPasswordChanged(); | ||||||
|  |     void onHttpUsernameChanged(); | ||||||
|  |     void onHttpPasswordChanged(); | ||||||
|  |     void onUrlChanged(); | ||||||
|  | 
 | ||||||
|  |   private: | ||||||
|  |     Ui::TtRssAccountDetails m_ui; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif // TTRSSACCOUNTDETAILS_H
 | ||||||
							
								
								
									
										224
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										224
									
								
								src/librssguard/services/tt-rss/gui/ttrssaccountdetails.ui
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,224 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <ui version="4.0"> | ||||||
|  |  <class>TtRssAccountDetails</class> | ||||||
|  |  <widget class="QWidget" name="TtRssAccountDetails"> | ||||||
|  |   <property name="geometry"> | ||||||
|  |    <rect> | ||||||
|  |     <x>0</x> | ||||||
|  |     <y>0</y> | ||||||
|  |     <width>429</width> | ||||||
|  |     <height>373</height> | ||||||
|  |    </rect> | ||||||
|  |   </property> | ||||||
|  |   <property name="windowTitle"> | ||||||
|  |    <string>Form</string> | ||||||
|  |   </property> | ||||||
|  |   <layout class="QFormLayout" name="formLayout"> | ||||||
|  |    <item row="2" column="0" colspan="2"> | ||||||
|  |     <widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Download only unread messages</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="0" colspan="2"> | ||||||
|  |     <widget class="QCheckBox" name="m_checkServerSideUpdate"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Force execution of server-side update when updating feeds from RSS Guard</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="5" column="0" colspan="2"> | ||||||
|  |     <widget class="QGroupBox" name="m_gbAuthentication"> | ||||||
|  |      <property name="toolTip"> | ||||||
|  |       <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="title"> | ||||||
|  |       <string>Authentication</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="flat"> | ||||||
|  |       <bool>false</bool> | ||||||
|  |      </property> | ||||||
|  |      <property name="checked"> | ||||||
|  |       <bool>false</bool> | ||||||
|  |      </property> | ||||||
|  |      <layout class="QFormLayout" name="formLayout_2"> | ||||||
|  |       <item row="0" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_4"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Username</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="buddy"> | ||||||
|  |          <cstring>m_txtUsername</cstring> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_5"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Password</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="buddy"> | ||||||
|  |          <cstring>m_txtPassword</cstring> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="1"> | ||||||
|  |        <widget class="LineEditWithStatus" name="m_txtPassword" native="true"/> | ||||||
|  |       </item> | ||||||
|  |       <item row="0" column="1"> | ||||||
|  |        <widget class="LineEditWithStatus" name="m_txtUsername" native="true"/> | ||||||
|  |       </item> | ||||||
|  |       <item row="2" column="1"> | ||||||
|  |        <widget class="QCheckBox" name="m_checkShowPassword"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Show password</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |      </layout> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="6" column="0" colspan="2"> | ||||||
|  |     <widget class="QGroupBox" name="m_gbHttpAuthentication"> | ||||||
|  |      <property name="toolTip"> | ||||||
|  |       <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="title"> | ||||||
|  |       <string>Requires HTTP authentication</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="flat"> | ||||||
|  |       <bool>false</bool> | ||||||
|  |      </property> | ||||||
|  |      <property name="checkable"> | ||||||
|  |       <bool>true</bool> | ||||||
|  |      </property> | ||||||
|  |      <property name="checked"> | ||||||
|  |       <bool>false</bool> | ||||||
|  |      </property> | ||||||
|  |      <layout class="QFormLayout" name="formLayout_3"> | ||||||
|  |       <item row="0" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_6"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Username</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="buddy"> | ||||||
|  |          <cstring>m_txtHttpUsername</cstring> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="0" column="1"> | ||||||
|  |        <widget class="LineEditWithStatus" name="m_txtHttpUsername" native="true"/> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_7"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Password</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="buddy"> | ||||||
|  |          <cstring>m_txtHttpPassword</cstring> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="1"> | ||||||
|  |        <widget class="LineEditWithStatus" name="m_txtHttpPassword" native="true"/> | ||||||
|  |       </item> | ||||||
|  |       <item row="2" column="1"> | ||||||
|  |        <widget class="QCheckBox" name="m_checkShowHttpPassword"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Show password</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |      </layout> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="7" column="0"> | ||||||
|  |     <widget class="QPushButton" name="m_btnTestSetup"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>&Test setup</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="7" column="1"> | ||||||
|  |     <widget class="LabelWithStatus" name="m_lblTestResult" native="true"> | ||||||
|  |      <property name="sizePolicy"> | ||||||
|  |       <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | ||||||
|  |        <horstretch>0</horstretch> | ||||||
|  |        <verstretch>0</verstretch> | ||||||
|  |       </sizepolicy> | ||||||
|  |      </property> | ||||||
|  |      <property name="layoutDirection"> | ||||||
|  |       <enum>Qt::RightToLeft</enum> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="8" column="0" colspan="2"> | ||||||
|  |     <spacer name="verticalSpacer"> | ||||||
|  |      <property name="orientation"> | ||||||
|  |       <enum>Qt::Vertical</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="sizeHint" stdset="0"> | ||||||
|  |       <size> | ||||||
|  |        <width>408</width> | ||||||
|  |        <height>30</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |     </spacer> | ||||||
|  |    </item> | ||||||
|  |    <item row="0" column="0" colspan="2"> | ||||||
|  |     <layout class="QHBoxLayout" name="horizontalLayout"> | ||||||
|  |      <item> | ||||||
|  |       <widget class="QLabel" name="m_lblTitle"> | ||||||
|  |        <property name="text"> | ||||||
|  |         <string>URL</string> | ||||||
|  |        </property> | ||||||
|  |        <property name="buddy"> | ||||||
|  |         <cstring>m_txtUrl</cstring> | ||||||
|  |        </property> | ||||||
|  |       </widget> | ||||||
|  |      </item> | ||||||
|  |      <item> | ||||||
|  |       <widget class="LineEditWithStatus" name="m_txtUrl" native="true"/> | ||||||
|  |      </item> | ||||||
|  |     </layout> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="0" colspan="2"> | ||||||
|  |     <widget class="QLabel" name="m_lblDescription"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string/> | ||||||
|  |      </property> | ||||||
|  |      <property name="wordWrap"> | ||||||
|  |       <bool>true</bool> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="4" column="0" colspan="2"> | ||||||
|  |     <widget class="QLabel" name="m_lblServerSideUpdateInformation"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string/> | ||||||
|  |      </property> | ||||||
|  |      <property name="wordWrap"> | ||||||
|  |       <bool>true</bool> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |   </layout> | ||||||
|  |  </widget> | ||||||
|  |  <customwidgets> | ||||||
|  |   <customwidget> | ||||||
|  |    <class>LineEditWithStatus</class> | ||||||
|  |    <extends>QWidget</extends> | ||||||
|  |    <header>lineeditwithstatus.h</header> | ||||||
|  |    <container>1</container> | ||||||
|  |   </customwidget> | ||||||
|  |   <customwidget> | ||||||
|  |    <class>LabelWithStatus</class> | ||||||
|  |    <extends>QWidget</extends> | ||||||
|  |    <header>labelwithstatus.h</header> | ||||||
|  |    <container>1</container> | ||||||
|  |   </customwidget> | ||||||
|  |  </customwidgets> | ||||||
|  |  <resources/> | ||||||
|  |  <connections/> | ||||||
|  | </ui> | ||||||
|  | @ -39,7 +39,7 @@ QString TtRssServiceEntryPoint::code() const { | ||||||
| ServiceRoot* TtRssServiceEntryPoint::createNewRoot() const { | ServiceRoot* TtRssServiceEntryPoint::createNewRoot() const { | ||||||
|   FormEditTtRssAccount form_acc(qApp->mainFormWidget()); |   FormEditTtRssAccount form_acc(qApp->mainFormWidget()); | ||||||
| 
 | 
 | ||||||
|   return form_acc.execForCreate(); |   return form_acc.addEditAccount(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QList<ServiceRoot*> TtRssServiceEntryPoint::initializeSubtree() const { | QList<ServiceRoot*> TtRssServiceEntryPoint::initializeSubtree() const { | ||||||
|  |  | ||||||
|  | @ -64,7 +64,7 @@ bool TtRssServiceRoot::isSyncable() const { | ||||||
| bool TtRssServiceRoot::editViaGui() { | bool TtRssServiceRoot::editViaGui() { | ||||||
|   QScopedPointer<FormEditTtRssAccount> form_pointer(new FormEditTtRssAccount(qApp->mainFormWidget())); |   QScopedPointer<FormEditTtRssAccount> form_pointer(new FormEditTtRssAccount(qApp->mainFormWidget())); | ||||||
| 
 | 
 | ||||||
|   form_pointer->execForEdit(this); |   form_pointer->addEditAccount(this); | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue