From c0c623ead50057bd48ef84adf641a41120b47629 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 15 Oct 2014 21:32:04 +0200 Subject: [PATCH] :) --- src/gui/feedsview.cpp | 11 ++++++++--- src/gui/formcategorydetails.cpp | 20 ++++++++++---------- src/gui/formcategorydetails.h | 6 ++---- src/gui/formrestoredatabasesettings.cpp | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index 32f4d1ca4..c9ea16682 100755 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -246,7 +246,7 @@ void FeedsView::addNewCategory() { QPointer 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 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() << + 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() << - qApp->mainForm()->m_ui->m_actionUpdateAllFeeds << qApp->mainForm()->m_ui->m_actionAddCategory << qApp->mainForm()->m_ui->m_actionAddFeed); } diff --git a/src/gui/formcategorydetails.cpp b/src/gui/formcategorydetails.cpp index c3745da5d..7e78e8577 100755 --- a/src/gui/formcategorydetails.cpp +++ b/src/gui/formcategorydetails.cpp @@ -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. diff --git a/src/gui/formcategorydetails.h b/src/gui/formcategorydetails.h index 8bd3ab93e..c3d5a55e9 100644 --- a/src/gui/formcategorydetails.h +++ b/src/gui/formcategorydetails.h @@ -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 categories, - FeedsModelRootItem *root_item, - FeedsModelCategory *input_category); + void loadCategories(const QList categories, FeedsModelRootItem *root_item, FeedsModelCategory *input_category); private: Ui::FormCategoryDetails *m_ui; diff --git a/src/gui/formrestoredatabasesettings.cpp b/src/gui/formrestoredatabasesettings.cpp index 7c8f3916c..b2f5c1a04 100644 --- a/src/gui/formrestoredatabasesettings.cpp +++ b/src/gui/formrestoredatabasesettings.cpp @@ -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"));