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

List:       kde-commits
Subject:    playground/base/nepomuk-kde/annotation/lib/gui
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-05-19 7:53:48
Message-ID: 20100519075348.1B3AAAC8BA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1128390 by trueg:

replaced the virtual method addCustomActions with a custom aboutToShow signal

 M  +4 -7      annotationmenu.cpp  
 M  +11 -6     annotationmenu.h  


--- trunk/playground/base/nepomuk-kde/annotation/lib/gui/annotationmenu.cpp #1128389:1128390
@@ -652,9 +652,12 @@
             addAnnotationActions( q );
         }
 
-        q->addCustomActions( q );
+        emit q->aboutToShow( q, true );
     }
+    else {
+        emit q->aboutToShow( q, false );
 }
+}
 
 
 void Nepomuk::AnnotationMenu::Private::_k_ratingChanged( unsigned int rating )
@@ -927,10 +930,4 @@
     d->clear();
 }
 
-
-void Nepomuk::AnnotationMenu::addCustomActions( KMenu* menu )
-{
-    // do nothing
-}
-
 #include "annotationmenu.moc"
--- trunk/playground/base/nepomuk-kde/annotation/lib/gui/annotationmenu.h #1128389:1128390
@@ -118,14 +118,19 @@
          */
         void resourcesAnnotated();
 
-    protected:
         /**
-         * Add custom actions to the menu.
-         * It is recommended to reimplement this method rather than using
-         * aboutToShow() since AnnotationMenu does already use the latter
-         * internally.
+         * Since AnnotationMenu uses the QMenu::aboutToShow() signal internally
+         * and connection order is not guranteed in Qt it is recommended to use
+         * this signal instead to ensure that added actions are actually inserted
+         * in the wanted position and are not removed by AnnotationMenu after
+         * adding them.
+         *
+         * \param menu A convinience pointer to the AnnotationMenu
+         * \param menuRecreated \p true if the contents of the menu where newly created
+         * for this showing of the menu. This also means that any actions added before
+         * have been removed.
          */
-        virtual void addCustomActions( KMenu* menu );
+        void aboutToShow( Nepomuk::AnnotationMenu* menu, bool menuRecreated = false );
 
     private:
         class Private;
[prev in list] [next in list] [prev in thread] [next in thread] 

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