[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] KLineEdit Context Menu
From:       Leandro Emanuel Lopez <lopezlean () gmail ! com>
Date:       2007-07-18 0:42:31
Message-ID: 200707172142.34637.lopezlean () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,
This patch use setContextMenuPolicy instead of setContextMenuEnabled ( 
deprecated ).

Can I commit? See the attached file.

-- 
Leandro Emanuel López

["klineedit.diff" (text/x-diff)]

Index: widgets/klineedit.cpp
===================================================================
--- widgets/klineedit.cpp	(revision 689092)
+++ widgets/klineedit.cpp	(working copy)
@@ -110,7 +110,6 @@
     bool enableClickMsg:1;
     bool drawClickMsg:1;
 
-    bool bEnableMenu :1; 
     bool possibleTripleClick :1;  // set in mousePressEvent, deleted in \
tripleClickTimeout  
     bool clickInClear:1;
@@ -152,7 +151,7 @@
     d->bgRole = backgroundRole();
 
     // Enable the context menu by default.
-    KLineEdit::setContextMenuEnabled( true );
+    QLineEdit::setContextMenuPolicy( Qt::DefaultContextMenu );
     KCursor::setAutoHideCursor( this, true, true );
     installEventFilter( this );
 
@@ -1064,7 +1063,7 @@
 
 void KLineEdit::contextMenuEvent( QContextMenuEvent *e )
 {
-    if ( !d->bEnableMenu )
+    if ( QLineEdit::contextMenuPolicy() != Qt::DefaultContextMenu )
       return;
     QMenu *popup = createStandardContextMenu();
 
@@ -1557,12 +1556,12 @@
 
 void KLineEdit::setContextMenuEnabled( bool showMenu )
 {
-    d->bEnableMenu = showMenu;
+    showMenu ? QLineEdit::setContextMenuPolicy( Qt::DefaultContextMenu ) : \
QLineEdit::setContextMenuPolicy( Qt::NoContextMenu );  }
 
 bool KLineEdit::isContextMenuEnabled() const
 {
-    return  d->bEnableMenu;
+    return  ( contextMenuPolicy() == Qt::DefaultContextMenu );
 }
 
 void KLineEdit::setPasswordMode(bool b)


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic