This commit is contained in:
Martin Rotter 2014-10-15 21:32:04 +02:00
parent 95a961c151
commit c0c623ead5
4 changed files with 21 additions and 18 deletions

View File

@ -246,7 +246,7 @@ void FeedsView::addNewCategory() {
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
form_pointer.data()->exec(NULL);
form_pointer.data()->exec(NULL, NULL);
delete form_pointer.data();
@ -257,7 +257,7 @@ void FeedsView::addNewCategory() {
void FeedsView::editCategory(FeedsModelCategory *category) {
QPointer<FormCategoryDetails> form_pointer = new FormCategoryDetails(m_sourceModel, this);
form_pointer.data()->exec(category);
form_pointer.data()->exec(category, NULL);
delete form_pointer.data();
}
@ -549,12 +549,17 @@ void FeedsView::initializeContextMenuCategoriesFeeds() {
qApp->mainForm()->m_ui->m_actionMarkSelectedFeedsAsRead <<
qApp->mainForm()->m_ui->m_actionMarkSelectedFeedsAsUnread <<
qApp->mainForm()->m_ui->m_actionDeleteSelectedFeedCategory);
m_contextMenuCategoriesFeeds->addSeparator();
m_contextMenuCategoriesFeeds->addActions(QList<QAction*>() <<
qApp->mainForm()->m_ui->m_actionAddCategory <<
qApp->mainForm()->m_ui->m_actionAddFeed);
}
void FeedsView::initializeContextMenuEmptySpace() {
m_contextMenuEmptySpace = new QMenu(tr("Context menu for empty space"), this);
m_contextMenuEmptySpace->addAction(qApp->mainForm()->m_ui->m_actionUpdateAllFeeds);
m_contextMenuEmptySpace->addSeparator();
m_contextMenuEmptySpace->addActions(QList<QAction*>() <<
qApp->mainForm()->m_ui->m_actionUpdateAllFeeds <<
qApp->mainForm()->m_ui->m_actionAddCategory <<
qApp->mainForm()->m_ui->m_actionAddFeed);
}

View File

@ -57,12 +57,9 @@ FormCategoryDetails::~FormCategoryDetails() {
void FormCategoryDetails::createConnections() {
// General connections.
connect(m_ui->m_buttonBox, SIGNAL(accepted()),
this, SLOT(apply()));
connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(onTitleChanged(QString)));
connect(m_ui->m_txtDescription->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(onDescriptionChanged(QString)));
connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(apply()));
connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onTitleChanged(QString)));
connect(m_ui->m_txtDescription->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onDescriptionChanged(QString)));
// Icon connections.
connect(m_actionLoadIconFromFile, SIGNAL(triggered()), this, SLOT(onLoadIconFromFile()));
@ -79,11 +76,14 @@ void FormCategoryDetails::setEditableCategory(FeedsModelCategory *editable_categ
m_ui->m_btnIcon->setIcon(editable_category->icon());
}
int FormCategoryDetails::exec(FeedsModelCategory *input_category) {
int FormCategoryDetails::exec(FeedsModelCategory *input_category, FeedsModelRootItem *parent_to_select) {
// TODO: řeseni bugu #92. pridal sem parametr parent_to_select
// kde volajici preda pointer na doporuceny nadrazeny prvek,
// nebo null pokud nic nedoporucuje.
// vybereme
// Load categories.
loadCategories(m_feedsModel->allCategories().values(),
m_feedsModel->rootItem(),
input_category);
loadCategories(m_feedsModel->allCategories().values(), m_feedsModel->rootItem(), input_category);
if (input_category == NULL) {
// User is adding new category.

View File

@ -44,7 +44,7 @@ class FormCategoryDetails : public QDialog {
public slots:
// Executes add/edit standard category dialog.
int exec(FeedsModelCategory *input_category);
int exec(FeedsModelCategory *input_category, FeedsModelRootItem *parent_to_select);
protected slots:
// Applies changes.
@ -72,9 +72,7 @@ class FormCategoryDetails : public QDialog {
// Loads categories into the dialog + give root "category"
// and make sure that no childs of input category (including)
// input category are loaded.
void loadCategories(const QList<FeedsModelCategory*> categories,
FeedsModelRootItem *root_item,
FeedsModelCategory *input_category);
void loadCategories(const QList<FeedsModelCategory*> categories, FeedsModelRootItem *root_item, FeedsModelCategory *input_category);
private:
Ui::FormCategoryDetails *m_ui;

View File

@ -28,7 +28,7 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
: QDialog(parent), m_ui(new Ui::FormRestoreDatabaseSettings) {
m_ui->setupUi(this);
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ApplyRole);
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
setWindowIcon(qApp->icons()->fromTheme("document-import"));