From 33ac88b25eeb188617da4e445e34eddefbfa8b86 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 20 Jun 2009 10:36:31 +0200 Subject: RFC. History Menu Revisited. --- src/modelmenu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modelmenu.cpp') diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 9ff37037..8f174797 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -171,18 +171,18 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); - if (m_model->hasChildren(idx)) +/* if (m_model->hasChildren(idx)) { createMenu(idx, -1, menu); } else - { + {*/ if (m_separatorRole != 0 && idx.data(m_separatorRole).toBool()) addSeparator(); else menu->addAction(makeAction(idx)); - } +// } if (menu == this && i == m_firstSeparator - 1) addSeparator(); } -- cgit v1.2.1 From d13488e90ada61c9a9b3eef6ae017d42029740b5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 20 Jun 2009 18:29:22 +0200 Subject: history menu fix --- src/modelmenu.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/modelmenu.cpp') diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 8f174797..282256a8 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -147,17 +147,19 @@ void ModelMenu::aboutToShow() void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) { + Q_UNUSED(parentMenu) + if (!menu) { - QString title = parent.data().toString(); - menu = new QMenu(title, this); - QIcon icon = qvariant_cast(parent.data(Qt::DecorationRole)); - menu->setIcon(icon); - parentMenu->addMenu(menu); - QVariant v; - v.setValue(parent); - menu->menuAction()->setData(v); - connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); +// QString title = parent.data().toString(); +// menu = new QMenu(title, this); +// QIcon icon = qvariant_cast(parent.data(Qt::DecorationRole)); +// menu->setIcon(icon); +// parentMenu->addMenu(menu); +// QVariant v; +// v.setValue(parent); +// menu->menuAction()->setData(v); +// connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); return; } -- cgit v1.2.1 From 4a023c89a83322cebb3a878c9512874772f791b9 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 20 Jun 2009 18:34:25 +0200 Subject: New history menu code comments --- src/modelmenu.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/modelmenu.cpp') diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 282256a8..41c197f3 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -145,6 +145,10 @@ void ModelMenu::aboutToShow() postPopulated(); } + +// WARNING +// the code commented out here is to create a second separator in the history menu +// with ALL history, subdivided by days. void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) { Q_UNUSED(parentMenu) @@ -173,12 +177,12 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); -/* if (m_model->hasChildren(idx)) - { - createMenu(idx, -1, menu); - } - else - {*/ +// if (m_model->hasChildren(idx)) +// { +// createMenu(idx, -1, menu); +// } +// else +// { if (m_separatorRole != 0 && idx.data(m_separatorRole).toBool()) addSeparator(); -- cgit v1.2.1