added 'Add to...' context submenu and addToFavoritesAction

This commit is contained in:
Luis Ángel San Martín 2014-11-27 16:29:29 +01:00
parent b80c72f70d
commit 4ca873e058
5 changed files with 35 additions and 4 deletions

View File

@ -179,7 +179,14 @@ void GridComicsView::setViewActions(const QList<QAction *> &actions)
ctxt->setContextProperty("deleteComicsAction",actions[17]);
ctxt->setContextProperty("toggleFullScreenAction",actions[19]);
QAction * tmpAction = actions[19];
QMenu * menu = tmpAction->menu();
if(menu)
{
ctxt->setContextProperty("addToFavoritesAction",menu->actions().at(0));
}
ctxt->setContextProperty("toggleFullScreenAction",actions[21]);
}
else
QLOG_ERROR() << "setViewActions invoked with the wrong number of actions";

View File

@ -760,6 +760,18 @@ void LibraryWindow::createActions()
renameListAction->setToolTip(tr("Rename any selected labels or lists"));
renameListAction->setIcon(QIcon(":/images/renameListIcon.png"));
//--
addToMenuAction = new QAction(tr("Add to..."), this);
addToFavoritesAction = new QAction(tr("Favorites"), this);
addToFavoritesAction->setData(ADD_TO_FAVORITES_ACTION_YL);
addToFavoritesAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADD_TO_FAVORITES_ACTION_YL));
addToFavoritesAction->setToolTip(tr("Add selected comics to favorites list"));
addToFavoritesAction->setIcon(QIcon(":/images/lists/default_1.png"));
QMenu * menu = new QMenu(this);
menu->addAction(addToFavoritesAction);
addToMenuAction->setMenu(menu);
//disable actions
disableAllActions();
}
@ -926,7 +938,9 @@ void LibraryWindow::createMenus()
<< setAsReadAction
<< setAsNonReadAction
<< YACReader::createSeparator()
<< deleteComicsAction;
<< deleteComicsAction
<< YACReader::createSeparator()
<< addToMenuAction;
viewActions << openComicAction
<< YACReader::createSeparator()
@ -946,6 +960,8 @@ void LibraryWindow::createMenus()
<< showHideMarksAction
<< YACReader::createSeparator()
<< deleteComicsAction
<< YACReader::createSeparator()
<< addToMenuAction
#ifndef Q_OS_MAC
<< YACReader::createSeparator()

View File

@ -217,8 +217,8 @@ private:
QAction * addLabelAction;
QAction * renameListAction;
//--
//QAction * expandAllNodesRLAction;
//QAction * colapseAllNodesRLAction;
QAction * addToMenuAction;
QAction * addToFavoritesAction;
QList<QAction *> itemActions;
QList<QAction *> viewActions;

View File

@ -121,6 +121,13 @@ Rectangle {
MenuItem { text: "Show or hide read marks"; enabled: true; iconSource:"qrc:///images/showMarks.png"; onTriggered: showHideMarksAction.trigger() }
MenuSeparator{}
MenuItem { text: "Delete selected comics"; enabled: true; iconSource:"qrc:///images/trash.png"; onTriggered: deleteComicsAction.trigger() }
MenuSeparator{}
Menu {
id: addToMenu
title: "Add to..."
MenuItem { text: "Favorites"; enabled: true; iconSource:"qrc:///images/lists/default_1.png"; onTriggered: addToFavoritesAction.trigger() }
}
MenuSeparator{}
MenuItem { text: "Fullscreen mode on/off"; onTriggered: toggleFullScreenAction.trigger() }
//MenuItem { text: "Show details"; onTriggered: cell.state = 'Details';

View File

@ -79,6 +79,7 @@ public:
#define REMOVE_READING_LIST_ACTION_YL "REMOVE_READING_LIST_ACTION_YL"
#define ADD_LABEL_ACTION_YL "ADD_LABEL_ACTION_YL"
#define RENAME_LIST_ACTION_YL "RENAME_LIST_ACTION_YL"
#define ADD_TO_FAVORITES_ACTION_YL "ADD_TO_FAVORITES_ACTION_YL"
//COMMANDS YACReaderLibrary