Work on category manipulation, some refactoring.
This commit is contained in:
parent
5ab7ea370d
commit
8d070db0ed
@ -287,7 +287,7 @@ set(APP_SOURCES
|
||||
src/gui/messagesview.cpp
|
||||
src/gui/statusbar.cpp
|
||||
src/gui/iconfactory.cpp
|
||||
src/gui/formcategorydetails.cpp
|
||||
src/gui/formstandardcategorydetails.cpp
|
||||
src/gui/plaintoolbutton.cpp
|
||||
src/gui/lineeditwithstatus.cpp
|
||||
src/gui/messagebox.cpp
|
||||
@ -352,7 +352,7 @@ set(APP_HEADERS
|
||||
src/gui/feedsview.h
|
||||
src/gui/messagesview.h
|
||||
src/gui/statusbar.h
|
||||
src/gui/formcategorydetails.h
|
||||
src/gui/formstandardcategorydetails.h
|
||||
src/gui/plaintoolbutton.h
|
||||
src/gui/lineeditwithstatus.h
|
||||
src/gui/messagebox.h
|
||||
@ -378,7 +378,7 @@ set(APP_FORMS
|
||||
src/gui/formsettings.ui
|
||||
src/gui/formwelcome.ui
|
||||
src/gui/formabout.ui
|
||||
src/gui/formcategorydetails.ui
|
||||
src/gui/formstandardcategorydetails.ui
|
||||
)
|
||||
|
||||
# Add translations.
|
||||
|
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
||||
<email>rotter.martinos@gmail.com</email>
|
||||
</author>
|
||||
<style/>
|
||||
<markup_wrapper>PGh0bWw+DQogIDxoZWFkPg0KICAgIDxzdHlsZT4NCiAgICAgIGJvZHkgew0KICAgICAgICBtYXJnaW46IDBweDsNCiAgICAgICAgcGFkZGluZzogMHB4Ow0KICAgICAgfQ0KICAgIA0KICAgICAgcHJlIHsNCiAgICAgICAgd2hpdGUtc3BhY2U6IHByZS13cmFwOw0KICAgICAgfQ0KDQogICAgICAuaGVhZGVydGV4dCB7DQogICAgICAgIGZvbnQtc2l6ZTogMjBweDsNCiAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDsNCiAgICAgIH0NCg0KICAgICAgLmhlYWRlciB7DQogICAgICAgIGZvbnQtc2l6ZTogMTdweDsNCiAgICAgICAgYmFja2dyb3VuZDogLXdlYmtpdC1ncmFkaWVudChsaW5lYXIsIGxlZnQgdG9wLCBsZWZ0IGJvdHRvbSwgY29sb3Itc3RvcCgwJSxyZ2JhKDk5LDEzNSwyMjksMSkpLCBjb2xvci1zdG9wKDEwMCUscmdiYSg2NCwxMDksMjM2LDEpKSk7DQogICAgICAgIHBhZGRpbmc6IDZweDsNCiAgICAgICAgbWFyZ2luOiAwcHggYXV0bzsNCiAgICAgICAgY29sb3I6IHdoaXRlOw0KICAgICAgICBib3JkZXI6IDAuNXB4IHNvbGlkIGJsYWNrOw0KICAgICAgfQ0KDQogICAgICAuaGVhZGVyIGEgew0KICAgICAgICBjb2xvcjogd2hpdGU7DQogICAgICB9DQoNCiAgICAgIC5jb250ZW50IHsNCiAgICAgICAgYm9yZGVyLXRvcDogMXB4IHNvbGlkIGdyYXk7DQogICAgICAgIGZvbnQtc2l6ZTogMTZweDsNCiAgICAgICAgbWFyZ2luOiAwcHggYXV0bzsNCiAgICAgICAgcGFkZGluZzogNnB4Ow0KICAgICAgICBwYWRkaW5nLXRvcDogMTJweDsNCiAgICAgIH0NCiAgICAgIA0KICAgICAgLmNvbnRhaW5lciB7DQogICAgICAgIGJvcmRlcjogMXB4IHNvbGlkIGdyYXk7DQogICAgICAgIC13ZWJraXQtYm9yZGVyLXJhZGl1czogMnB4Ow0KICAgICAgICBtYXJnaW46IDEwcHg7DQogICAgICAgIC13ZWJraXQtYm94LXNoYWRvdzogMnB4IDJweCAxNnB4IDBweCByZ2JhKDUwLCA1MCwgNTAsIDAuNjIpOw0KICAgICAgfQ0KICAgIDwvc3R5bGU+DQogICAgPHRpdGxlPg0KICAgICAgJTENCiAgICA8L3RpdGxlPg0KICA8L2hlYWQ+DQogIDxib2R5Pg0KICAgICUyDQogIDwvYm9keT4NCjwvaHRtbD4=</markup_wrapper>
|
||||
<markup_wrapper>PGh0bWw+DQogIDxoZWFkPg0KICAgIDxzdHlsZT4NCiAgICAgIGJvZHkgew0KICAgICAgICBtYXJnaW46IDBweDsNCiAgICAgICAgcGFkZGluZzogMHB4Ow0KICAgICAgfQ0KICAgIA0KICAgICAgcHJlIHsNCiAgICAgICAgd2hpdGUtc3BhY2U6IHByZS13cmFwOw0KCQlmb250LWZhbWlseTogIkNvdXJpZXIgTmV3IiwgQ291cmllciwgbW9ub3NwYWNlOw0KICAgICAgfQ0KDQogICAgICAuaGVhZGVydGV4dCB7DQogICAgICAgIGZvbnQtc2l6ZTogMjBweDsNCiAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDsNCiAgICAgIH0NCg0KICAgICAgLmhlYWRlciB7DQogICAgICAgIGZvbnQtc2l6ZTogMTdweDsNCiAgICAgICAgYmFja2dyb3VuZDogLXdlYmtpdC1ncmFkaWVudChsaW5lYXIsIGxlZnQgdG9wLCBsZWZ0IGJvdHRvbSwgY29sb3Itc3RvcCgwJSxyZ2JhKDk5LDEzNSwyMjksMSkpLCBjb2xvci1zdG9wKDEwMCUscmdiYSg2NCwxMDksMjM2LDEpKSk7DQogICAgICAgIHBhZGRpbmc6IDZweDsNCiAgICAgICAgbWFyZ2luOiAwcHggYXV0bzsNCiAgICAgICAgY29sb3I6IHdoaXRlOw0KICAgICAgICBib3JkZXI6IDAuNXB4IHNvbGlkIGJsYWNrOw0KICAgICAgfQ0KDQogICAgICAuaGVhZGVyIGEgew0KICAgICAgICBjb2xvcjogd2hpdGU7DQogICAgICB9DQoNCiAgICAgIC5jb250ZW50IHsNCiAgICAgICAgYm9yZGVyLXRvcDogMXB4IHNvbGlkIGdyYXk7DQogICAgICAgIGZvbnQtc2l6ZTogMTZweDsNCiAgICAgICAgbWFyZ2luOiAwcHggYXV0bzsNCiAgICAgICAgcGFkZGluZzogNnB4Ow0KICAgICAgICBwYWRkaW5nLXRvcDogMTJweDsNCiAgICAgIH0NCiAgICAgIA0KICAgICAgLmNvbnRhaW5lciB7DQoJCWZvbnQtZmFtaWx5OiAiVHJlYnVjaGV0IE1TIiwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmOw0KICAgICAgICBib3JkZXI6IDFweCBzb2xpZCBncmF5Ow0KICAgICAgICAtd2Via2l0LWJvcmRlci1yYWRpdXM6IDJweDsNCiAgICAgICAgbWFyZ2luOiAxMHB4Ow0KICAgICAgICAtd2Via2l0LWJveC1zaGFkb3c6IDJweCAycHggMTZweCAwcHggcmdiYSg1MCwgNTAsIDUwLCAwLjYyKTsNCiAgICAgIH0NCiAgICA8L3N0eWxlPg0KICAgIDx0aXRsZT4NCiAgICAgICUxDQogICAgPC90aXRsZT4NCiAgPC9oZWFkPg0KICA8Ym9keT4NCiAgICAlMg0KICA8L2JvZHk+DQo8L2h0bWw+</markup_wrapper>
|
||||
<markup>ICAgIDxkaXYgY2xhc3M9ImNvbnRhaW5lciI+DQogICAgICA8ZGl2IGNsYXNzPSJoZWFkZXIiPg0KICAgICAgICA8ZGl2IGNsYXNzPSJoZWFkZXJ0ZXh0Ij4NCiAgICAgICAgICAlMQ0KICAgICAgICA8L2Rpdj4NCiAgICAgICAgJTIgKCU1KQ0KICAgICAgICA8YnI+DQogICAgICAgIDxhIGhyZWY9IiUzIj4NCiAgICAgICAgICAlMw0KICAgICAgICA8L2E+DQogICAgICA8L2Rpdj4NCiAgICAgIDxkaXYgY2xhc3M9ImNvbnRlbnQiPg0KICAgICAgICAlNCANCiAgICAgIDwvZGl2Pg0KICAgIDwvZGl2Pg==</markup>
|
||||
<data>UVRyZWVWaWV3OjpicmFuY2g6aGFzLXNpYmxpbmdzOiFhZGpvaW5zLWl0ZW0gIHsNCiAgYm9yZGVyLWltYWdlOiB1cmwocXNzL2R1bW15LnBuZykgMDsNCn0NCg0KUVRyZWVWaWV3OjpicmFuY2g6aGFzLXNpYmxpbmdzOmFkam9pbnMtaXRlbSB7DQogIGJvcmRlci1pbWFnZTogdXJsKHFzcy9kdW1teS5wbmcpIDA7DQp9DQoNClFUcmVlVmlldzo6YnJhbmNoOiFoYXMtY2hpbGRyZW46IWhhcy1zaWJsaW5nczphZGpvaW5zLWl0ZW0gIHsNCiAgYm9yZGVyLWltYWdlOiB1cmwocXNzL2R1bW15LnBuZykgMDsNCn0NCg0KUVRyZWVWaWV3OjpicmFuY2g6aGFzLWNoaWxkcmVuOiFoYXMtc2libGluZ3M6Y2xvc2VkLA0KUVRyZWVWaWV3OjpicmFuY2g6Y2xvc2VkOmhhcy1jaGlsZHJlbjpoYXMtc2libGluZ3MgIHsNCiAgYm9yZGVyLWltYWdlOiBub25lOw0KICBpbWFnZTogdXJsKHFzcy9icmFuY2gtY2xvc2VkLnBuZyk7DQp9DQoNClFUcmVlVmlldzo6YnJhbmNoOm9wZW46aGFzLWNoaWxkcmVuOiFoYXMtc2libGluZ3MsDQpRVHJlZVZpZXc6OmJyYW5jaDpvcGVuOmhhcy1jaGlsZHJlbjpoYXMtc2libGluZ3MgIHsNCiAgYm9yZGVyLWltYWdlOiBub25lOw0KICBpbWFnZTogdXJsKHFzcy9icmFuY2gtb3Blbi5wbmcpOw0KfQ0KDQpRVHJlZVZpZXc6Oml0ZW0gew0KICBwYWRkaW5nOiAxcHggMXB4IDFweCAxcHg7DQp9IA0KDQpRVHJlZVZpZXdbaGlkZVRyZWU9InRydWUiXTo6YnJhbmNoOiFoYXMtY2hsaWRyZW46aGFzU2libGluZ3Mgew0KICBib3JkZXItaW1hZ2U6IG5vbmU7DQogIGltYWdlOiBub25lOw0KfQ0K</data>
|
||||
</skin>
|
@ -137,21 +137,18 @@ bool FeedsModel::removeItem(const QModelIndex &index) {
|
||||
if (index.isValid()) {
|
||||
QModelIndex parent_index = index.parent();
|
||||
FeedsModelRootItem *deleting_item = itemForIndex(index);
|
||||
FeedsModelRootItem *parent_item = itemForIndex(parent_index);
|
||||
FeedsModelRootItem *parent_item = deleting_item->parent();
|
||||
|
||||
// Try to persistently remove the item.
|
||||
if (deleting_item->removeItself()) {
|
||||
// Item was persistently removed.
|
||||
// Remove it from the model.
|
||||
beginRemoveRows(parent_index, index.row(), index.row());
|
||||
|
||||
if (parent_item->removeChild(deleting_item)) {
|
||||
// Free deleted item (and its children) from the memory.
|
||||
delete deleting_item;
|
||||
}
|
||||
|
||||
parent_item->removeChild(deleting_item);
|
||||
endRemoveRows();
|
||||
|
||||
delete deleting_item;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -204,11 +201,7 @@ bool FeedsModel::addStandardCategory(FeedsModelStandardCategory *category,
|
||||
// Category was added to the persistent storage,
|
||||
// so add it to the model.
|
||||
beginInsertRows(parent_index, parent->childCount(), parent->childCount());
|
||||
|
||||
// Add category to parent's children list.
|
||||
parent->appendChild(category);
|
||||
|
||||
// Everything is completed now.
|
||||
endInsertRows();
|
||||
|
||||
return true;
|
||||
@ -219,6 +212,8 @@ bool FeedsModel::editStandardCategory(FeedsModelStandardCategory *original_categ
|
||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
||||
DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_update_category(database);
|
||||
FeedsModelRootItem *original_parent = original_category->parent();
|
||||
FeedsModelRootItem *new_parent = new_category->parent();
|
||||
|
||||
query_update_category.setForwardOnly(true);
|
||||
query_update_category.prepare("UPDATE Categories "
|
||||
@ -227,38 +222,44 @@ bool FeedsModel::editStandardCategory(FeedsModelStandardCategory *original_categ
|
||||
query_update_category.bindValue(":title", new_category->title());
|
||||
query_update_category.bindValue(":description", new_category->description());
|
||||
query_update_category.bindValue(":icon", IconFactory::toByteArray(new_category->icon()));
|
||||
query_update_category.bindValue(":parent_id", new_category->parent()->id());
|
||||
query_update_category.bindValue(":parent_id", new_parent->id());
|
||||
query_update_category.bindValue(":id", original_category->id());
|
||||
|
||||
if (!query_update_category.exec()) {
|
||||
// Persistent storage update failed, no way to continue now.
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: nastavit originalni kategorii podle nove; doimplementovat
|
||||
// celkove dodelat
|
||||
// Setup new model data for the original item.
|
||||
original_category->setDescription(new_category->description());
|
||||
original_category->setIcon(new_category->icon());
|
||||
original_category->setTitle(new_category->title());
|
||||
|
||||
if (original_category->parent() != new_category->parent()) {
|
||||
// User edited category but left its parent intact.
|
||||
beginRemoveRows(indexForItem(original_category->parent()),
|
||||
original_category->parent()->childItems().indexOf(original_category),
|
||||
original_category->parent()->childItems().indexOf(original_category));
|
||||
|
||||
original_category->parent()->removeChild(original_category);
|
||||
if (original_parent != new_parent) {
|
||||
// User edited category and set it new parent item,
|
||||
// se we need to move the item in the model too.
|
||||
int original_index_of_category = original_parent->childItems().indexOf(original_category);
|
||||
int new_index_of_category = new_parent->childCount();
|
||||
|
||||
// Remove the original item from the model...
|
||||
beginRemoveRows(indexForItem(original_parent),
|
||||
original_index_of_category,
|
||||
original_index_of_category);
|
||||
original_parent->removeChild(original_category);
|
||||
endRemoveRows();
|
||||
|
||||
beginInsertRows(indexForItem(new_category->parent()),
|
||||
new_category->parent()->childCount(),
|
||||
new_category->parent()->childCount());
|
||||
|
||||
new_category->parent()->appendChild(original_category);
|
||||
|
||||
// ... and insert it under the new parent.
|
||||
beginInsertRows(indexForItem(new_parent),
|
||||
new_index_of_category,
|
||||
new_index_of_category);
|
||||
new_parent->appendChild(original_category);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
// Free temporary category from memory.
|
||||
delete new_category;
|
||||
|
||||
// Editing is done.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,8 @@ void FeedMessageViewer::createConnections() {
|
||||
SIGNAL(triggered()), this, SLOT(updateSelectedFeeds()));
|
||||
connect(FormMain::instance()->m_ui->m_actionUpdateAllFeeds,
|
||||
SIGNAL(triggered()), this, SLOT(updateAllFeeds()));
|
||||
connect(FormMain::instance()->m_ui->m_actionAddNewCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(addNewCategory()));
|
||||
connect(FormMain::instance()->m_ui->m_actionAddStandardCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(addNewStandardCategory()));
|
||||
connect(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(editSelectedItem()));
|
||||
connect(FormMain::instance()->m_ui->m_actionViewSelectedItemsNewspaperMode,
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "core/feedsmodelcategory.h"
|
||||
#include "core/feedsmodelstandardcategory.h"
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/formcategorydetails.h"
|
||||
#include "gui/formstandardcategorydetails.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QHeaderView>
|
||||
@ -69,8 +69,8 @@ void FeedsView::clearSelectedFeeds() {
|
||||
setSelectedFeedsClearStatus(1);
|
||||
}
|
||||
|
||||
void FeedsView::addNewCategory() {
|
||||
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
|
||||
void FeedsView::addNewStandardCategory() {
|
||||
QPointer<FormStandardCategoryDetails> form_pointer = new FormStandardCategoryDetails(m_sourceModel, this);
|
||||
|
||||
if (form_pointer.data()->exec(NULL) == QDialog::Accepted) {
|
||||
// TODO: nova kategorie pridana
|
||||
@ -82,8 +82,25 @@ void FeedsView::addNewCategory() {
|
||||
delete form_pointer.data();
|
||||
}
|
||||
|
||||
void FeedsView::editStandardCategory(FeedsModelStandardCategory *category) {
|
||||
FeedsModelStandardCategory *std_category = static_cast<FeedsModelStandardCategory*>(category);
|
||||
QPointer<FormStandardCategoryDetails> form_pointer = new FormStandardCategoryDetails(m_sourceModel, this);
|
||||
|
||||
if (form_pointer.data()->exec(std_category) == QDialog::Accepted) {
|
||||
// TODO: kategorie upravena
|
||||
}
|
||||
else {
|
||||
// TODO: kategorie neupravena (uživatel zrušil dialog)
|
||||
}
|
||||
|
||||
delete form_pointer.data();
|
||||
}
|
||||
|
||||
void FeedsView::editSelectedItem() {
|
||||
// TODO: Implement this.
|
||||
// TODO: preda pridavanim/upravou/mazanim kanalu/kategorii
|
||||
// ziskat ZAPISOVACI zamek pres systemfactory::applicationCloseLock
|
||||
// a po dokonceni cinnosti jej odevzdavat
|
||||
|
||||
FeedsModelCategory *category;
|
||||
FeedsModelFeed *feed;
|
||||
|
||||
@ -92,18 +109,7 @@ void FeedsView::editSelectedItem() {
|
||||
switch (category->type()) {
|
||||
case FeedsModelCategory::Standard: {
|
||||
// User wants to edit standard category.
|
||||
FeedsModelStandardCategory *std_category = static_cast<FeedsModelStandardCategory*>(category);
|
||||
|
||||
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
|
||||
|
||||
if (form_pointer.data()->exec(std_category) == QDialog::Accepted) {
|
||||
// TODO: kategorie upravena
|
||||
}
|
||||
else {
|
||||
// TODO: kategorie neupravena
|
||||
}
|
||||
|
||||
delete form_pointer.data();
|
||||
editStandardCategory(static_cast<FeedsModelStandardCategory*>(category));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -68,11 +68,14 @@ class FeedsView : public QTreeView {
|
||||
void setSelectedFeedsClearStatus(int clear);
|
||||
void clearSelectedFeeds();
|
||||
|
||||
// Category operators.
|
||||
void addNewCategory();
|
||||
// Base manipulators.
|
||||
void editSelectedItem();
|
||||
void deleteSelectedItem();
|
||||
|
||||
// Standard category manipulators.
|
||||
void addNewStandardCategory();
|
||||
void editStandardCategory(FeedsModelStandardCategory *category);
|
||||
|
||||
// Reloads counts for selected feeds.
|
||||
void updateCountsOfSelectedFeeds(bool update_total_too = true);
|
||||
|
||||
|
@ -223,7 +223,7 @@ void FormMain::setupIcons() {
|
||||
m_ui->m_actionClearFeeds->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionDeleteSelectedFeedCategory->setIcon(IconThemeFactory::instance()->fromTheme("edit-delete"));
|
||||
m_ui->m_actionDeleteSelectedMessages->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionAddNewCategory->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
m_ui->m_actionAddStandardCategory->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
m_ui->m_actionAddNewFeed->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
m_ui->m_actionEditSelectedFeedCategory->setIcon(IconThemeFactory::instance()->fromTheme("gnome-other"));
|
||||
m_ui->m_actionMarkAllFeedsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
|
||||
|
@ -15,7 +15,16 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -39,7 +48,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>979</width>
|
||||
<height>20</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="m_menuFile">
|
||||
@ -89,7 +98,7 @@
|
||||
<addaction name="m_actionUpdateSelectedFeedsCategories"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="m_actionAddNewFeed"/>
|
||||
<addaction name="m_actionAddNewCategory"/>
|
||||
<addaction name="m_actionAddStandardCategory"/>
|
||||
<addaction name="m_actionEditSelectedFeedCategory"/>
|
||||
<addaction name="m_actionDeleteSelectedFeedCategory"/>
|
||||
<addaction name="separator"/>
|
||||
@ -359,12 +368,12 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionAddNewCategory">
|
||||
<action name="m_actionAddStandardCategory">
|
||||
<property name="text">
|
||||
<string>Add new &category</string>
|
||||
<string>Add new standard &category</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true"/>
|
||||
<property name="toolTip">
|
||||
<string>Add new standard category.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionNoActions">
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "gui/formcategorydetails.h"
|
||||
#include "gui/formstandardcategorydetails.h"
|
||||
|
||||
#include "core/defs.h"
|
||||
#include "core/feedsmodelrootitem.h"
|
||||
@ -16,7 +16,7 @@
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
FormCategoryDetails::FormCategoryDetails(FeedsModel *model, QWidget *parent)
|
||||
FormStandardCategoryDetails::FormStandardCategoryDetails(FeedsModel *model, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_editableCategory(NULL),
|
||||
m_feedsModel(model) {
|
||||
@ -30,18 +30,18 @@ FormCategoryDetails::FormCategoryDetails(FeedsModel *model, QWidget *parent)
|
||||
onTitleChanged(QString());
|
||||
}
|
||||
|
||||
FormCategoryDetails::~FormCategoryDetails() {
|
||||
FormStandardCategoryDetails::~FormStandardCategoryDetails() {
|
||||
qDebug("Destroying FormCategoryDetails instance.");
|
||||
}
|
||||
|
||||
void FormCategoryDetails::createConnections() {
|
||||
void FormStandardCategoryDetails::createConnections() {
|
||||
connect(m_ui->m_buttonBox, SIGNAL(accepted()),
|
||||
this, SLOT(apply()));
|
||||
connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)),
|
||||
this, SLOT(onTitleChanged(QString)));
|
||||
}
|
||||
|
||||
void FormCategoryDetails::setEditableCategory(FeedsModelStandardCategory *editable_category) {
|
||||
void FormStandardCategoryDetails::setEditableCategory(FeedsModelStandardCategory *editable_category) {
|
||||
m_editableCategory = editable_category;
|
||||
|
||||
m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) editable_category->parent())));
|
||||
@ -50,7 +50,7 @@ void FormCategoryDetails::setEditableCategory(FeedsModelStandardCategory *editab
|
||||
m_ui->m_btnIcon->setIcon(editable_category->icon());
|
||||
}
|
||||
|
||||
int FormCategoryDetails::exec(FeedsModelStandardCategory *input_category) {
|
||||
int FormStandardCategoryDetails::exec(FeedsModelStandardCategory *input_category) {
|
||||
if (input_category == NULL) {
|
||||
// User is adding new category.
|
||||
setWindowTitle(tr("Add new category"));
|
||||
@ -67,7 +67,7 @@ int FormCategoryDetails::exec(FeedsModelStandardCategory *input_category) {
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
void FormCategoryDetails::apply() {
|
||||
void FormStandardCategoryDetails::apply() {
|
||||
FeedsModelRootItem *parent = static_cast<FeedsModelRootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
|
||||
FeedsModelStandardCategory *new_category = new FeedsModelStandardCategory();
|
||||
|
||||
@ -97,7 +97,7 @@ void FormCategoryDetails::apply() {
|
||||
}
|
||||
}
|
||||
|
||||
void FormCategoryDetails::onTitleChanged(const QString &new_title){
|
||||
void FormStandardCategoryDetails::onTitleChanged(const QString &new_title){
|
||||
if (new_title.size() >= MIN_CATEGORY_NAME_LENGTH) {
|
||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
m_ui->m_txtTitle->setStatus(LineEditWithStatus::Ok, tr("This category name is ok."));
|
||||
@ -108,8 +108,8 @@ void FormCategoryDetails::onTitleChanged(const QString &new_title){
|
||||
}
|
||||
}
|
||||
|
||||
void FormCategoryDetails::initialize() {
|
||||
m_ui = new Ui::FormCategoryDetails();
|
||||
void FormStandardCategoryDetails::initialize() {
|
||||
m_ui = new Ui::FormStandardCategoryDetails();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// Set flags and attributes.
|
||||
@ -119,7 +119,7 @@ void FormCategoryDetails::initialize() {
|
||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
void FormCategoryDetails::loadCategories(const QList<FeedsModelCategory *> categories,
|
||||
void FormStandardCategoryDetails::loadCategories(const QList<FeedsModelCategory *> categories,
|
||||
FeedsModelRootItem *root_item) {
|
||||
m_ui->m_cmbParentCategory->addItem(root_item->icon(),
|
||||
root_item->title(),
|
@ -1,13 +1,13 @@
|
||||
#ifndef FORMCATEGORYDETAILS_H
|
||||
#define FORMCATEGORYDETAILS_H
|
||||
|
||||
#include "ui_formcategorydetails.h"
|
||||
#include "ui_formstandardcategorydetails.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class FormSettings;
|
||||
class FormStandardCategoryDetails;
|
||||
}
|
||||
|
||||
class FeedsModelCategory;
|
||||
@ -16,16 +16,16 @@ class FeedsModel;
|
||||
class FeedsModelRootItem;
|
||||
|
||||
|
||||
class FormCategoryDetails : public QDialog {
|
||||
class FormStandardCategoryDetails : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Constructors and destructors.
|
||||
// This constructor is supposed to create new categories.
|
||||
explicit FormCategoryDetails(FeedsModel *model, QWidget *parent = 0);
|
||||
explicit FormStandardCategoryDetails(FeedsModel *model, QWidget *parent = 0);
|
||||
|
||||
// Destructor.
|
||||
virtual ~FormCategoryDetails();
|
||||
virtual ~FormStandardCategoryDetails();
|
||||
|
||||
// Creates needed connections.
|
||||
void createConnections();
|
||||
@ -60,7 +60,7 @@ class FormCategoryDetails : public QDialog {
|
||||
FeedsModelRootItem *root_item);
|
||||
|
||||
private:
|
||||
Ui::FormCategoryDetails *m_ui;
|
||||
Ui::FormStandardCategoryDetails *m_ui;
|
||||
FeedsModelStandardCategory *m_editableCategory;
|
||||
FeedsModel *m_feedsModel;
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormCategoryDetails</class>
|
||||
<widget class="QDialog" name="FormCategoryDetails">
|
||||
<class>FormStandardCategoryDetails</class>
|
||||
<widget class="QDialog" name="FormStandardCategoryDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -108,7 +108,7 @@
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FormCategoryDetails</receiver>
|
||||
<receiver>FormStandardCategoryDetails</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
Loading…
x
Reference in New Issue
Block a user