moveDownAct->setEnabled(false);
actions->insert("moveDown", moveDownAct);
connect(moveDownAct, SIGNAL(triggered()), mediaView, SLOT(moveDownSelected()));
-
+
+ clearAct = new QAction(tr("&Clear recent keywords"), this);
+ clearAct->setMenuRole(QAction::ApplicationSpecificRole);
+ clearAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete) << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Backspace));
+ clearAct->setEnabled(true);
+ actions->insert("clearRecentKeywords", clearAct);
+ connect(clearAct, SIGNAL(triggered()), searchView, SLOT(clearRecentKeywords()));
+
quitAct = new QAction(tr("&Quit"), this);
quitAct->setMenuRole(QAction::QuitRole);
quitAct->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Q")) << QKeySequence(Qt::CTRL + Qt::Key_W));
QMap<QString, QMenu*> *menus = The::globalMenus();
- /*
fileMenu = menuBar()->addMenu(tr("&Application"));
// menus->insert("file", fileMenu);
// fileMenu->addAction(settingsAct);
+ fileMenu->addAction(clearAct);
fileMenu->addSeparator();
fileMenu->addAction(quitAct);
- */
+
playlistMenu = menuBar()->addMenu(tr("&Playlist"));
menus->insert("playlist", playlistMenu);
switch (newState) {
- case Phonon::ErrorState:
+ case Phonon::ErrorState:
if (mediaObject->errorType() == Phonon::FatalError) {
statusBar()->showMessage(tr("Fatal error: %1").arg(mediaObject->errorString()));
} else {
#include "SearchView.h"
#include "Constants.h"
+namespace The {
+ QMap<QString, QAction*>* globalActions();
+}
+
static const QString recentKeywordsKey = "recentKeywords";
static const int PADDING = 30;
QSettings settings;
QStringList keywords = settings.value(recentKeywordsKey).toStringList();
recentKeywordsLabel->setVisible(!keywords.isEmpty());
+ The::globalActions()->value("clearRecentKeywords")->setEnabled(!keywords.isEmpty());
+
foreach (QString keyword, keywords) {
QLabel *itemLabel = new QLabel("<a href=\"" + keyword
+ "\" style=\"color:palette(text); text-decoration:none\">"
}
+void SearchView::clearRecentKeywords() {
+ QSettings settings;
+ settings.remove(recentKeywordsKey);
+ updateRecentKeywords();
+}
+
void SearchView::watch() {
QString query = queryEdit->text().simplified();
watch(query);