Work on feeds dialog.
This commit is contained in:
parent
16a98a57ba
commit
a03be036c1
@ -59,4 +59,6 @@ class FeedsModelFeed : public FeedsModelRootItem {
|
|||||||
int m_unreadCount;
|
int m_unreadCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(FeedsModelFeed::Type)
|
||||||
|
|
||||||
#endif // FEEDSMODELFEED_H
|
#endif // FEEDSMODELFEED_H
|
||||||
|
@ -13,6 +13,10 @@ class TextFactory {
|
|||||||
explicit TextFactory();
|
explicit TextFactory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static bool isCaseInsensitiveLessThan(const QString &lhs, const QString &rhs) {
|
||||||
|
return lhs.toLower() < rhs.toLower();
|
||||||
|
}
|
||||||
|
|
||||||
// Tries to parse input textual date/time representation.
|
// Tries to parse input textual date/time representation.
|
||||||
// Returns invalid date/time if processing fails.
|
// Returns invalid date/time if processing fails.
|
||||||
// NOTE: This method tries to always return time in UTC+00:00.
|
// NOTE: This method tries to always return time in UTC+00:00.
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "gui/formstandardfeeddetails.h"
|
#include "gui/formstandardfeeddetails.h"
|
||||||
|
|
||||||
|
#include "core/textfactory.h"
|
||||||
#include "core/feedsmodel.h"
|
#include "core/feedsmodel.h"
|
||||||
|
#include "core/feedsmodelfeed.h"
|
||||||
|
#include "core/feedsmodelstandardfeed.h"
|
||||||
#include "gui/iconthemefactory.h"
|
#include "gui/iconthemefactory.h"
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
#if !defined(Q_OS_WIN)
|
||||||
@ -8,6 +11,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
|
||||||
FormStandardFeedDetails::FormStandardFeedDetails(FeedsModel *model, QWidget *parent)
|
FormStandardFeedDetails::FormStandardFeedDetails(FeedsModel *model, QWidget *parent)
|
||||||
: QDialog(parent) {
|
: QDialog(parent) {
|
||||||
@ -26,9 +31,13 @@ int FormStandardFeedDetails::exec(FeedsModelStandardFeed *input_feed) {
|
|||||||
else {
|
else {
|
||||||
// User is editing existing category.
|
// User is editing existing category.
|
||||||
setWindowTitle(tr("Edit existing standard feed"));
|
setWindowTitle(tr("Edit existing standard feed"));
|
||||||
|
// TODO: set editable feed.
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
// TODO: Load categories.
|
||||||
|
|
||||||
|
// Run the dialog.
|
||||||
|
return QDialog::exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardFeedDetails::initialize() {
|
void FormStandardFeedDetails::initialize() {
|
||||||
@ -45,4 +54,22 @@ void FormStandardFeedDetails::initialize() {
|
|||||||
#if !defined(Q_OS_WIN)
|
#if !defined(Q_OS_WIN)
|
||||||
MessageBox::iconify(m_ui->m_buttonBox);
|
MessageBox::iconify(m_ui->m_buttonBox);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Add standard feed types.
|
||||||
|
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::StandardAtom10), QVariant::fromValue(FeedsModelFeed::StandardAtom10));
|
||||||
|
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::StandardRdf), QVariant::fromValue(FeedsModelFeed::StandardRdf));
|
||||||
|
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::StandardRss0X), QVariant::fromValue(FeedsModelFeed::StandardRss0X));
|
||||||
|
m_ui->m_cmbType->addItem(FeedsModelFeed::typeToString(FeedsModelFeed::StandardRss2X), QVariant::fromValue(FeedsModelFeed::StandardRss2X));
|
||||||
|
|
||||||
|
// Load available encodings.
|
||||||
|
QList<QByteArray> encodings = QTextCodec::availableCodecs();
|
||||||
|
QStringList encoded_encodings;
|
||||||
|
|
||||||
|
foreach (const QByteArray &encoding, encodings) {
|
||||||
|
encoded_encodings.append(encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
qSort(encoded_encodings.begin(), encoded_encodings.end(), TextFactory::isCaseInsensitiveLessThan);
|
||||||
|
m_ui->m_cmbEncoding->addItems(encoded_encodings);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,30 +6,172 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>375</width>
|
||||||
<height>300</height>
|
<height>269</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<x>30</x>
|
<property name="fieldGrowthPolicy">
|
||||||
<y>240</y>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
<width>341</width>
|
</property>
|
||||||
<height>32</height>
|
<item row="0" column="0">
|
||||||
</rect>
|
<widget class="QLabel" name="m_lblParentCategory">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="orientation">
|
<string>Parent category</string>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
</property>
|
<property name="buddy">
|
||||||
<property name="standardButtons">
|
<cstring>m_cmbParentCategory</cstring>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="m_cmbParentCategory">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select parent item for your category.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="m_cmbType">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select type of the standard feed.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="m_lblTitle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Title</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_txtTitle</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="LineEditWithStatus" name="m_txtTitle" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="m_lblDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_txtDescription</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="LineEditWithStatus" name="m_txtDescription" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>URL</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="LineEditWithStatus" name="widget" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Encoding</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QComboBox" name="m_cmbEncoding">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select encoding of the standard feed. If you are unsure about the encoding, then select "UTF-8" encoding.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="m_lblIcon">
|
||||||
|
<property name="text">
|
||||||
|
<string>Icon</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_btnIcon</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QToolButton" name="m_btnIcon">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select icon for your category.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="popupMode">
|
||||||
|
<enum>QToolButton::InstantPopup</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="arrowType">
|
||||||
|
<enum>Qt::NoArrow</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditWithStatus</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>lineeditwithstatus.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user