From 77bc9cd63d7cb39f3cb337644f22402ede3fcc4d Mon Sep 17 00:00:00 2001 From: Hamish Rodda Date: Mon, 10 Apr 2006 11:57:13 +0000 Subject: [PATCH] Merging in from bleeding edge kdebase branch - i18n ported - KAccel removed - Some fixes for OS X svn path=/trunk/KDE/kdebase/workspace/; revision=528190 --- activation.cpp | 2 +- clients/default/kdedefault.cpp | 12 +- clients/keramik/config/config.cpp | 6 +- clients/keramik/keramik.cpp | 106 +++++++------- clients/quartz/config/config.cpp | 2 +- clients/quartz/quartz.cpp | 14 +- events.cpp | 29 ++-- group.cpp | 2 +- kcmkwin/kwindecoration/buttons.cpp | 6 +- kcmkwin/kwinoptions/windows.cpp | 14 +- kcmkwin/kwinrules/main.cpp | 4 +- kcmkwin/kwinrules/ruleswidget.cpp | 16 +-- killer/killer.cpp | 4 +- kwinbindings.cpp | 218 ++++++++++++++--------------- lib/kcommondecoration.cpp | 2 +- lib/kdecoration_plugins_p.cpp | 2 +- placement.cpp | 4 +- popupinfo.cpp | 2 +- sm.cpp | 2 +- tabbox.cpp | 47 +++---- tools/test_gravity.cpp | 4 +- useractions.cpp | 68 ++++----- utils.cpp | 12 +- workspace.cpp | 30 ++-- workspace.h | 10 +- 25 files changed, 308 insertions(+), 310 deletions(-) diff --git a/activation.cpp b/activation.cpp index a42111934f..fdfc5f6b5e 100644 --- a/activation.cpp +++ b/activation.cpp @@ -689,7 +689,7 @@ void Client::demandAttention( bool set ) void Client::demandAttentionKNotify() { Notify::Event e = isOnCurrentDesktop() ? Notify::DemandAttentionCurrent : Notify::DemandAttentionOther; - Notify::raise( e, i18n( "Window '%1' demands attention." ).arg( KStringHandler::csqueeze(caption())), this ); + Notify::raise( e, i18n( "Window '%1' demands attention.", KStringHandler::csqueeze(caption())), this ); demandAttentionKNotifyTimer->stop(); demandAttentionKNotifyTimer->deleteLater(); demandAttentionKNotifyTimer = NULL; diff --git a/clients/default/kdedefault.cpp b/clients/default/kdedefault.cpp index 7c80367970..a7071ae56f 100644 --- a/clients/default/kdedefault.cpp +++ b/clients/default/kdedefault.cpp @@ -289,11 +289,11 @@ void KDEDefaultHandler::createPixmaps() } else titlePix = NULL; - QColor activeTitleColor1(options()->color(ColorTitleBar, true)); - QColor activeTitleColor2(options()->color(ColorTitleBlend, true)); + QColor activeTitleColor1(options()->color(ColorTitleBar, true)); + QColor activeTitleColor2(options()->color(ColorTitleBlend, true)); - QColor inactiveTitleColor1(options()->color(ColorTitleBar, false)); - QColor inactiveTitleColor2(options()->color(ColorTitleBlend, false)); + QColor inactiveTitleColor1(options()->color(ColorTitleBar, false)); + QColor inactiveTitleColor2(options()->color(ColorTitleBlend, false)); // Create titlebar gradient images if required aUpperGradient = NULL; @@ -947,10 +947,10 @@ void KDEDefaultClient::paintEvent( QPaintEvent* ) QPolygon a; QBrush brush( options()->color(ColorFrame, isActive()), Qt::SolidPattern ); p.setBrush( brush ); // use solid, yellow brush - a.setPoints( 4, x+2, leftFrameStart+borderWidth-4, + a.setPoints( 4, x+2, leftFrameStart+borderWidth-4, x+borderWidth-2, leftFrameStart, x+borderWidth-2, y2-2, - x+2, y2-2); + x+2, y2-2); p.drawPolygon( a ); p.fillRect(x2-borderWidth+2, y+titleHeight+3, borderWidth-3, y2-y-titleHeight-4, diff --git a/clients/keramik/config/config.cpp b/clients/keramik/config/config.cpp index 77bef2813d..290c2ae113 100644 --- a/clients/keramik/config/config.cpp +++ b/clients/keramik/config/config.cpp @@ -55,9 +55,9 @@ KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent ) c = new KConfig( "kwinkeramikrc" ); ui = new KeramikConfigUI( parent ); - connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) ); - connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) ); - connect( ui->largeGrabBars, SIGNAL(clicked()), SIGNAL(changed()) ); + connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) ); + connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) ); + connect( ui->largeGrabBars, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) ); load( conf ); diff --git a/clients/keramik/keramik.cpp b/clients/keramik/keramik.cpp index 0fd9950459..6c8a680c30 100644 --- a/clients/keramik/keramik.cpp +++ b/clients/keramik/keramik.cpp @@ -174,20 +174,20 @@ KeramikHandler::KeramikHandler() settings_cache = NULL; // Create the button deco bitmaps - buttonDecos[ Menu ] = new QBitmap( 17, 17, menu_bits, true ); - buttonDecos[ OnAllDesktops ] = new QBitmap( 17, 17, on_all_desktops_bits, true ); + buttonDecos[ Menu ] = new QBitmap( 17, 17, menu_bits, true ); + buttonDecos[ OnAllDesktops ] = new QBitmap( 17, 17, on_all_desktops_bits, true ); buttonDecos[ NotOnAllDesktops ] = new QBitmap( 17, 17, not_on_all_desktops_bits, true ); - buttonDecos[ Help ] = new QBitmap( 17, 17, help_bits, true ); - buttonDecos[ Minimize ] = new QBitmap( 17, 17, minimize_bits, true ); - buttonDecos[ Maximize ] = new QBitmap( 17, 17, maximize_bits, true ); - buttonDecos[ Restore ] = new QBitmap( 17, 17, restore_bits, true ); - buttonDecos[ Close ] = new QBitmap( 17, 17, close_bits, true ); - buttonDecos[ AboveOn ] = new QBitmap( 17, 17, above_on_bits, true ); - buttonDecos[ AboveOff ] = new QBitmap( 17, 17, above_off_bits, true ); - buttonDecos[ BelowOn ] = new QBitmap( 17, 17, below_on_bits, true ); - buttonDecos[ BelowOff ] = new QBitmap( 17, 17, below_off_bits, true ); - buttonDecos[ ShadeOn ] = new QBitmap( 17, 17, shade_on_bits, true ); - buttonDecos[ ShadeOff ] = new QBitmap( 17, 17, shade_off_bits, true ); + buttonDecos[ Help ] = new QBitmap( 17, 17, help_bits, true ); + buttonDecos[ Minimize ] = new QBitmap( 17, 17, minimize_bits, true ); + buttonDecos[ Maximize ] = new QBitmap( 17, 17, maximize_bits, true ); + buttonDecos[ Restore ] = new QBitmap( 17, 17, restore_bits, true ); + buttonDecos[ Close ] = new QBitmap( 17, 17, close_bits, true ); + buttonDecos[ AboveOn ] = new QBitmap( 17, 17, above_on_bits, true ); + buttonDecos[ AboveOff ] = new QBitmap( 17, 17, above_off_bits, true ); + buttonDecos[ BelowOn ] = new QBitmap( 17, 17, below_on_bits, true ); + buttonDecos[ BelowOff ] = new QBitmap( 17, 17, below_off_bits, true ); + buttonDecos[ ShadeOn ] = new QBitmap( 17, 17, shade_on_bits, true ); + buttonDecos[ ShadeOff ] = new QBitmap( 17, 17, shade_off_bits, true ); // Selfmask the bitmaps for ( int i = 0; i < NumButtonDecos; i++ ) @@ -267,11 +267,11 @@ void KeramikHandler::createPixmaps() // Active tiles // ------------------------------------------------------------------------- - captionColor = KDecoration::options()->color( ColorTitleBar, true ); + captionColor = KDecoration::options()->color( ColorTitleBar, true ); titleColor = KDecoration::options()->color( ColorTitleBlend, true ); // Load the titlebar corners. - activeTiles[ TitleLeft ] = loadPixmap( "titlebar-left", titleColor ); + activeTiles[ TitleLeft ] = loadPixmap( "titlebar-left", titleColor ); activeTiles[ TitleRight ] = loadPixmap( "titlebar-right", titleColor ); // Load the titlebar center tile image (this will be used as @@ -279,13 +279,13 @@ void KeramikHandler::createPixmaps() titleCenter = loadImage( "titlebar-center", titleColor ); // Load the small version of the caption bubble corner & center images. - captionLeft = loadImage( "caption-small-left", captionColor ); - captionRight = loadImage( "caption-small-right", captionColor ); + captionLeft = loadImage( "caption-small-left", captionColor ); + captionRight = loadImage( "caption-small-right", captionColor ); captionCenter = loadImage( "caption-small-center", captionColor ); // Create the caption bubble tiles (by blending the images onto the titlebar) - activeTiles[ CaptionSmallLeft ] = composite( captionLeft, titleCenter ); - activeTiles[ CaptionSmallRight ] = composite( captionRight, titleCenter ); + activeTiles[ CaptionSmallLeft ] = composite( captionLeft, titleCenter ); + activeTiles[ CaptionSmallRight ] = composite( captionRight, titleCenter ); activeTiles[ CaptionSmallCenter ] = composite( captionCenter, titleCenter ); delete captionLeft; @@ -293,12 +293,12 @@ void KeramikHandler::createPixmaps() delete captionCenter; // Now do the same with the large version - captionLeft = loadImage( "caption-large-left", captionColor ); - captionRight = loadImage( "caption-large-right", captionColor ); + captionLeft = loadImage( "caption-large-left", captionColor ); + captionRight = loadImage( "caption-large-right", captionColor ); captionCenter = loadImage( "caption-large-center", captionColor ); - activeTiles[ CaptionLargeLeft ] = composite( captionLeft, titleCenter ); - activeTiles[ CaptionLargeRight ] = composite( captionRight, titleCenter ); + activeTiles[ CaptionLargeLeft ] = composite( captionLeft, titleCenter ); + activeTiles[ CaptionLargeRight ] = composite( captionRight, titleCenter ); activeTiles[ CaptionLargeCenter ] = composite( captionCenter, titleCenter ); delete captionLeft; @@ -311,36 +311,36 @@ void KeramikHandler::createPixmaps() delete titleCenter; // Load the left & right border pixmaps - activeTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor ); + activeTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor ); activeTiles[ BorderRight ] = loadPixmap( "border-right", titleColor ); // Load the bottom grabbar pixmaps if ( largeGrabBars ) { - activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); - activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); + activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); + activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); activeTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); } else { - activeTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); - activeTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); + activeTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); + activeTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); activeTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor ); } // Inactive tiles // ------------------------------------------------------------------------- - captionColor = KDecoration::options()->color( ColorTitleBar, false ); + captionColor = KDecoration::options()->color( ColorTitleBar, false ); titleColor = KDecoration::options()->color( ColorTitleBlend, false ); - inactiveTiles[ TitleLeft ] = loadPixmap( "titlebar-left", titleColor ); + inactiveTiles[ TitleLeft ] = loadPixmap( "titlebar-left", titleColor ); inactiveTiles[ TitleRight ] = loadPixmap( "titlebar-right", titleColor ); titleCenter = loadImage( "titlebar-center", titleColor ); - captionLeft = loadImage( "caption-small-left", captionColor ); - captionRight = loadImage( "caption-small-right", captionColor ); + captionLeft = loadImage( "caption-small-left", captionColor ); + captionRight = loadImage( "caption-small-right", captionColor ); captionCenter = loadImage( "caption-small-center", captionColor ); - inactiveTiles[ CaptionSmallLeft ] = composite( captionLeft, titleCenter ); - inactiveTiles[ CaptionSmallRight ] = composite( captionRight, titleCenter ); + inactiveTiles[ CaptionSmallLeft ] = composite( captionLeft, titleCenter ); + inactiveTiles[ CaptionSmallRight ] = composite( captionRight, titleCenter ); inactiveTiles[ CaptionSmallCenter ] = composite( captionCenter, titleCenter ); delete captionLeft; @@ -351,16 +351,16 @@ void KeramikHandler::createPixmaps() delete titleCenter; - inactiveTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor ); + inactiveTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor ); inactiveTiles[ BorderRight ] = loadPixmap( "border-right", titleColor ); if ( largeGrabBars ) { - inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); - inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); + inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); + inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); } else { - inactiveTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); - inactiveTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); + inactiveTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); + inactiveTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); inactiveTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor ); } @@ -368,7 +368,7 @@ void KeramikHandler::createPixmaps() // ------------------------------------------------------------------------- buttonColor = QColor(); //KDecoration::options()->color( ButtonBg, true ); - titleButtonRound = loadPixmap( "titlebutton-round"+size, buttonColor ); + titleButtonRound = loadPixmap( "titlebutton-round"+size, buttonColor ); titleButtonSquare = loadPixmap( "titlebutton-square"+size, buttonColor ); @@ -827,7 +827,7 @@ void KeramikButton::drawButton( QPainter *p ) if ( isDown() ) { // Pressed p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QApplication::isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight, QRect(2*size, 0, size, size), pix->rect() ) ); - p->translate( QApplication::isRightToLeft() ? -1 : 1, 1 ); + p->translate( QApplication::isRightToLeft() ? -1 : 1, 1 ); } else if ( hover ) // Mouse over p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QApplication::isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight, QRect(size, 0, size, size), pix->rect() ) ); @@ -1141,8 +1141,8 @@ void KeramikClient::updateMask() register int x = captionRect.left(); w = captionRect.width(); r += QRegion( x + 11, y++, w - 19, 1 ); - r += QRegion( x + 9, y++, w - 15, 1 ); - r += QRegion( x + 7, y++, w - 12, 1 ); + r += QRegion( x + 9, y++, w - 15, 1 ); + r += QRegion( x + 7, y++, w - 12, 1 ); } else { nrects = 8; @@ -1158,11 +1158,11 @@ void KeramikClient::updateMask() // The rounded titlebar corners r += QRegion( 9, y++, w - 17, 1 ); r += QRegion( 7, y++, w - 13, 1 ); - r += QRegion( 5, y++, w - 9, 1 ); - r += QRegion( 4, y++, w - 7, 1 ); - r += QRegion( 3, y++, w - 5, 1 ); - r += QRegion( 2, y++, w - 4, 1 ); - r += QRegion( 1, y++, w - 2, 2 ); + r += QRegion( 5, y++, w - 9, 1 ); + r += QRegion( 4, y++, w - 7, 1 ); + r += QRegion( 3, y++, w - 5, 1 ); + r += QRegion( 2, y++, w - 4, 1 ); + r += QRegion( 1, y++, w - 2, 2 ); } else { // If the caption bubble is visible and extends above the titlebar @@ -1188,11 +1188,11 @@ void KeramikClient::updateMask() // The rounded titlebar corners r += QRegion( 8, y++, w - 17, 1 ); r += QRegion( 6, y++, w - 13, 1 ); - r += QRegion( 4, y++, w - 9, 1 ); - r += QRegion( 3, y++, w - 7, 1 ); - r += QRegion( 2, y++, w - 5, 1 ); - r += QRegion( 2, y++, w - 4, 1 ); - r += QRegion( 1, y++, w - 2, 2 ); + r += QRegion( 4, y++, w - 9, 1 ); + r += QRegion( 3, y++, w - 7, 1 ); + r += QRegion( 2, y++, w - 5, 1 ); + r += QRegion( 2, y++, w - 4, 1 ); + r += QRegion( 1, y++, w - 2, 2 ); } y++; diff --git a/clients/quartz/config/config.cpp b/clients/quartz/config/config.cpp index 154db23273..736efeb0c4 100644 --- a/clients/quartz/config/config.cpp +++ b/clients/quartz/config/config.cpp @@ -51,7 +51,7 @@ QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent ) // Ensure we track user changes properly connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) ); - connect( cbExtraSmall, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) ); + connect( cbExtraSmall, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) ); // Make the widgets visible in kwindecoration gb->show(); diff --git a/clients/quartz/quartz.cpp b/clients/quartz/quartz.cpp index ed7e8a06b9..5879d7e01b 100644 --- a/clients/quartz/quartz.cpp +++ b/clients/quartz/quartz.cpp @@ -264,25 +264,25 @@ void QuartzHandler::drawBlocks( KPixmap *pi, KPixmap &p, const QColor &c1, const int x = pi->width() - 5*factor - square; int y = (pi->height() - 4*factor)/2; - px.fillRect( x, y, square, square, c1.light(120) ); - px.fillRect( x, y+factor, square, square, c1 ); + px.fillRect( x, y, square, square, c1.light(120) ); + px.fillRect( x, y+factor, square, square, c1 ); px.fillRect( x, y+2*factor, square, square, c1.light(110) ); px.fillRect( x, y+3*factor, square, square, c1 ); - px.fillRect( x+factor, y, square, square, c1.light(110) ); - px.fillRect( x+factor, y+factor, square, square, c2.light(110) ); + px.fillRect( x+factor, y, square, square, c1.light(110) ); + px.fillRect( x+factor, y+factor, square, square, c2.light(110) ); px.fillRect( x+factor, y+2*factor, square, square, c1.light(120) ); px.fillRect( x+factor, y+3*factor, square, square, c2.light(130) ); - px.fillRect( x+2*factor, y+factor, square, square, c1.light(110) ); + px.fillRect( x+2*factor, y+factor, square, square, c1.light(110) ); px.fillRect( x+2*factor, y+2*factor, square, square, c2.light(120) ); px.fillRect( x+2*factor, y+3*factor, square, square, c2.light(150) ); - px.fillRect( x+3*factor, y, square, square, c1.dark(110) ); + px.fillRect( x+3*factor, y, square, square, c1.dark(110) ); px.fillRect( x+3*factor, y+2*factor, square, square, c2.light(120) ); px.fillRect( x+3*factor, y+3*factor, square, square, c1.dark(120) ); - px.fillRect( x+4*factor, y+factor, square, square, c1.light(110) ); + px.fillRect( x+4*factor, y+factor, square, square, c1.light(110) ); px.fillRect( x+4*factor, y+3*factor, square, square, c1.dark(110) ); px.fillRect( x+5*factor, y+2*factor, square, square, c2.light(120)); diff --git a/events.cpp b/events.cpp index 7c4124f2f8..5b5f434946 100644 --- a/events.cpp +++ b/events.cpp @@ -23,9 +23,10 @@ License. See the file "COPYING" for the exact licensing terms. #include "rules.h" #include -#include #include +#include + #include #include #include @@ -221,9 +222,9 @@ bool Workspace::workspaceEvent( XEvent * e ) case KeyPress: { was_user_interaction = true; - KKeyNative keyX( (XEvent*)e ); - uint keyQt = keyX.keyCodeQt(); - kDebug(125) << "Workspace::keyPress( " << keyX.key().toString() << " )" << endl; + int keyQt; + KKeyServer::xEventToQt(e, keyQt); + kDebug(125) << "Workspace::keyPress( " << keyQt << " )" << endl; if (movingClient) { movingClient->keyPressEvent(keyQt); @@ -231,7 +232,7 @@ bool Workspace::workspaceEvent( XEvent * e ) } if( tab_grab || control_grab ) { - tabBoxKeyPress( keyX ); + tabBoxKeyPress( keyQt ); return true; } break; @@ -962,9 +963,9 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) } } -#define XCapL KKeyNative::modXLock() -#define XNumL KKeyNative::modXNumLock() -#define XScrL KKeyNative::modXScrollLock() +#define XCapL KKeyServer::modXLock() +#define XNumL KKeyServer::modXNumLock() +#define XScrL KKeyServer::modXScrollLock() void Client::grabButton( int modifier ) { unsigned int mods[ 8 ] = @@ -978,7 +979,7 @@ void Client::grabButton( int modifier ) ++i ) XGrabButton( QX11Info::display(), AnyButton, modifier | mods[ i ], - wrapperId(), false, ButtonPressMask, + wrapperId(), false, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None ); } @@ -1064,9 +1065,9 @@ int qtToX11State( Qt::ButtonState state ) if( state & Qt::ControlModifier ) ret |= ControlMask; if( state & Qt::AltModifier ) - ret |= KKeyNative::modXAlt(); + ret |= KKeyServer::modXAlt(); if( state & Qt::MetaModifier ) - ret |= KKeyNative::modXWin(); + ret |= KKeyServer::modXMeta(); return ret; } @@ -1132,9 +1133,9 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in updateUserTime(); workspace()->setWasUserInteraction(); uint keyModX = (options->keyCmdAllModKey() == Qt::Key_Meta) ? - KKeyNative::modXWin() : - KKeyNative::modXAlt(); - bool bModKeyHeld = keyModX != 0 && ( state & KKeyNative::accelModMaskX()) == keyModX; + KKeyServer::modXMeta() : + KKeyServer::modXAlt(); + bool bModKeyHeld = keyModX != 0 && ( state & KKeyServer::accelModMaskX()) == keyModX; if( isSplash() && button == Button1 && !bModKeyHeld ) diff --git a/group.cpp b/group.cpp index 287a1b530d..4d1548f70e 100644 --- a/group.cpp +++ b/group.cpp @@ -596,7 +596,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined ) Window root_return, parent_return; Window* wins = NULL; unsigned int nwins; - int r = XQueryTree(QX11Info::display(), new_transient_for, &root_return, &parent_return, &wins, &nwins); + int r = XQueryTree(QX11Info::display(), new_transient_for, &root_return, &parent_return, &wins, &nwins); if ( wins ) XFree((void *) wins); if ( r == 0) diff --git a/kcmkwin/kwindecoration/buttons.cpp b/kcmkwin/kwindecoration/buttons.cpp index f456b3de09..62ed9d4cb7 100644 --- a/kcmkwin/kwindecoration/buttons.cpp +++ b/kcmkwin/kwindecoration/buttons.cpp @@ -1,7 +1,7 @@ /* This is the new kwindecoration kcontrol module - Copyright (c) 2004, Sandro Giessl + Copyright (c) 2004, Sandro Giessl Copyright (c) 2001 Karol Szwed http://gallium.n3.net/ @@ -671,7 +671,7 @@ void ButtonSourceItem::setButton(const Button& btn) if (btn.supported) { setText(0, btn.name); } else { - setText(0, i18n("%1 (unavailable)").arg(btn.name) ); + setText(0, i18n("%1 (unavailable)", btn.name) ); } } @@ -805,7 +805,7 @@ Button ButtonPositionWidget::getButton(QChar type, bool& success) { } else if (type == 'X') { QBitmap bmp(close_width, close_height, close_bits, true); bmp.setMask(bmp); - return Button(i18n("Close"), bmp, 'X', false, m_supportedButtons.contains('X') ); + return Button(i18n("Close"), bmp, 'X', false, m_supportedButtons.contains('X') ); } else if (type == 'A') { QBitmap bmp(maximize_width, maximize_height, maximize_bits, true); bmp.setMask(bmp); diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index a7830eedf9..b101775123 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -588,11 +588,11 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, KInstance QHBoxLayout* focusStealingLayout = new QHBoxLayout( lay,KDialog::spacingHint()); QLabel* focusStealingLabel = new QLabel( i18n( "Focus stealing prevention level:" ), this ); focusStealing = new QComboBox( this ); - focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "None" )); - focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Low" )); - focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Normal" )); - focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "High" )); - focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Extreme" )); + focusStealing->insertItem( i18nc( "Focus Stealing Prevention Level", "None" )); + focusStealing->insertItem( i18nc( "Focus Stealing Prevention Level", "Low" )); + focusStealing->insertItem( i18nc( "Focus Stealing Prevention Level", "Normal" )); + focusStealing->insertItem( i18nc( "Focus Stealing Prevention Level", "High" )); + focusStealing->insertItem( i18nc( "Focus Stealing Prevention Level", "Extreme" )); focusStealingLabel->setBuddy( focusStealing ); focusStealingLayout->addWidget( focusStealingLabel ); focusStealingLayout->addWidget( focusStealing, Qt::AlignLeft ); @@ -1015,11 +1015,11 @@ void KMovingConfig::setMoveResizeMaximized(bool a) { } void KMovingConfig::slotBrdrSnapChanged(int value) { - BrdrSnap->setSuffix(i18n(" pixel", " pixels", value)); + BrdrSnap->setSuffix(i18np(" pixel", " pixels", value)); } void KMovingConfig::slotWndwSnapChanged(int value) { - WndwSnap->setSuffix(i18n(" pixel", " pixels", value)); + WndwSnap->setSuffix(i18np(" pixel", " pixels", value)); } void KMovingConfig::load( void ) diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp index e458e48460..3cb8a3a4e4 100644 --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -152,7 +152,7 @@ static Rules* findRule( const QList< Rules* >& rules, Window wid, bool whole_app Rules* ret = new Rules; if( whole_app ) { - ret->description = i18n( "Application settings for %1" ).arg( QString::fromLatin1( wmclass_class )); + ret->description = i18n( "Application settings for %1", QString::fromLatin1( wmclass_class )); // TODO maybe exclude some types? If yes, then also exclude them above // when searching. ret->types = NET::AllTypesMask; @@ -176,7 +176,7 @@ static Rules* findRule( const QList< Rules* >& rules, Window wid, bool whole_app } return ret; } - ret->description = i18n( "Window settings for %1" ).arg( QString::fromLatin1( wmclass_class )); + ret->description = i18n( "Window settings for %1", QString::fromLatin1( wmclass_class )); if( type == NET::Unknown ) ret->types = NET::NormalMask; else diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 741814d3ff..7f8ac602c7 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -649,7 +649,7 @@ bool RulesWidget::finalCheck() if( description->text().isEmpty()) { if( !wmclass->text().isEmpty()) - description->setText( i18n( "Settings for %1" ).arg( wmclass->text())); + description->setText( i18n( "Settings for %1", wmclass->text())); else description->setText( i18n( "Unnamed entry" )); } @@ -763,7 +763,7 @@ QString EditShortcutDialog::shortcut() const } ShortcutDialog::ShortcutDialog( const KShortcut& cut, QWidget* parent ) - : KShortcutDialog( cut, false /*TODO???*/, parent ) + : KShortcutDialog( cut, parent ) { } @@ -773,24 +773,24 @@ void ShortcutDialog::accept() ; ++i ) { - KKeySequence seq = shortcut().seq( i ); - if( seq.isNull()) + QKeySequence seq = shortcut().seq( i ); + if( seq.isEmpty()) break; - if( seq.key( 0 ) == Qt::Key_Escape ) + if( seq[0] == Qt::Key_Escape ) { reject(); return; } - if( seq.key( 0 ) == Qt::Key_Space ) + if( seq[0] == Qt::Key_Space ) { // clear setShortcut( KShortcut()); KShortcutDialog::accept(); return; } - if( seq.key( 0 ).modFlags() == 0 ) + if( (seq[0] & Qt::KeyboardModifierMask) == 0 ) { // no shortcuts without modifiers KShortcut cut = shortcut(); - cut.setSeq( i, KKeySequence()); + cut.setSeq( i, QKeySequence()); setShortcut( cut ); return; } diff --git a/killer/killer.cpp b/killer/killer.cpp index f33249c422..e8b2172849 100644 --- a/killer/killer.cpp +++ b/killer/killer.cpp @@ -71,8 +71,8 @@ int main( int argc, char* argv[] ) QString question = i18n( "Window with title \"%2\" is not responding. " "This window belongs to application %1 (PID=%3, hostname=%4).

" - "Do you wish to terminate this application? (All unsaved data in this application will be lost.)" ) - .arg( appname ).arg( caption ).arg( pid ).arg( QString( hostname ) ); + "Do you wish to terminate this application? (All unsaved data in this application will be lost.)" , + appname, caption, pid, QString( hostname ) ); app.updateUserTimestamp( timestamp ); if( KMessageBox::warningYesNoWId( id, question, QString(), i18n("Terminate"), i18n("Keep Running") ) == KMessageBox::Yes ) { diff --git a/kwinbindings.cpp b/kwinbindings.cpp index e30a42ead6..4f95dca783 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -1,47 +1,48 @@ #ifndef NOSLOTS # define DEF2( name, descr, key, fnSlot ) \ - keys->insert( name, i18n(descr), QString(), key, this, SLOT(fnSlot) ) + a = new KAction( i18n(descr), actionCollection, name ); \ + a->setShortcut(KShortcut(key)); \ + connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)) # define DEF( name, key, fnSlot ) \ - keys->insert( name, i18n(name), QString(), key, this, SLOT(fnSlot) ) + a = new KAction( i18n(name), actionCollection, name ); \ + a->setShortcut(KShortcut(key)); \ + connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)) #else # define DEF2( name, descr, key, fnSlot ) \ - keys->insert( name, i18n(descr), QString(), key ) + a = new KAction( i18n(descr), actionCollection, name ); \ + a->setShortcut(KShortcut(key)); # define DEF( name, key, fnSlot ) \ - keys->insert( name, i18n(name), QString(), key ) + a = new KAction( i18n(name), actionCollection, name ); \ + a->setShortcut(KShortcut(key)); #endif -#define WIN Qt::META -#define ALT Qt::ALT -#define SHIFT Qt::SHIFT -#define CTRL Qt::CTRL - // some shortcuts have Tarzan-speech like names, they need extra normal human descriptions with DEF2() // the others can use DEF() - keys->insert( "Program:kwin", i18n("System") ); + new KAction( i18n("System"), actionCollection, "Program:kwin" ); - keys->insert( "Group:Navigation", i18n("Navigation") ); - DEF( I18N_NOOP("Walk Through Windows"), ALT+Qt::Key_Tab, slotWalkThroughWindows() ); - DEF( I18N_NOOP("Walk Through Windows (Reverse)"), ALT+SHIFT+Qt::Key_Tab, slotWalkBackThroughWindows() ); - DEF( I18N_NOOP("Walk Through Desktops"), WIN+Qt::Key_Tab, slotWalkThroughDesktops() ); - DEF( I18N_NOOP("Walk Through Desktops (Reverse)"), WIN+SHIFT+Qt::Key_Tab, slotWalkBackThroughDesktops() ); - DEF( I18N_NOOP("Walk Through Desktop List"), 0, slotWalkThroughDesktopList() ); + new KAction( i18n("Navigation"), actionCollection, "Group:Navigation" ); + DEF( I18N_NOOP("Walk Through Windows"), Qt::ALT+Qt::Key_Tab, slotWalkThroughWindows() ); + DEF( I18N_NOOP("Walk Through Windows (Reverse)"), Qt::ALT+Qt::SHIFT+Qt::Key_Tab, slotWalkBackThroughWindows() ); + DEF( I18N_NOOP("Walk Through Desktops"), Qt::META+Qt::Key_Tab, slotWalkThroughDesktops() ); + DEF( I18N_NOOP("Walk Through Desktops (Reverse)"), Qt::META+Qt::SHIFT+Qt::Key_Tab, slotWalkBackThroughDesktops() ); + DEF( I18N_NOOP("Walk Through Desktop List"), 0, slotWalkThroughDesktopList() ); DEF( I18N_NOOP("Walk Through Desktop List (Reverse)"), 0, slotWalkBackThroughDesktopList() ); - keys->insert( "Group:Windows", i18n("Windows") ); - DEF( I18N_NOOP("Window Operations Menu"), ALT+Qt::Key_Menu, slotWindowOperations() ); + new KAction( i18n("Windows"), actionCollection, "Group:Windows" ); + DEF( I18N_NOOP("Window Operations Menu"), Qt::ALT+Qt::Key_Menu, slotWindowOperations() ); DEF2( "Window Close", I18N_NOOP("Close Window"), "Alt+Escape;Alt+F4", slotWindowClose() ); DEF2( "Window Maximize", I18N_NOOP("Maximize Window"), - WIN+Qt::Key_Plus, slotWindowMaximize() ); + Qt::META+Qt::Key_Plus, slotWindowMaximize() ); DEF2( "Window Maximize Vertical", I18N_NOOP("Maximize Window Vertically"), - WIN+Qt::Key_Bar, slotWindowMaximizeVertical() ); + Qt::META+Qt::Key_Bar, slotWindowMaximizeVertical() ); DEF2( "Window Maximize Horizontal", I18N_NOOP("Maximize Window Horizontally"), - WIN+Qt::Key_Equal, slotWindowMaximizeHorizontal() ); + Qt::META+Qt::Key_Equal, slotWindowMaximizeHorizontal() ); DEF2( "Window Minimize", I18N_NOOP("Minimize Window"), - WIN+Qt::Key_Minus, slotWindowMinimize() ); + Qt::META+Qt::Key_Minus, slotWindowMinimize() ); DEF2( "Window Shade", I18N_NOOP("Shade Window"), - WIN+Qt::Key_Underscore, slotWindowShade() ); + Qt::META+Qt::Key_Underscore, slotWindowShade() ); DEF2( "Window Move", I18N_NOOP("Move Window"), 0, slotWindowMove() ); DEF2( "Window Resize", I18N_NOOP("Resize Window"), @@ -50,7 +51,7 @@ 0, slotWindowRaise() ); DEF2( "Window Lower", I18N_NOOP("Lower Window"), 0, slotWindowLower() ); - DEF( I18N_NOOP("Toggle Window Raise/Lower"), 0, slotWindowRaiseOrLower() ); + DEF( I18N_NOOP("Toggle Window Raise/Lower"), 0, slotWindowRaiseOrLower() ); DEF2( "Window Fullscreen", I18N_NOOP("Make Window Fullscreen"), 0, slotWindowFullScreen() ); DEF2( "Window No Border", I18N_NOOP("Hide Window Border"), @@ -60,7 +61,7 @@ DEF2( "Window Below Other Windows", I18N_NOOP("Keep Window Below Others"), 0, slotWindowBelow() ); DEF( I18N_NOOP("Activate Window Demanding Attention"), - CTRL+ALT+Qt::Key_A, slotActivateAttentionWindow()); + Qt::CTRL+Qt::ALT+Qt::Key_A, slotActivateAttentionWindow()); DEF( I18N_NOOP("Setup Window Shortcut"), 0, slotSetupWindowShortcut()); DEF2( "Window Pack Right", I18N_NOOP("Pack Window to the Right"), @@ -80,107 +81,96 @@ DEF2( "Window Shrink Vertical", I18N_NOOP("Pack Shrink Window Vertically"), 0, slotWindowShrinkVertical() ); - keys->insert( "Group:Window Desktop", i18n("Window & Desktop") ); + new KAction( i18n("Window & Desktop"), actionCollection, "Group:Window Desktop" ); DEF2( "Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"), 0, slotWindowOnAllDesktops() ); - DEF( I18N_NOOP("Window to Desktop 1"), WIN+ALT+Qt::Key_F1, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 2"), WIN+ALT+Qt::Key_F2, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 3"), WIN+ALT+Qt::Key_F3, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 4"), WIN+ALT+Qt::Key_F4, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 5"), WIN+ALT+Qt::Key_F5, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 6"), WIN+ALT+Qt::Key_F6, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 7"), WIN+ALT+Qt::Key_F7, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 8"), WIN+ALT+Qt::Key_F8, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 9"), WIN+ALT+Qt::Key_F9, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 10"), WIN+ALT+Qt::Key_F10, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 11"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 12"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 13"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 14"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 15"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 16"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 17"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 18"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 19"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Desktop 20"), 0, slotWindowToDesktop(int) ); - DEF( I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop() ); - DEF( I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop() ); - DEF( I18N_NOOP("Window One Desktop to the Right"), 0, slotWindowToDesktopRight() ); - DEF( I18N_NOOP("Window One Desktop to the Left"), 0, slotWindowToDesktopLeft() ); - DEF( I18N_NOOP("Window One Desktop Up"), 0, slotWindowToDesktopUp() ); - DEF( I18N_NOOP("Window One Desktop Down"), 0, slotWindowToDesktopDown() ); + DEF( I18N_NOOP("Window to Desktop 1"), Qt::META+Qt::ALT+Qt::Key_F1, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 2"), Qt::META+Qt::ALT+Qt::Key_F2, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 3"), Qt::META+Qt::ALT+Qt::Key_F3, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 4"), Qt::META+Qt::ALT+Qt::Key_F4, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 5"), Qt::META+Qt::ALT+Qt::Key_F5, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 6"), Qt::META+Qt::ALT+Qt::Key_F6, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 7"), Qt::META+Qt::ALT+Qt::Key_F7, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 8"), Qt::META+Qt::ALT+Qt::Key_F8, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 9"), Qt::META+Qt::ALT+Qt::Key_F9, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 10"), Qt::META+Qt::ALT+Qt::Key_F10, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 11"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 12"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 13"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 14"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 15"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 16"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 17"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 18"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 19"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Desktop 20"), 0, slotWindowToDesktop(int) ); + DEF( I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop() ); + DEF( I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop() ); + DEF( I18N_NOOP("Window One Desktop to the Right"), 0, slotWindowToDesktopRight() ); + DEF( I18N_NOOP("Window One Desktop to the Left"), 0, slotWindowToDesktopLeft() ); + DEF( I18N_NOOP("Window One Desktop Up"), 0, slotWindowToDesktopUp() ); + DEF( I18N_NOOP("Window One Desktop Down"), 0, slotWindowToDesktopDown() ); - keys->insert( "Group:Desktop Switching", i18n("Desktop Switching") ); - DEF( I18N_NOOP("Switch to Desktop 1"), WIN+Qt::Key_F1, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 2"), WIN+Qt::Key_F2, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 3"), WIN+Qt::Key_F3, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 4"), WIN+Qt::Key_F4, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 5"), WIN+Qt::Key_F5, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 6"), WIN+Qt::Key_F6, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 7"), WIN+Qt::Key_F7, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 8"), WIN+Qt::Key_F8, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 9"), WIN+Qt::Key_F9, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 10"), WIN+Qt::Key_F10, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 11"), CTRL+Qt::Key_F11, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 12"), CTRL+Qt::Key_F12, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 13"), CTRL+SHIFT+Qt::Key_F1, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 14"), CTRL+SHIFT+Qt::Key_F2, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 15"), CTRL+SHIFT+Qt::Key_F3, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 16"), CTRL+SHIFT+Qt::Key_F4, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 17"), CTRL+SHIFT+Qt::Key_F5, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 18"), CTRL+SHIFT+Qt::Key_F6, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 19"), CTRL+SHIFT+Qt::Key_F7, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Desktop 20"), CTRL+SHIFT+Qt::Key_F8, slotSwitchToDesktop(int) ); - DEF( I18N_NOOP("Switch to Next Desktop"), 0, slotSwitchDesktopNext() ); - DEF( I18N_NOOP("Switch to Previous Desktop"), 0, slotSwitchDesktopPrevious() ); - DEF( I18N_NOOP("Switch One Desktop to the Right"), 0, slotSwitchDesktopRight() ); - DEF( I18N_NOOP("Switch One Desktop to the Left"), 0, slotSwitchDesktopLeft() ); - DEF( I18N_NOOP("Switch One Desktop Up"), 0, slotSwitchDesktopUp() ); - DEF( I18N_NOOP("Switch One Desktop Down"), 0, slotSwitchDesktopDown() ); + new KAction( i18n("Desktop Switching"), actionCollection, "Group:Desktop Switching" ); + DEF( I18N_NOOP("Switch to Desktop 1"), Qt::META+Qt::Key_F1, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 2"), Qt::META+Qt::Key_F2, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 3"), Qt::META+Qt::Key_F3, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 4"), Qt::META+Qt::Key_F4, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 5"), Qt::META+Qt::Key_F5, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 6"), Qt::META+Qt::Key_F6, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 7"), Qt::META+Qt::Key_F7, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 8"), Qt::META+Qt::Key_F8, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 9"), Qt::META+Qt::Key_F9, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 10"), Qt::META+Qt::Key_F10, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 11"), Qt::CTRL+Qt::Key_F11, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 12"), Qt::CTRL+Qt::Key_F12, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 13"), Qt::CTRL+Qt::SHIFT+Qt::Key_F1, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 14"), Qt::CTRL+Qt::SHIFT+Qt::Key_F2, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 15"), Qt::CTRL+Qt::SHIFT+Qt::Key_F3, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 16"), Qt::CTRL+Qt::SHIFT+Qt::Key_F4, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 17"), Qt::CTRL+Qt::SHIFT+Qt::Key_F5, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 18"), Qt::CTRL+Qt::SHIFT+Qt::Key_F6, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 19"), Qt::CTRL+Qt::SHIFT+Qt::Key_F7, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Desktop 20"), Qt::CTRL+Qt::SHIFT+Qt::Key_F8, slotSwitchToDesktop(int) ); + DEF( I18N_NOOP("Switch to Next Desktop"), 0, slotSwitchDesktopNext() ); + DEF( I18N_NOOP("Switch to Previous Desktop"), 0, slotSwitchDesktopPrevious() ); + DEF( I18N_NOOP("Switch One Desktop to the Right"), 0, slotSwitchDesktopRight() ); + DEF( I18N_NOOP("Switch One Desktop to the Left"), 0, slotSwitchDesktopLeft() ); + DEF( I18N_NOOP("Switch One Desktop Up"), 0, slotSwitchDesktopUp() ); + DEF( I18N_NOOP("Switch One Desktop Down"), 0, slotSwitchDesktopDown() ); - keys->insert( "Group:Miscellaneous", i18n("Miscellaneous") ); - DEF( I18N_NOOP("Mouse Emulation"), ALT+Qt::Key_F12, slotMouseEmulation() ); - DEF( I18N_NOOP("Kill Window"), WIN+CTRL+Qt::Key_Delete, slotKillWindow() ); - DEF( I18N_NOOP("Window Screenshot"), ALT+Qt::Key_Print, slotGrabWindow() ); - DEF( I18N_NOOP("Desktop Screenshot"), WIN+Qt::Key_Print, slotGrabDesktop() ); -#ifdef IN_KWIN - { - KGlobalAccel* keys = disable_shortcuts_keys; -#endif - DEF( I18N_NOOP("Block Global Shortcuts"), 0, slotDisableGlobalShortcuts()); -#ifdef IN_KWIN - } -#endif + new KAction( i18n("Miscellaneous"), actionCollection, "Group:Miscellaneous" ); + DEF( I18N_NOOP("Mouse Emulation"), Qt::ALT+Qt::Key_F12, slotMouseEmulation() ); + DEF( I18N_NOOP("Kill Window"), Qt::META+Qt::CTRL+Qt::Key_Delete, slotKillWindow() ); + DEF( I18N_NOOP("Window Screenshot"), Qt::ALT+Qt::Key_Print, slotGrabWindow() ); + DEF( I18N_NOOP("Desktop Screenshot"), Qt::META+Qt::Key_Print, slotGrabDesktop() ); + DEF( I18N_NOOP("Block Global Shortcuts"), 0, slotDisableGlobalShortcuts()); /*This belongs in taskbar rather than here, so it'll have to wait until after 2.2 is done. -- ellis -DEF( I18N_NOOP("Switch to Window 1", WIN+Qt::Key_1")); -DEF( I18N_NOOP("Switch to Window 2", WIN+Qt::Key_2")); -DEF( I18N_NOOP("Switch to Window 3", WIN+Qt::Key_3")); -DEF( I18N_NOOP("Switch to Window 4", WIN+Qt::Key_4")); -DEF( I18N_NOOP("Switch to Window 5", WIN+Qt::Key_5")); -DEF( I18N_NOOP("Switch to Window 6", WIN+Qt::Key_6")); -DEF( I18N_NOOP("Switch to Window 7", WIN+Qt::Key_7")); -DEF( I18N_NOOP("Switch to Window 8", WIN+Qt::Key_8")); -DEF( I18N_NOOP("Switch to Window 9", WIN+Qt::Key_9")); +DEF( I18N_NOOP("Switch to Window 1", Qt::META+Qt::Key_1")); +DEF( I18N_NOOP("Switch to Window 2", Qt::META+Qt::Key_2")); +DEF( I18N_NOOP("Switch to Window 3", Qt::META+Qt::Key_3")); +DEF( I18N_NOOP("Switch to Window 4", Qt::META+Qt::Key_4")); +DEF( I18N_NOOP("Switch to Window 5", Qt::META+Qt::Key_5")); +DEF( I18N_NOOP("Switch to Window 6", Qt::META+Qt::Key_6")); +DEF( I18N_NOOP("Switch to Window 7", Qt::META+Qt::Key_7")); +DEF( I18N_NOOP("Switch to Window 8", Qt::META+Qt::Key_8")); +DEF( I18N_NOOP("Switch to Window 9", Qt::META+Qt::Key_9")); #ifdef WITH_LABELS DEF( I18N_NOOP("Window & Taskbar"Group:Window Desktop", 0); #endif -DEF( I18N_NOOP("Window to Taskbar Position 1", WIN+Qt::Key_Alt+1")); -DEF( I18N_NOOP("Window to Taskbar Position 2", WIN+Qt::Key_Alt+2")); -DEF( I18N_NOOP("Window to Taskbar Position 3", WIN+Qt::Key_Alt+3")); -DEF( I18N_NOOP("Window to Taskbar Position 4", WIN+Qt::Key_Alt+4")); -DEF( I18N_NOOP("Window to Taskbar Position 5", WIN+Qt::Key_Alt+5")); -DEF( I18N_NOOP("Window to Taskbar Position 6", WIN+Qt::Key_Alt+6")); -DEF( I18N_NOOP("Window to Taskbar Position 7", WIN+Qt::Key_Alt+7")); -DEF( I18N_NOOP("Window to Taskbar Position 8", WIN+Qt::Key_Alt+8")); -DEF( I18N_NOOP("Window to Taskbar Position 9", WIN+Qt::Key_Alt+9")); +DEF( I18N_NOOP("Window to Taskbar Position 1", Qt::META+Qt::Key_Alt+1")); +DEF( I18N_NOOP("Window to Taskbar Position 2", Qt::META+Qt::Key_Alt+2")); +DEF( I18N_NOOP("Window to Taskbar Position 3", Qt::META+Qt::Key_Alt+3")); +DEF( I18N_NOOP("Window to Taskbar Position 4", Qt::META+Qt::Key_Alt+4")); +DEF( I18N_NOOP("Window to Taskbar Position 5", Qt::META+Qt::Key_Alt+5")); +DEF( I18N_NOOP("Window to Taskbar Position 6", Qt::META+Qt::Key_Alt+6")); +DEF( I18N_NOOP("Window to Taskbar Position 7", Qt::META+Qt::Key_Alt+7")); +DEF( I18N_NOOP("Window to Taskbar Position 8", Qt::META+Qt::Key_Alt+8")); +DEF( I18N_NOOP("Window to Taskbar Position 9", Qt::META+Qt::Key_Alt+9")); */ #undef DEF #undef DEF2 -#undef WIN -#undef ALT -#undef SHIFT -#undef CTRL diff --git a/lib/kcommondecoration.cpp b/lib/kcommondecoration.cpp index 7d7acc95cb..8eb4db496d 100644 --- a/lib/kcommondecoration.cpp +++ b/lib/kcommondecoration.cpp @@ -263,7 +263,7 @@ void KCommonDecoration::resetLayout() // shown instead of the window contents in decoration previews if(isPreview() ) { - m_previewWidget = new QLabel(i18n("

%1 preview
").arg(visibleName() ), widget()); + m_previewWidget = new QLabel(i18n("
%1 preview
", visibleName() ), widget()); m_previewWidget->show(); } diff --git a/lib/kdecoration_plugins_p.cpp b/lib/kdecoration_plugins_p.cpp index 8dee092bf0..9aec49f32b 100644 --- a/lib/kdecoration_plugins_p.cpp +++ b/lib/kdecoration_plugins_p.cpp @@ -157,7 +157,7 @@ bool KDecorationPlugins::loadPlugin( QString nameStr ) } if(!create_ptr) { - error( i18n( "The library %1 is not a KWin plugin." ).arg( path )); + error( i18n( "The library %1 is not a KWin plugin.", path )); library->unload(); return false; } diff --git a/placement.cpp b/placement.cpp index b36148a8d9..ccc32956d9 100644 --- a/placement.cpp +++ b/placement.cpp @@ -146,7 +146,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/ ) int desktop = c->desktop() == 0 || c->isOnAllDesktops() ? m_WorkspacePtr->currentDesktop() : c->desktop(); int cxl, cxr, cyt, cyb; //temp coords - int xl, xr, yt, yb; //temp coords + int xl, xr, yt, yb; //temp coords int basket; //temp holder // get the maximum allowed windows space @@ -402,7 +402,7 @@ void Placement::placeCascaded (Client* c, QRect& area, Policy nextPlacement) c->move(QPoint(xp, yp)); // new position - cci[dn].pos = QPoint(xp + delta_x, yp + delta_y); + cci[dn].pos = QPoint(xp + delta_x, yp + delta_y); } /*! diff --git a/popupinfo.cpp b/popupinfo.cpp index 7f6596a2a4..f444a609a2 100644 --- a/popupinfo.cpp +++ b/popupinfo.cpp @@ -68,7 +68,7 @@ void PopupInfo::reset() setGeometry( (r.width()-w)/2 + r.x(), r.height()/2-fontMetrics().height()-10 + r.y(), - w, fontMetrics().height() + 20 ); + w, fontMetrics().height() + 20 ); } diff --git a/sm.cpp b/sm.cpp index 5ecad02046..8d3bb65648 100644 --- a/sm.cpp +++ b/sm.cpp @@ -94,7 +94,7 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase ) config->writeEntry( QString("wmClientMachine")+n, c->wmClientMachine( true ).constData() ); config->writeEntry( QString("resourceName")+n, c->resourceName().constData() ); config->writeEntry( QString("resourceClass")+n, c->resourceClass().constData() ); - config->writeEntry( QString("geometry")+n, QRect( c->calculateGravitation(true), c->clientSize() ) ); // FRAME + config->writeEntry( QString("geometry")+n, QRect( c->calculateGravitation(true), c->clientSize() ) ); // FRAME config->writeEntry( QString("restore")+n, c->geometryRestore() ); config->writeEntry( QString("fsrestore")+n, c->geometryFSRestore() ); config->writeEntry( QString("maximize")+n, (int) c->maximizeMode() ); diff --git a/tabbox.cpp b/tabbox.cpp index ef24756d0b..3986d8d90c 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -27,13 +27,13 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include -#include #include #include #include #include #include +#include +#include // specify externals before namespace @@ -668,32 +668,32 @@ static const int MAX_KEYSYMS = 4; static uint alt_keysyms[ MAX_KEYSYMS ]; static uint win_keysyms[ MAX_KEYSYMS ]; -static bool areModKeysDepressed( const KKeySequence& seq ) +static bool areModKeysDepressed( const QKeySequence& seq ) { uint rgKeySyms[10]; int nKeySyms = 0; - if( seq.isNull()) + if( seq.isEmpty()) return false; - int mod = seq.key(seq.count()-1).modFlags(); + int mod = seq[seq.count()-1] & Qt::KeyboardModifierMask; - if ( mod & KKey::SHIFT ) + if ( mod & Qt::SHIFT ) { rgKeySyms[nKeySyms++] = XK_Shift_L; rgKeySyms[nKeySyms++] = XK_Shift_R; } - if ( mod & KKey::CTRL ) + if ( mod & Qt::CTRL ) { rgKeySyms[nKeySyms++] = XK_Control_L; rgKeySyms[nKeySyms++] = XK_Control_R; } - if( mod & KKey::ALT ) + if( mod & Qt::ALT ) { for( int i = 0; i < MAX_KEYSYMS && alt_keysyms[ i ] != NoSymbol; ++i ) rgKeySyms[nKeySyms++] = alt_keysyms[ i ]; } - if( mod & KKey::WIN ) + if( mod & Qt::META ) { for( int i = 0; i < MAX_KEYSYMS && win_keysyms[ i ] != NoSymbol; @@ -706,7 +706,7 @@ static bool areModKeysDepressed( const KKeySequence& seq ) static bool areModKeysDepressed( const KShortcut& cut ) { - for( unsigned int i = 0; + for( int i = 0; i < cut.count(); ++i ) { @@ -724,7 +724,7 @@ void TabBox::updateKeyMapping() int altpos = 0; int winpos = 0; int winmodpos = -1; - int winmod = KKeyNative::modXWin(); + int winmod = KKeyServer::modXMeta(); while( winmod > 0 ) // get position of the set bit in winmod { winmod >>= 1; @@ -1004,15 +1004,15 @@ void Workspace::oneStepThroughDesktopList( bool forward ) /*! Handles holding alt-tab / control-tab */ -void Workspace::tabBoxKeyPress( const KKeyNative& keyX ) +void Workspace::tabBoxKeyPress( int keyQt ) { bool forward = false; bool backward = false; if (tab_grab) { - forward = cutWalkThroughWindows.contains( keyX ); - backward = cutWalkThroughWindowsReverse.contains( keyX ); + forward = cutWalkThroughWindows.contains( keyQt ); + backward = cutWalkThroughWindowsReverse.contains( keyQt ); if (forward || backward) { kDebug(125) << "== " << cutWalkThroughWindows.toStringInternal() @@ -1022,18 +1022,17 @@ void Workspace::tabBoxKeyPress( const KKeyNative& keyX ) } else if (control_grab) { - forward = cutWalkThroughDesktops.contains( keyX ) || - cutWalkThroughDesktopList.contains( keyX ); - backward = cutWalkThroughDesktopsReverse.contains( keyX ) || - cutWalkThroughDesktopListReverse.contains( keyX ); + forward = cutWalkThroughDesktops.contains( keyQt ) || + cutWalkThroughDesktopList.contains( keyQt ); + backward = cutWalkThroughDesktopsReverse.contains( keyQt ) || + cutWalkThroughDesktopListReverse.contains( keyQt ); if (forward || backward) walkThroughDesktops(forward); } if (control_grab || tab_grab) { - uint keyQt = keyX.keyCodeQt(); - if ( ((keyQt & 0xffff) == Qt::Key_Escape) + if ( ((keyQt & ~Qt::KeyboardModifierMask) == Qt::Key_Escape) && !(forward || backward) ) { // if Escape is part of the shortcut, don't cancel closeTabBox(); @@ -1058,10 +1057,10 @@ void Workspace::closeTabBox() void Workspace::tabBoxKeyRelease( const XKeyEvent& ev ) { unsigned int mk = ev.state & - (KKeyNative::modXShift() | - KKeyNative::modXCtrl() | - KKeyNative::modXAlt() | - KKeyNative::modXWin() ); + (KKeyServer::modXShift() | + KKeyServer::modXCtrl() | + KKeyServer::modXAlt() | + KKeyServer::modXMeta() ); // ev.state is state before the key release, so just checking mk being 0 isn't enough // using XQueryPointer() also doesn't seem to work well, so the check that all // modifiers are released: only one modifier is active and the currently released diff --git a/tools/test_gravity.cpp b/tools/test_gravity.cpp index 618023b5f7..70ae193cf7 100644 --- a/tools/test_gravity.cpp +++ b/tools/test_gravity.cpp @@ -10,9 +10,9 @@ using namespace std; const int gravities[ 10 ] = { NorthWestGravity, - NorthGravity, + NorthGravity, NorthEastGravity, - WestGravity, + WestGravity, CenterGravity, EastGravity, SouthWestGravity, diff --git a/useractions.cpp b/useractions.cpp index 5ef2135181..ac4b3908c0 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -34,6 +34,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +#include #include "killwindow.h" #include "tabbox.h" @@ -58,14 +60,14 @@ QMenu* Workspace::clientPopup() advanced_popup->setFont(KGlobalSettings::menuFont()); connect( advanced_popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) ); advanced_popup->insertItem( SmallIconSet( "up" ), - i18n("Keep &Above Others")+'\t'+keys->shortcut("Window Above Other Windows").seq(0).toString(), Options::KeepAboveOp ); + i18n("Keep &Above Others")+'\t'+keys->action("Window Above Other Windows")->shortcut().seq(0).toString(), Options::KeepAboveOp ); advanced_popup->insertItem( SmallIconSet( "down" ), - i18n("Keep &Below Others")+'\t'+keys->shortcut("Window Below Other Windows").seq(0).toString(), Options::KeepBelowOp ); + i18n("Keep &Below Others")+'\t'+keys->action("Window Below Other Windows")->shortcut().seq(0).toString(), Options::KeepBelowOp ); advanced_popup->insertItem( SmallIconSet( "window_fullscreen" ), - i18n("&Fullscreen")+'\t'+keys->shortcut("Window Fullscreen").seq(0).toString(), Options::FullScreenOp ); - advanced_popup->insertItem( i18n("&No Border")+'\t'+keys->shortcut("Window No Border").seq(0).toString(), Options::NoBorderOp ); + i18n("&Fullscreen")+'\t'+keys->action("Window Fullscreen")->shortcut().seq(0).toString(), Options::FullScreenOp ); + advanced_popup->insertItem( i18n("&No Border")+'\t'+keys->action("Window No Border")->shortcut().seq(0).toString(), Options::NoBorderOp ); advanced_popup->insertItem( SmallIconSet("key_bindings"), - i18n("Window &Shortcut...")+'\t'+keys->shortcut("Setup Window Shortcut").seq(0).toString(), Options::SetupWindowShortcutOp ); + i18n("Window &Shortcut...")+'\t'+keys->action("Setup Window Shortcut")->shortcut().seq(0).toString(), Options::SetupWindowShortcutOp ); advanced_popup->insertItem( SmallIconSet( "wizard" ), i18n("&Special Window Settings..."), Options::WindowRulesOp ); advanced_popup->insertItem( SmallIconSet( "wizard" ), i18n("&Special Application Settings..."), Options::ApplicationRulesOp ); @@ -88,11 +90,11 @@ QMenu* Workspace::clientPopup() popup->insertItem(i18n("&Opacity"), trans_popup ); } - popup->insertItem( SmallIconSet( "move" ), i18n("&Move")+'\t'+keys->shortcut("Window Move").seq(0).toString(), Options::MoveOp ); - popup->insertItem( i18n("Re&size")+'\t'+keys->shortcut("Window Resize").seq(0).toString(), Options::ResizeOp ); - popup->insertItem( i18n("Mi&nimize")+'\t'+keys->shortcut("Window Minimize").seq(0).toString(), Options::MinimizeOp ); - popup->insertItem( i18n("Ma&ximize")+'\t'+keys->shortcut("Window Maximize").seq(0).toString(), Options::MaximizeOp ); - popup->insertItem( i18n("Sh&ade")+'\t'+keys->shortcut("Window Shade").seq(0).toString(), Options::ShadeOp ); + popup->insertItem( SmallIconSet( "move" ), i18n("&Move")+'\t'+keys->action("Window Move")->shortcut().seq(0).toString(), Options::MoveOp ); + popup->insertItem( i18n("Re&size")+'\t'+keys->action("Window Resize")->shortcut().seq(0).toString(), Options::ResizeOp ); + popup->insertItem( i18n("Mi&nimize")+'\t'+keys->action("Window Minimize")->shortcut().seq(0).toString(), Options::MinimizeOp ); + popup->insertItem( i18n("Ma&ximize")+'\t'+keys->action("Window Maximize")->shortcut().seq(0).toString(), Options::MaximizeOp ); + popup->insertItem( i18n("Sh&ade")+'\t'+keys->action("Window Shade")->shortcut().seq(0).toString(), Options::ShadeOp ); popup->insertSeparator(); @@ -103,7 +105,7 @@ QMenu* Workspace::clientPopup() popup->insertSeparator(); } - popup->insertItem( SmallIconSet( "fileclose" ), i18n("&Close")+'\t'+keys->shortcut("Window Close").seq(0).toString(), Options::CloseOp ); + popup->insertItem( SmallIconSet( "fileclose" ), i18n("&Close")+'\t'+keys->action("Window Close")->shortcut().seq(0).toString(), Options::CloseOp ); } return popup; } @@ -245,11 +247,15 @@ void Workspace::closeActivePopup() */ void Workspace::initShortcuts() { - keys = new KGlobalAccel( this ); - // a separate KGlobalAccel is needed for the shortcut for disabling global shortcuts, + keys = new KActionCollection( this ); + KActionCollection* actionCollection = keys; + KAction* a = 0L; + + // a separate KActionCollection is needed for the shortcut for disabling global shortcuts, // otherwise it would also disable itself - disable_shortcuts_keys = new KGlobalAccel( this ); - disable_shortcuts_keys->disableBlocking( true ); + disable_shortcuts_keys = new KActionCollection( this ); + // FIXME KAccel port... needed? + //disable_shortcuts_keys->disableBlocking( true ); #define IN_KWIN #include "kwinbindings.cpp" readShortcuts(); @@ -257,19 +263,15 @@ void Workspace::initShortcuts() void Workspace::readShortcuts() { - keys->readSettings(); - disable_shortcuts_keys->readSettings(); + KGlobalAccel::self()->readSettings(); - cutWalkThroughDesktops = keys->shortcut("Walk Through Desktops"); - cutWalkThroughDesktopsReverse = keys->shortcut("Walk Through Desktops (Reverse)"); - cutWalkThroughDesktopList = keys->shortcut("Walk Through Desktop List"); - cutWalkThroughDesktopListReverse = keys->shortcut("Walk Through Desktop List (Reverse)"); - cutWalkThroughWindows = keys->shortcut("Walk Through Windows"); - cutWalkThroughWindowsReverse = keys->shortcut("Walk Through Windows (Reverse)"); + cutWalkThroughDesktops = keys->action("Walk Through Desktops")->shortcut(); + cutWalkThroughDesktopsReverse = keys->action("Walk Through Desktops (Reverse)")->shortcut(); + cutWalkThroughDesktopList = keys->action("Walk Through Desktop List")->shortcut(); + cutWalkThroughDesktopListReverse = keys->action("Walk Through Desktop List (Reverse)")->shortcut(); + cutWalkThroughWindows = keys->action("Walk Through Windows")->shortcut(); + cutWalkThroughWindowsReverse = keys->action("Walk Through Windows (Reverse)")->shortcut(); - keys->updateConnections(); - disable_shortcuts_keys->updateConnections(); - delete popup; popup = NULL; // so that it's recreated next time desk_popup = NULL; @@ -316,15 +318,17 @@ void Workspace::setupWindowShortcutDone( bool ok ) void Workspace::clientShortcutUpdated( Client* c ) { QString key = QString::number( c->window()); - client_keys->remove( key ); + KAction* action = client_keys->action( key.toLatin1().constData() ); if( !c->shortcut().isNull()) { - client_keys->insert( key, key ); - client_keys->setShortcut( key, c->shortcut()); - client_keys->setSlot( key, c, SLOT( shortcutActivated())); - client_keys->setActionEnabled( key, true ); + action->setShortcut(c->shortcut()); + connect(action, SIGNAL(triggered(bool)), c, SLOT(shortcutActivated())); + action->setEnabled( true ); + } + else + { + delete action; } - client_keys->updateConnections(); } void Workspace::clientPopupActivated( int id ) diff --git a/utils.cpp b/utils.cpp index 7d4282e053..47c8b8f7f7 100644 --- a/utils.cpp +++ b/utils.cpp @@ -336,24 +336,24 @@ void ShortcutDialog::accept() ; ++i ) { - KKeySequence seq = shortcut().seq( i ); - if( seq.isNull()) + QKeySequence seq = shortcut().seq( i ); + if( seq.isEmpty()) break; - if( seq.key( 0 ) == Qt::Key_Escape ) + if( seq[0] == Qt::Key_Escape ) { reject(); return; } - if( seq.key( 0 ) == Qt::Key_Space ) + if( seq[0] == Qt::Key_Space ) { // clear setShortcut( KShortcut()); KShortcutDialog::accept(); return; } - if( seq.key( 0 ).modFlags() == 0 ) + if( (seq[0] & Qt::KeyboardModifierMask) == 0 ) { // no shortcuts without modifiers KShortcut cut = shortcut(); - cut.setSeq( i, KKeySequence()); + cut.setSeq( i, QKeySequence()); setShortcut( cut ); return; } diff --git a/workspace.cpp b/workspace.cpp index ebc77f7a7e..e7f5722bb0 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -30,6 +30,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +#include #include "plugins.h" #include "client.h" @@ -188,7 +190,7 @@ Workspace::Workspace( bool restore ) 1 ); - client_keys = new KGlobalAccel( this ); + client_keys = new KActionCollection( this ); initShortcuts(); tab_box = new TabBox( this ); popupinfo = new PopupInfo( ); @@ -966,7 +968,7 @@ void Workspace::loadDesktopSettings() for(int i = 1; i <= n; i++) { QString s = group.readEntry(QString("Name_%1").arg(i), - i18n("Desktop %1").arg(i)); + i18n("Desktop %1", i)); rootInfo->setDesktopName( i, s.toUtf8().data() ); desktop_focus_chain[i-1] = i; } @@ -986,7 +988,7 @@ void Workspace::saveDesktopSettings() for(int i = 1; i <= number_of_desktops; i++) { QString s = desktopName( i ); - QString defaultvalue = i18n("Desktop %1").arg(i); + QString defaultvalue = i18n("Desktop %1", i); if ( s.isEmpty() ) { s = defaultvalue; @@ -1910,7 +1912,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) QCursor::setPos( pos ); if ( mouse_emulation_state ) - mouse_emulation_state = sendFakedMouseEvent( pos, mouse_emulation_window, EmuMove, 0, mouse_emulation_state ); + mouse_emulation_state = sendFakedMouseEvent( pos, mouse_emulation_window, EmuMove, 0, mouse_emulation_state ); return true; } @@ -2029,7 +2031,7 @@ void Workspace::createBorderWindows() CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); - XMapWindow(QX11Info::display(), electric_right_border); + XMapWindow(QX11Info::display(), electric_right_border); // Set XdndAware on the windows, so that DND enter events are received (#86998) Atom version = 4; // XDND version XChangeProperty( QX11Info::display(), electric_top_border, atoms->xdnd_aware, XA_ATOM, @@ -2342,27 +2344,29 @@ void Workspace::helperDialog( const QString& message, const Client* c ) QString type; if( message == "noborderaltf3" ) { - QString shortcut = QString( "%1 (%2)" ).arg( keys->label( "Window Operations Menu" )) - .arg( keys->shortcut( "Window Operations Menu" ).seq( 0 ).toString()); + KAction* action = keys->action( "Window Operations Menu" ); + QString shortcut = QString( "%1 (%2)" ).arg( action->text() ) + .arg( action->shortcut().seq( 0 ).toString()); args << "--msgbox" << i18n( "You have selected to show a window without its border.\n" "Without the border, you will not be able to enable the border " "again using the mouse: use the window operations menu instead, " - "activated using the %1 keyboard shortcut." ) - .arg( shortcut ); + "activated using the %1 keyboard shortcut." , + shortcut ); type = "altf3warning"; } else if( message == "fullscreenaltf3" ) { - QString shortcut = QString( "%1 (%2)" ).arg( keys->label( "Window Operations Menu" )) - .arg( keys->shortcut( "Window Operations Menu" ).seq( 0 ).toString()); + KAction* action = keys->action( "Window Operations Menu" ); + QString shortcut = QString( "%1 (%2)" ).arg( action->text() ) + .arg( action->shortcut().seq( 0 ).toString()); args << "--msgbox" << i18n( "You have selected to show a window in fullscreen mode.\n" "If the application itself does not have an option to turn the fullscreen " "mode off you will not be able to disable it " "again using the mouse: use the window operations menu instead, " - "activated using the %1 keyboard shortcut." ) - .arg( shortcut ); + "activated using the %1 keyboard shortcut." , + shortcut ); type = "altf3warning"; } else diff --git a/workspace.h b/workspace.h index 6d1f555c7d..636e8dd743 100644 --- a/workspace.h +++ b/workspace.h @@ -28,7 +28,7 @@ License. See the file "COPYING" for the exact licensing terms. class QMenu; class KConfig; -class KGlobalAccel; +class KActionCollection; class KShortcutDialog; class KStartupInfo; class KStartupInfoId; @@ -450,7 +450,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine enum MouseEmulation { EmuPress, EmuRelease, EmuMove }; unsigned int sendFakedMouseEvent( QPoint pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state - void tabBoxKeyPress( const KKeyNative& keyX ); + void tabBoxKeyPress( int key ); void tabBoxKeyRelease( const XKeyEvent& ev ); // electric borders @@ -545,11 +545,11 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine QMenu *desk_popup; int desk_popup_index; - KGlobalAccel *keys; - KGlobalAccel *client_keys; + KActionCollection *keys; + KActionCollection *client_keys; ShortcutDialog* client_keys_dialog; Client* client_keys_client; - KGlobalAccel *disable_shortcuts_keys; + KActionCollection *disable_shortcuts_keys; bool global_shortcuts_disabled; bool global_shortcuts_disabled_for_client;