Replace warnings about KShortcutDialog being dead with something that is not dead.
Now, since I don't see any shortcuts-related hacks, why exactly am I supposed to contact you? CCMAIL: ahartmetz@gmail.com BUG: 151642 svn path=/trunk/KDE/kdebase/workspace/; revision=731744
This commit is contained in:
parent
95d28eb246
commit
1b8b326c7b
5 changed files with 47 additions and 50 deletions
|
@ -309,6 +309,9 @@ void Workspace::initShortcuts()
|
|||
// a separate KActionCollection is needed for the shortcut for disabling global shortcuts,
|
||||
// otherwise it would also disable itself
|
||||
disable_shortcuts_keys = new KActionCollection( this );
|
||||
#ifdef __GNUC__
|
||||
#warning TODO PORT ME (KGlobalAccel related)
|
||||
#endif
|
||||
// FIXME KAccel port... needed?
|
||||
//disable_shortcuts_keys->disableBlocking( true );
|
||||
#define IN_KWIN
|
||||
|
@ -355,15 +358,14 @@ void Workspace::readShortcuts()
|
|||
|
||||
void Workspace::setupWindowShortcut( Client* c )
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning ifdefed out, KShortcutDialog is 0xDEAD
|
||||
#endif //__GNUC__
|
||||
#if 0
|
||||
assert( client_keys_dialog == NULL );
|
||||
keys->setEnabled( false );
|
||||
disable_shortcuts_keys->setEnabled( false );
|
||||
client_keys->setEnabled( false );
|
||||
client_keys_dialog = new ShortcutDialog( c->shortcut());
|
||||
#ifdef __GNUC__
|
||||
#warning TODO PORT ME (KGlobalAccel related)
|
||||
#endif
|
||||
// keys->setEnabled( false );
|
||||
// disable_shortcuts_keys->setEnabled( false );
|
||||
// client_keys->setEnabled( false );
|
||||
client_keys_dialog = new ShortcutDialog( c->shortcut().primary());
|
||||
client_keys_client = c;
|
||||
connect( client_keys_dialog, SIGNAL( dialogDone( bool )), SLOT( setupWindowShortcutDone( bool )));
|
||||
QRect r = clientArea( ScreenArea, c );
|
||||
|
@ -377,24 +379,19 @@ void Workspace::setupWindowShortcut( Client* c )
|
|||
client_keys_dialog->show();
|
||||
active_popup = client_keys_dialog;
|
||||
active_popup_client = c;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Workspace::setupWindowShortcutDone( bool ok )
|
||||
{
|
||||
#if 0 //see above
|
||||
keys->setEnabled( true );
|
||||
disable_shortcuts_keys->setEnabled( true );
|
||||
client_keys->setEnabled( true );
|
||||
// keys->setEnabled( true );
|
||||
// disable_shortcuts_keys->setEnabled( true );
|
||||
// client_keys->setEnabled( true );
|
||||
if( ok )
|
||||
{
|
||||
client_keys_client->setShortcut( KShortcut( client_keys_dialog->shortcut()).toString());
|
||||
}
|
||||
closeActivePopup();
|
||||
delete client_keys_dialog;
|
||||
client_keys_dialog = NULL;
|
||||
client_keys_client = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Workspace::clientShortcutUpdated( Client* c )
|
||||
|
|
43
utils.cpp
43
utils.cpp
|
@ -415,13 +415,10 @@ bool isLocalMachine( const QByteArray& host )
|
|||
}
|
||||
|
||||
#ifndef KCMRULES
|
||||
#ifdef __GNUC__
|
||||
#warning KShortcutDialog is gone
|
||||
#endif //__GNUC__
|
||||
#if 0
|
||||
ShortcutDialog::ShortcutDialog( const KShortcut& cut )
|
||||
: KShortcutDialog( cut, false /*TODO: ???*/ )
|
||||
ShortcutDialog::ShortcutDialog( const QKeySequence& cut )
|
||||
: widget( new KKeySequenceWidget( this ))
|
||||
{
|
||||
widget->setKeySequence( cut );
|
||||
// make it a popup, so that it has the grab
|
||||
XSetWindowAttributes attrs;
|
||||
attrs.override_redirect = True;
|
||||
|
@ -431,32 +428,36 @@ ShortcutDialog::ShortcutDialog( const KShortcut& cut )
|
|||
|
||||
void ShortcutDialog::accept()
|
||||
{
|
||||
foreach( const QKeySequence &seq, shortcut() )
|
||||
QKeySequence seq = shortcut();
|
||||
if( !seq.isEmpty())
|
||||
{
|
||||
if( seq.isEmpty())
|
||||
break;
|
||||
if( seq[0] == Qt::Key_Escape )
|
||||
{
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
if( seq[0] == Qt::Key_Space )
|
||||
if( seq[0] == Qt::Key_Space
|
||||
|| (seq[0] & Qt::KeyboardModifierMask) == 0 )
|
||||
{ // clear
|
||||
setShortcut( KShortcut());
|
||||
KShortcutDialog::accept();
|
||||
return;
|
||||
}
|
||||
if( (seq[0] & Qt::KeyboardModifierMask) == 0 )
|
||||
{ // no shortcuts without modifiers
|
||||
KShortcut cut = shortcut();
|
||||
cut.remove( seq );
|
||||
setShortcut( cut );
|
||||
widget->clearKeySequence();
|
||||
KDialog::accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
KShortcutDialog::accept();
|
||||
KDialog::accept();
|
||||
}
|
||||
#endif //0
|
||||
|
||||
void ShortcutDialog::done( int r )
|
||||
{
|
||||
KDialog::done( r );
|
||||
emit dialogDone( r == Accepted );
|
||||
}
|
||||
|
||||
QKeySequence ShortcutDialog::shortcut() const
|
||||
{
|
||||
return widget->keySequence();
|
||||
}
|
||||
|
||||
#endif //KCMRULES
|
||||
} // namespace
|
||||
|
||||
|
|
19
utils.h
19
utils.h
|
@ -23,9 +23,10 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include <QWidget>
|
||||
#include <kmanagerselection.h>
|
||||
#include <netwm_def.h>
|
||||
//#include <kshortcutdialog.h> //you really want to use KKeySequenceWidget
|
||||
#include <kkeysequencewidget.h>
|
||||
#include <limits.h>
|
||||
#include <QX11Info>
|
||||
#include <kdialog.h>
|
||||
|
||||
#include <kwinglobals.h>
|
||||
|
||||
|
@ -291,24 +292,22 @@ void checkNonExistentClients();
|
|||
|
||||
#ifndef KCMRULES
|
||||
// Qt dialogs emit no signal when closed :(
|
||||
|
||||
// KShortcutDialog is gone, and K(Shortcut/KeySequence)Widget should replace it and be
|
||||
// good enough to not need any further hacks here. If they aren't, CONTACT ME before
|
||||
// you add hacks again. --ahartmetz
|
||||
#if 0
|
||||
class ShortcutDialog
|
||||
: public KShortcutDialog
|
||||
: public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShortcutDialog( const KShortcut& cut );
|
||||
ShortcutDialog( const QKeySequence& cut );
|
||||
virtual void accept();
|
||||
QKeySequence shortcut() const;
|
||||
signals:
|
||||
void dialogDone( bool ok );
|
||||
protected:
|
||||
virtual void done( int r ) { KShortcutDialog::done( r ); emit dialogDone( r == Accepted ); }
|
||||
virtual void done( int r );
|
||||
private:
|
||||
KKeySequenceWidget* widget;
|
||||
};
|
||||
#endif //0
|
||||
|
||||
#endif //KCMRULES
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -105,7 +105,7 @@ Workspace::Workspace( bool restore )
|
|||
desk_popup (0),
|
||||
keys (0),
|
||||
client_keys ( NULL ),
|
||||
// client_keys_dialog ( NULL ),
|
||||
client_keys_dialog ( NULL ),
|
||||
client_keys_client ( NULL ),
|
||||
disable_shortcuts_keys ( NULL ),
|
||||
global_shortcuts_disabled( false ),
|
||||
|
@ -469,7 +469,7 @@ Workspace::~Workspace()
|
|||
delete topmenu_watcher;
|
||||
delete topmenu_selection;
|
||||
delete topmenu_space;
|
||||
// delete client_keys_dialog;
|
||||
delete client_keys_dialog;
|
||||
while( !rules.isEmpty())
|
||||
{
|
||||
delete rules.front();
|
||||
|
|
|
@ -646,7 +646,7 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
QAction *mNoBorderOpAction;
|
||||
QAction *mMinimizeOpAction;
|
||||
QAction *mCloseOpAction;
|
||||
// ShortcutDialog* client_keys_dialog;
|
||||
ShortcutDialog* client_keys_dialog;
|
||||
Client* client_keys_client;
|
||||
KActionCollection *disable_shortcuts_keys;
|
||||
bool global_shortcuts_disabled;
|
||||
|
|
Loading…
Reference in a new issue