Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2889fd1f authored by Michael Pyne's avatar Michael Pyne

More QAction streamlining.

- Use KActionCollection::setDefaultShortcut to reduce warnings
- Use QKeySequence instead of deprecated KShortcut
parent 8787d751
......@@ -915,11 +915,11 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
actions()->addAction("file_new", menu);
menu->addAction(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()),
"newPlaylist", "window-new", KShortcut(Qt::CTRL + Qt::Key_N)));
"newPlaylist", "window-new", QKeySequence(Qt::CTRL + Qt::Key_N)));
menu->addAction(createAction(i18n("&Search Playlist..."), SLOT(slotCreateSearchPlaylist()),
"newSearchPlaylist", "edit-find", KShortcut(Qt::CTRL + Qt::Key_F)));
"newSearchPlaylist", "edit-find", QKeySequence(Qt::CTRL + Qt::Key_F)));
menu->addAction(createAction(i18n("Playlist From &Folder..."), SLOT(slotCreateFolderPlaylist()),
"newDirectoryPlaylist", "document-open", KShortcut(Qt::CTRL + Qt::Key_D)));
"newDirectoryPlaylist", "document-open", QKeySequence(Qt::CTRL + Qt::Key_D)));
// Guess tag info menu
......@@ -930,12 +930,12 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
/* menu->setIcon(SmallIcon("wizard")); */
menu->addAction(createAction(i18n("From &File Name"), SLOT(slotGuessTagFromFile()),
"guessTagFile", "document-import", KShortcut(Qt::CTRL + Qt::Key_G)));
"guessTagFile", "document-import", QKeySequence(Qt::CTRL + Qt::Key_G)));
menu->addAction(createAction(i18n("From &Internet"), SLOT(slotGuessTagFromInternet()),
"guessTagInternet", "network-server", KShortcut(Qt::CTRL + Qt::Key_I)));
"guessTagInternet", "network-server", QKeySequence(Qt::CTRL + Qt::Key_I)));
#else
createAction(i18n("Guess Tag Information From &File Name"), SLOT(slotGuessTagFromFile()),
"guessTag", "document-import", KShortcut(Qt::CTRL + Qt::Key_G));
"guessTag", "document-import", QKeySequence(Qt::CTRL + Qt::Key_G));
#endif
......@@ -956,7 +956,7 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
createAction(i18n("&Delete"), SLOT(slotRemoveItems()), "removeItem", "edit-delete");
createAction(i18n("Refresh"), SLOT(slotRefreshItems()), "refresh", "view-refresh");
createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "document-save-as", KShortcut(Qt::CTRL + Qt::Key_R));
createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "document-save-as", QKeySequence(Qt::CTRL + Qt::Key_R));
menu = new KActionMenu(i18n("Cover Manager"), actions());
actions()->addAction("coverManager", menu);
......@@ -964,9 +964,9 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
menu->addAction(createAction(i18n("&View Cover"),
SLOT(slotViewCovers()), "viewCover", "document-preview"));
menu->addAction(createAction(i18n("Get Cover From &File..."),
SLOT(slotAddLocalCover()), "addCover", "document-import", KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F)));
SLOT(slotAddLocalCover()), "addCover", "document-import", QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F)));
menu->addAction(createAction(i18n("Get Cover From &Internet..."),
SLOT(slotAddInternetCover()), "webImageCover", "network-server", KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_G)));
SLOT(slotAddInternetCover()), "webImageCover", "network-server", QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G)));
menu->addAction(createAction(i18n("&Delete Cover"),
SLOT(slotRemoveCovers()), "removeCover", "edit-delete"));
menu->addAction(createAction(i18n("Show Cover &Manager"),
......@@ -984,17 +984,20 @@ QAction *PlaylistCollection::ActionHandler::createAction(const QString &text,
const char *slot,
const char *name,
const QString &icon,
const KShortcut &shortcut)
const QKeySequence &shortcut)
{
QAction *action;
if(icon.isNull())
action = new QAction(text, actions());
else
action = new QAction(QIcon::fromTheme(icon), text, actions());
actions()->addAction(name, action);
connect( action, SIGNAL(triggered(bool)), slot);
if (!shortcut.toList().isEmpty()) {
action->setShortcut(shortcut.toList().constFirst());
auto actionCollection = actions();
QAction *action = new QAction(text, actions());
if(!icon.isEmpty()) {
action->setIcon(QIcon::fromTheme(icon));
}
connect(action, SIGNAL(triggered(bool)), slot);
actionCollection->addAction(name, action);
if (!shortcut.isEmpty()) {
actionCollection->setDefaultShortcut(action, shortcut);
}
return action;
}
......
......@@ -25,6 +25,7 @@
#include <kdirlister.h>
#include <QPointer>
#include <QKeySequence>
class QPixmap;
class QStackedWidget;
......@@ -245,7 +246,7 @@ private:
const char *slot,
const char *name,
const QString &icon = QString(),
const KShortcut &shortcut = KShortcut());
const QKeySequence &shortcut = QKeySequence());
private slots:
void slotPlayFirst() { m_collection->playFirst(); }
void slotPlayNextAlbum() { m_collection->playNextAlbum(); }
......
......@@ -32,6 +32,7 @@
#include <QTime>
#include <QStackedWidget>
#include <QSizePolicy>
#include <QKeySequence>
#include "searchwidget.h"
#include "playlistsearch.h"
......@@ -164,7 +165,7 @@ void PlaylistSplitter::setupActions()
QAction *act = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear")), i18n("Edit Track Search"), this);
coll->addAction("editTrackSearch", act);
act->setShortcut(Qt::Key_F6);
coll->setDefaultShortcut(act, Qt::Key_F6);
connect(act, SIGNAL(triggered(bool)), SLOT(setFocus()));
}
......
......@@ -488,11 +488,13 @@ void TagEditor::setupActions()
i18n("Show &Tag Editor"), this);
ActionCollection::actions()->addAction("showEditor", show);
connect(show, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool)));
connect(show, &QAction::toggled, this, &TagEditor::setVisible);
QAction *act = new QAction(QIcon::fromTheme(QLatin1String( "document-save")), i18n("&Save"), this);
ActionCollection::actions()->addAction("saveItem", act);
act->setShortcut(Qt::CTRL + Qt::Key_T);
connect(act, SIGNAL(triggered(bool)), SLOT(slotSave()));
ActionCollection::actions()->setDefaultShortcut(act,
QKeySequence(Qt::CTRL + Qt::Key_T));
connect(act, &QAction::triggered, this, &TagEditor::slotSave);
}
void TagEditor::setupLayout()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment