Commit 4d301462 authored by Michael Pyne's avatar Michael Pyne

JuK compiles for me again. I haven't run it yet, and I don't imagine great things would

come of that anyways since I haven't been able to test.  And I still need to work on the
CMake stuff as well, it kind of assumes you have Akode at this point or something.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=536433
parent 1e908c20
......@@ -91,7 +91,11 @@ kde4_add_dcop_skels(juk_SRCS jukIface.h )
kde4_add_executable(juk ${juk_SRCS})
target_link_libraries(juk ${KDE4_KDECORE_LIBS} m kio khtml )
# Add gstreamer here too...
SET(backendLibs ${AKODE_LIBRARIES})
target_link_libraries(juk ${KDE4_KDECORE_LIBS} m kio khtml kdeui tag
${backendLibs})
install_targets(/bin juk )
......
......@@ -28,7 +28,7 @@ namespace ActionCollection
return a;
}
KAction *action(const char *key)
KAction *action(const QString &key)
{
#ifndef NO_DEBUG
KAction *a = actions()->action(key);
......
......@@ -30,13 +30,13 @@ namespace ActionCollection
* Returns the action for the associated key from the global action
* collection.
*/
KAction *action(const char *key);
KAction *action(const QString &key);
/**
* Returns the action for the associated key but includes a cast to the
* type \a T. i.e. KSelectAction *a = action<KSelectAction>("chooser");
*/
template <class T> T *action(const char *key)
template <class T> T *action(const QString &key)
{
return dynamic_cast<T *>(action(key));
}
......
......@@ -113,55 +113,86 @@ void JuK::setupLayout()
void JuK::setupActions()
{
ActionCollection::actions()->setAssociatedWidget(this);
KActionCollection *collection = ActionCollection::actions();
KStdAction::quit(this, SLOT(slotQuit()), ActionCollection::actions());
KStdAction::undo(this, SLOT(slotUndo()), ActionCollection::actions());
KStdAction::cut(kapp, SLOT(cut()), ActionCollection::actions());
KStdAction::copy(kapp, SLOT(copy()), ActionCollection::actions());
KStdAction::paste(kapp, SLOT(paste()), ActionCollection::actions());
KStdAction::clear(kapp, SLOT(clear()), ActionCollection::actions());
KStdAction::selectAll(kapp, SLOT(selectAll()), ActionCollection::actions());
// Setup KDE standard actions that JuK uses.
new KAction(i18n("Remove From Playlist"), "edit_remove", 0, kapp, SLOT(clear()), ActionCollection::actions(), "removeFromPlaylist");
KStdAction::quit(this, SLOT(slotQuit()), collection);
KStdAction::undo(this, SLOT(slotUndo()), collection);
KStdAction::cut(kapp, SLOT(cut()), collection);
KStdAction::copy(kapp, SLOT(copy()), collection);
KStdAction::paste(kapp, SLOT(paste()), collection);
KStdAction::clear(kapp, SLOT(clear()), collection);
KStdAction::selectAll(kapp, SLOT(selectAll()), collection);
KStdAction::keyBindings(this, SLOT(slotEditKeys()), collection);
KActionMenu *actionMenu = new KActionMenu(KIcon("roll"), i18n("&Random Play"), ActionCollection::actions(), "actionMenu");
// Setup the menu which handles the random play options.
KActionMenu *actionMenu = new KActionMenu(KIcon("roll"), i18n("&Random Play"), collection, "actionMenu");
actionMenu->setDelayed(false);
QActionGroup* randomPlayGroup = new QActionGroup( this );
// ### KDE4: Investigate how QActionGroups integrate into menus now.
QActionGroup* randomPlayGroup = new QActionGroup(this);
KAction *ka = new KAction(KIcon("player_playlist"), i18n("&Disable Random Play"), ActionCollection::actions(), "disableRandomPlay");
ka->setActionGroup(randomPlayGroup);
actionMenu->insert(ka);
KAction *act = new KAction(KIcon("player_playlist"), i18n("&Disable Random Play"), collection, "disableRandomPlay");
act->setActionGroup(randomPlayGroup);
actionMenu->insert(act);
m_randomPlayAction = new KAction(KIcon("roll"), i18n("Use &Random Play"), ActionCollection::actions(), "randomPlay");
m_randomPlayAction = new KAction(KIcon("roll"), i18n("Use &Random Play"), collection, "randomPlay");
m_randomPlayAction->setActionGroup(randomPlayGroup);
actionMenu->insert(m_randomPlayAction);
ka = new KAction(i18n("Use &Album Random Play"), "roll", ActionCollection::actions(), "albumRandomPlay");
ka->setActionGroup(randomPlayGroup);
connect(ka, SIGNAL(toggled(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->insert(ka);
act = new KAction(KIcon("roll"), i18n("Use &Album Random Play"), collection, "albumRandomPlay");
act->setActionGroup(randomPlayGroup);
connect(act, SIGNAL(triggered(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->insert(act);
act = new KAction(KIcon("edit_remove"), i18n("Remove From Playlist"), collection, "removeFromPlaylist");
connect(act, SIGNAL(triggered(bool)), kapp, SLOT(clear()));
act = new KAction(KIcon("player_play"), i18n("&Play"), collection, "play");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(play()));
act = new KAction(KIcon("player_pause"), i18n("P&ause"), collection, "pause");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(pause()));
new KAction(i18n("&Play"), "player_play", 0, m_player, SLOT(play()), ActionCollection::actions(), "play");
new KAction(i18n("P&ause"), "player_pause", 0, m_player, SLOT(pause()), ActionCollection::actions(), "pause");
new KAction(i18n("&Stop"), "player_stop", 0, m_player, SLOT(stop()), ActionCollection::actions(), "stop");
act = new KAction(KIcon("player_stop"), i18n("&Stop"), collection, "stop");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(stop()));
new KToolBarPopupAction(i18nc("previous track", "Previous"), "player_start", KShortcut(), m_player, SLOT(back()), ActionCollection::actions(), "back");
new KAction(i18nc("next track", "&Next"), "player_end", KShortcut(), m_player, SLOT(forward()), ActionCollection::actions(), "forward");
new KToggleAction(i18n("&Loop Playlist"), 0, KShortcut(), ActionCollection::actions(), "loopPlaylist");
act = new KToolBarPopupAction(KIcon("player_start"), i18nc("previous track", "Previous"), collection, "back");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(back()));
act = new KAction(KIcon("player_end"), i18nc("next track", "&Next"), collection, "forward");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(forward()));
new KToggleAction(i18n("&Loop Playlist"), collection, "loopPlaylist");
KToggleAction *resizeColumnAction =
new KToggleAction(i18n("&Resize Playlist Columns Manually"),
KShortcut(), ActionCollection::actions(), "resizeColumnsManually");
collection, "resizeColumnsManually");
resizeColumnAction->setCheckedState(i18n("&Resize Column Headers Automatically"));
// the following are not visible by default
new KAction(i18n("Mute"), "mute", 0, m_player, SLOT(mute()), ActionCollection::actions(), "mute");
new KAction(i18n("Volume Up"), "volumeUp", 0, m_player, SLOT(volumeUp()), ActionCollection::actions(), "volumeUp");
new KAction(i18n("Volume Down"), "volumeDown", 0, m_player, SLOT(volumeDown()), ActionCollection::actions(), "volumeDown");
new KAction(i18n("Play / Pause"), "playPause", 0, m_player, SLOT(playPause()), ActionCollection::actions(), "playPause");
new KAction(i18n("Seek Forward"), "seekForward", 0, m_player, SLOT(seekForward()), ActionCollection::actions(), "seekForward");
new KAction(i18n("Seek Back"), "seekBack", 0, m_player, SLOT(seekBack()), ActionCollection::actions(), "seekBack");
act = new KAction(KIcon("mute"), i18n("Mute"), collection, "mute");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(mute()));
act = new KAction(KIcon("volumeUp"), i18n("Volume Up"), collection, "volumeUp");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(volumeUp()));
act = new KAction(KIcon("volumeDown"), i18n("Volume Down"), collection, "volumeDown");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(volumeDown()));
act = new KAction(KIcon("playPause"), i18n("Play / Pause"), collection, "playPause");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(playPause()));
act = new KAction(KIcon("seekForward"), i18n("Seek Forward"), collection, "seekForward");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(seekForward()));
act = new KAction(KIcon("seekBack"), i18n("Seek Back"), collection, "seekBack");
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(seekBack()));
act = new KAction(i18n("Show / Hide"), collection, "showHide");
connect(act, SIGNAL(triggered(bool)), this, SLOT(slotShowHide()));
//////////////////////////////////////////////////
// settings menu
......@@ -169,19 +200,19 @@ void JuK::setupActions()
m_toggleSplashAction =
new KToggleAction(i18n("Show Splash Screen on Startup"),
KShortcut(), ActionCollection::actions(), "showSplashScreen");
collection, "showSplashScreen");
m_toggleSplashAction->setCheckedState(i18n("Hide Splash Screen on Startup"));
m_toggleSystemTrayAction =
new KToggleAction(i18n("&Dock in System Tray"),
KShortcut(), ActionCollection::actions(), "toggleSystemTray");
collection, "toggleSystemTray");
m_toggleDockOnCloseAction =
new KToggleAction(i18n("&Stay in System Tray on Close"),
KShortcut(), ActionCollection::actions(), "dockOnClose");
collection, "dockOnClose");
m_togglePopupsAction =
new KToggleAction(i18n("Popup &Track Announcement"),
KShortcut(), this, 0, ActionCollection::actions(), "togglePopups");
collection, "togglePopups");
new KToggleAction(i18n("Save &Play Queue on Exit"),
KShortcut(), this, 0, ActionCollection::actions(), "saveUpcomingTracks");
collection, "saveUpcomingTracks");
connect(m_toggleSystemTrayAction, SIGNAL(toggled(bool)),
this, SLOT(slotToggleSystemTray(bool)));
......@@ -192,19 +223,17 @@ void JuK::setupActions()
if(m_outputSelectAction)
m_outputSelectAction->setCurrentItem(0);
new KAction(i18n("&Tag Guesser..."), 0, 0, this, SLOT(slotConfigureTagGuesser()),
ActionCollection::actions(), "tagGuesserConfig");
new KAction(i18n("&File Renamer..."), 0, 0, this, SLOT(slotConfigureFileRenamer()),
ActionCollection::actions(), "fileRenamerConfig");
act = new KAction(i18n("&Tag Guesser..."), collection, "tagGuesserConfig");
connect(act, SIGNAL(triggered(bool)), SLOT(slotConfigureTagGuesser()));
KStdAction::keyBindings(this, SLOT(slotEditKeys()), ActionCollection::actions());
act = new KAction(i18n("&File Renamer..."), collection, "fileRenamerConfig");
connect(act, SIGNAL(triggered(bool)), SLOT(slotConfigureFileRenamer()));
//////////////////////////////////////////////////
// just in the toolbar
//////////////////////////////////////////////////
m_sliderAction = new SliderAction(i18n("Track Position"), ActionCollection::actions(),
m_sliderAction = new SliderAction(i18n("Track Position"), collection,
"trackPositionAction");
}
......@@ -229,24 +258,23 @@ void JuK::setupSystemTray()
void JuK::setupGlobalAccels()
{
m_accel = new KGlobalAccel(this);
KeyDialog::insert(m_accel, "Play", i18n("Play"), action("play"), SLOT(trigger()));
KeyDialog::insert(m_accel, "PlayPause", i18n("Play / Pause"), action("playPause"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Stop", i18n("Stop Playing"), action("stop"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Back", i18n("Back"), action("back"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Forward", i18n("Forward"), action("forward"), SLOT(trigger()));
KeyDialog::insert(m_accel, "SeekBack", i18n("Seek Back"), action("seekBack"), SLOT(trigger()));
KeyDialog::insert(m_accel, "SeekForward", i18n("Seek Forward"), action("seekForward"), SLOT(trigger()));
KeyDialog::insert(m_accel, "VolumeUp", i18n("Volume Up"), action("volumeUp"), SLOT(trigger()));
KeyDialog::insert(m_accel, "VolumeDown", i18n("Volume Down"), action("volumeDown"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Mute", i18n("Mute"), action("mute"), SLOT(trigger()));
KeyDialog::insert(m_accel, "ShowHide", i18n("Show / Hide"), this, SLOT(slotShowHide()));
KeyDialog::insert(m_accel, "ForwardAlbum", i18n("Play Next Album"), action("forwardAlbum"), SLOT(trigger()));
m_accel = KGlobalAccel::self();
KeyDialog::setupActionShortcut("play");
KeyDialog::setupActionShortcut("playPause");
KeyDialog::setupActionShortcut("stop");
KeyDialog::setupActionShortcut("back");
KeyDialog::setupActionShortcut("forward");
KeyDialog::setupActionShortcut("seekBack");
KeyDialog::setupActionShortcut("seekForward");
KeyDialog::setupActionShortcut("volumeUp");
KeyDialog::setupActionShortcut("volumeDown");
KeyDialog::setupActionShortcut("mute");
KeyDialog::setupActionShortcut("showHide");
KeyDialog::setupActionShortcut("forwardAlbum");
m_accel->setConfigGroup("Shortcuts");
m_accel->readSettings();
m_accel->updateConnections();
}
void JuK::slotProcessArgs()
......@@ -453,7 +481,7 @@ void JuK::slotToggleSystemTray(bool enabled)
void JuK::slotEditKeys()
{
KeyDialog::configure(m_accel, ActionCollection::actions(), this);
KeyDialog::configure(ActionCollection::actions(), this);
}
void JuK::slotConfigureTagGuesser()
......
......@@ -14,11 +14,14 @@
***************************************************************************/
#include "keydialog.h"
#include "actioncollection.h"
#include <kconfig.h>
#include <klocale.h>
#include <kaction.h>
#include <qradiobutton.h>
#include <QRadioButton>
#include <QGroupBox>
#include <q3vbox.h>
......@@ -26,57 +29,56 @@
// Table of shortcut keys for each action, key group and three or four button modifier
const KeyDialog::KeyInfo KeyDialog::keyInfo[] = {
{ "PlayPause",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_P, Qt::META+Qt::ALT+Qt::Key_P },
{ Qt::Key_MediaPlay, Qt::Key_MediaPlay } } },
{ "Stop",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_S, Qt::META+Qt::ALT+Qt::Key_S },
{ Qt::Key_MediaStop, Qt::Key_MediaStop } } },
{ "Back",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_Left, Qt::META+Qt::ALT+Qt::Key_Left },
{ Qt::Key_MediaPrevious , Qt::Key_MediaPrevious } } },
{ "Forward",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_Right, Qt::META+Qt::ALT+Qt::Key_Right },
{ Qt::Key_MediaNext, Qt::Key_MediaNext } } },
{ "ForwardAlbum",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_Up, Qt::META+Qt::ALT+Qt::Key_Up },
{ Qt::CTRL+Qt::Key_MediaNext, Qt::CTRL+Qt::Key_MediaNext } } },
{ "SeekBack",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Left, Qt::META+Qt::SHIFT+Qt::ALT+Qt::Key_Left },
{ Qt::SHIFT+Qt::Key_MediaPrevious, Qt::SHIFT+Qt::Key_MediaPrevious } } },
{ "SeekForward",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Right, Qt::META+Qt::SHIFT+Qt::ALT+Qt::Key_Right },
{ Qt::SHIFT+Qt::Key_MediaNext, Qt::SHIFT+Qt::Key_MediaNext } } },
{ "VolumeUp",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Up, Qt::META+Qt::ALT+Qt::SHIFT+Qt::Key_Up },
{ Qt::Key_VolumeUp, Qt::Key_VolumeUp } } },
{ "VolumeDown",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Down, Qt::META+Qt::ALT+Qt::SHIFT+Qt::Key_Down },
{ Qt::Key_VolumeDown, Qt::Key_VolumeDown } } },
{ "Mute",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_M, Qt::META+Qt::ALT+Qt::Key_M },
{ Qt::Key_VolumeMute, Qt::Key_VolumeMute } } },
{ "ShowHide",
{ { KShortcut::null(), KShortcut::null() },
{ KShortcut::null(), KShortcut::null() },
{ KShortcut::null(), KShortcut::null() } } }
{ "playPause",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_P,
Qt::Key_MediaPlay } },
{ "stop",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_S,
Qt::Key_MediaStop } },
{ "back",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_Left,
Qt::Key_MediaPrevious } },
{ "forward",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_Right,
Qt::Key_MediaNext } },
{ "forwardAlbum",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_Up,
Qt::CTRL+Qt::Key_MediaNext } },
{ "seekBack",
{ KShortcut::null(),
Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Left,
Qt::SHIFT+Qt::Key_MediaPrevious } },
{ "seekForward",
{ KShortcut::null(),
Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Right,
Qt::SHIFT+Qt::Key_MediaNext } },
{ "volumeUp",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Up,
Qt::Key_VolumeUp } },
{ "volumeDown",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Down,
Qt::Key_VolumeDown } },
{ "mute",
{ KShortcut::null(),
Qt::CTRL+Qt::ALT+Qt::Key_M,
Qt::Key_VolumeMute } },
{ "showHide",
{ KShortcut::null(),
KShortcut::null(),
KShortcut::null() } }
};
const uint KeyDialog::keyInfoCount = sizeof(KeyDialog::keyInfo) / sizeof(KeyDialog::keyInfo[0]);
KeyDialog::KeyDialog(KGlobalAccel *keys, KActionCollection *actionCollection,
QWidget *parent, const char *name)
: KDialogBase(parent, name, true, i18n("Configure Shortcuts"), Default | Ok | Cancel, Ok)
KeyDialog::KeyDialog(KActionCollection *actionCollection, QWidget *parent)
: KDialog(parent, i18n("Configure Shortcuts"), Default | Ok | Cancel)
{
// Read key group from configuration
......@@ -93,20 +95,21 @@ KeyDialog::KeyDialog(KGlobalAccel *keys, KActionCollection *actionCollection,
// Create buttons to select key group
#warning Another place that probably needs some post-mortem analysis.
m_group = new QButtonGroup(vbox);
QGroupBox *buttonBox = new QGroupBox(i18n("Global Shortcuts"), vbox);
m_group = new QButtonGroup(/* i18n("Global Shortcuts"), */ vbox);
new QRadioButton(i18n("&No keys"), /* m_group */ vbox);
new QRadioButton(i18n("&Standard keys"), /* m_group */ vbox);
new QRadioButton(i18n("&Multimedia keys"), /* m_group */ vbox);
connect(m_group, SIGNAL(clicked(int)), this, SLOT(slotKeys(int)));
/*m_group*/ vbox->setWhatsThis(
m_group->addButton(new QRadioButton(i18n("&No keys"), buttonBox), NoKeys);
m_group->addButton(new QRadioButton(i18n("&Standard keys"), buttonBox), StandardKeys);
m_group->addButton(new QRadioButton(i18n("&Multimedia keys"), buttonBox), MultimediaKeys);
connect(m_group, SIGNAL(buttonClicked(int)), this, SLOT(slotKeys(int)));
buttonBox->setWhatsThis(
i18n("Here you can select the keys used as global shortcuts to control the player"));
// Create the key chooser
setMainWidget(vbox);
newDialog(keys, actionCollection, selectedButton);
newDialog(actionCollection, selectedButton);
}
KeyDialog::~KeyDialog()
......@@ -114,20 +117,16 @@ KeyDialog::~KeyDialog()
}
void KeyDialog::newDialog(KGlobalAccel *keys, KActionCollection *actionCollection,
int selectedButton)
void KeyDialog::newDialog(KActionCollection *actionCollection, int selectedButton)
{
m_keys = keys;
m_actionCollection = actionCollection;
// Create key chooser and show it in the widget stack
m_pKeyChooser = new KKeyChooser(keys, this);
m_pKeyChooser->insert(actionCollection);
m_pKeyChooser = new KKeyChooser(actionCollection, this);
m_widgetStack->addWidget(m_pKeyChooser);
m_widgetStack->raiseWidget(m_pKeyChooser);
#warning More broken code
/* m_group->setButton(selectedButton); */
m_group->button(selectedButton)->setChecked(true);
connect(this, SIGNAL(defaultClicked()), this, SLOT(slotDefault()));
}
......@@ -138,10 +137,9 @@ int KeyDialog::configure()
int retcode = exec();
if(retcode == Accepted) {
KConfigGroup config(KGlobal::config(), "Shortcuts");
#warning All of the stuff related to the group selection needs to be rewritten
/* config.writeEntry("GlobalKeys", m_group->id(m_group->selected())); */
config.writeEntry("GlobalKeys", m_group->checkedId());
KGlobal::config()->sync();
m_pKeyChooser->save();
......@@ -151,18 +149,18 @@ int KeyDialog::configure()
void KeyDialog::slotKeys(int group)
{
#warning bleh
bool fourModKeys = /* KGlobalAccel::useFourModifierKeys()*/ true;
// Set modifier keys according to key group and modifier keys
for(uint i = 0; i < keyInfoCount; i++)
m_keys->setShortcut(keyInfo[i].action, keyInfo[i].shortcut[group][fourModKeys]);
for(uint i = 0; i < keyInfoCount; i++) {
KAction *a = ActionCollection::action(keyInfo[i].action);
if(a)
a->setGlobalShortcut(keyInfo[i].shortcut[group]);
}
// Create a new key chooser to show the keys, and delete the old one
QWidget *w = m_widgetStack->visibleWidget();
newDialog(m_keys, m_actionCollection, group);
newDialog(m_actionCollection, group);
m_widgetStack->removeWidget(w);
delete w;
}
......@@ -171,39 +169,35 @@ void KeyDialog::slotDefault()
{
// Select default keys - standard key group
#warning More of the same
/* m_group->setButton(StandardKeys); */
m_group->button(StandardKeys)->setChecked(true);
m_pKeyChooser->allDefault();
}
int KeyDialog::configure(KGlobalAccel *keys, KActionCollection *actionCollection,
QWidget *parent)
int KeyDialog::configure(KActionCollection *actionCollection, QWidget *parent)
{
// Create and show dialog - update connections if accepted
int retcode = KeyDialog(keys, actionCollection, parent).configure();
if(retcode == Accepted)
keys->updateConnections();
return retcode;
return KeyDialog(actionCollection, parent).configure();
}
void KeyDialog::insert(KGlobalAccel *keys, const QString &action, const QString &label,
const QObject *objSlot, const char *methodSlot)
void KeyDialog::setupActionShortcut(const QString &actionName)
{
KShortcut def3 = KShortcut::null();
KShortcut def4 = KShortcut::null();
// Find and insert a standard key
KShortcut shortcut = KShortcut::null();
for(uint i = 0; i < keyInfoCount; i++) {
if(keyInfo[i].action == action) {
def3 = keyInfo[i].shortcut[StandardKeys][0];
def4 = keyInfo[i].shortcut[StandardKeys][1];
if(keyInfo[i].action == actionName) {
shortcut = keyInfo[i].shortcut[StandardKeys];
break;
}
}
keys->insert(action, label, QString::null, def3, objSlot, methodSlot);
if(shortcut.isNull())
return; // We have no shortcut to set.
KAction *a = ActionCollection::action(actionName);
if(a)
a->setGlobalShortcut(shortcut);
}
#include "keydialog.moc"
......
......@@ -23,7 +23,7 @@
#include <qbuttongroup.h>
#include <q3widgetstack.h>
class KeyDialog : public KDialogBase
class KeyDialog : public KDialog
{
Q_OBJECT
......@@ -31,7 +31,7 @@ public:
/**
* Constructs a KeyDialog called @p name as a child of @p parent.
*/
KeyDialog(KGlobalAccel *keys, KActionCollection *actionCollection, QWidget *parent = 0, const char* name = 0);
KeyDialog(KActionCollection *actionCollection, QWidget *parent = 0);
/**
* Destructor. Deletes all resources used by a KeyDialog object.
......@@ -40,17 +40,15 @@ public:
/**
* This is a member function, provided to allow inserting both global
* accelerators and actions. It behaves essentially like the functions
* in KKeyDialog.
* accelerators and actions.
*/
static int configure(KGlobalAccel *keys, KActionCollection *actionCollection, QWidget *parent = 0);
static int configure(KActionCollection *actionCollection, QWidget *parent = 0);
/**
* This is a member function, provided to create a global accelerator with
* standard keys. It behaves like the function in KGlobalAccel.
* standard keys.
*/
static void insert(KGlobalAccel *keys, const QString &action, const QString &label,
const QObject *objSlot, const char *methodSlot);
static void setupActionShortcut(const QString &actionName);
private:
......@@ -61,10 +59,10 @@ private:
struct KeyInfo {
QString action;
KShortcut shortcut[3][2];
KShortcut shortcut[3];
};
void newDialog(KGlobalAccel *keys, KActionCollection *actionCollection, int selectedButton = 0);
void newDialog(KActionCollection *actionCollection, int selectedButton = 0);
int configure();
private slots:
......@@ -73,7 +71,6 @@ private slots:
private:
KActionCollection *m_actionCollection;
KGlobalAccel *m_keys;
KKeyChooser *m_pKeyChooser;
QButtonGroup *m_group;
Q3WidgetStack *m_widgetStack;
......
......@@ -841,11 +841,11 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
menu = new KActionMenu(KIcon("filenew"), i18n("&New"), actions(), "file_new");
menu->insert(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()),
"newPlaylist", "window_new", "CTRL+n"));
"newPlaylist", "window_new", Qt::CTRL + Qt::Key_N));
menu->insert(createAction(i18n("&Search Playlist..."), SLOT(slotCreateSearchPlaylist()),