diff options
-rw-r--r-- | src/historymenu.cpp | 14 | ||||
-rw-r--r-- | src/historymenu.h | 1 | ||||
-rw-r--r-- | src/modelmenu.cpp | 6 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/historymenu.cpp b/src/historymenu.cpp index 8d75324d..b5edae3f 100644 --- a/src/historymenu.cpp +++ b/src/historymenu.cpp @@ -33,6 +33,7 @@ // KDE Includes #include <KUrl> +#include <KMessageBox> HistoryMenu::HistoryMenu(QWidget *parent) @@ -78,11 +79,22 @@ void HistoryMenu::postPopulated() addAction(showAllAction); KAction *clearAction = new KAction(i18n("Clear History"), this); - connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear())); + connect(clearAction, SIGNAL(triggered()), this, SLOT(clearHistory())); addAction(clearAction); } +void HistoryMenu::clearHistory() +{ + int res = KMessageBox::warningYesNo(this, i18n("Are you sure you want to delete history?"), i18n("History") ); + + if (res == KMessageBox::Yes) + { + m_history->clear(); + } +} + + void HistoryMenu::setInitialActions(QList<QAction*> actions) { m_initialActions = actions; diff --git a/src/historymenu.h b/src/historymenu.h index da1feaed..64395951 100644 --- a/src/historymenu.h +++ b/src/historymenu.h @@ -58,6 +58,7 @@ protected: private slots: void activated(const QModelIndex &index); + void clearHistory(); private: HistoryManager *m_history; 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(); } |