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

List:       kde-commits
Subject:    KDE/kdebase/workspace/klipper
From:       Esben Mose Hansen <kde () mosehansen ! dk>
Date:       2010-01-11 9:20:31
Message-ID: 1263201631.375353.27979.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1072864 by esben:

Tighten up handling of m_myClipItem

 M  +9 -6      urlgrabber.cpp  
 M  +1 -2      urlgrabber.h  


--- trunk/KDE/kdebase/workspace/klipper/urlgrabber.cpp #1072863:1072864
@@ -92,7 +92,7 @@
 void URLGrabber::invokeAction( const HistoryItem* item )
 {
     m_myClipItem = item;
-    actionMenu( false );
+    actionMenu( item, false );
 }
 
 
@@ -178,15 +178,17 @@
 void URLGrabber::checkNewData( const HistoryItem* item )
 {
     // kDebug() << "** checking new data: " << clipData;
-    m_myClipItem = item;
-
-    actionMenu( true ); // also creates m_myMatches
+    actionMenu( item, true ); // also creates m_myMatches
 }
 
 
-void URLGrabber::actionMenu( bool automatically_invoked )
+void URLGrabber::actionMenu( const HistoryItem* item, bool automatically_invoked )
 {
-    QString text(m_myClipItem->text());
+    if (!item) {
+      qWarning("Attempt to invoke URLGrabber without an item");
+      return;
+    }
+    QString text(item->text());
     if (m_trimmed) {
         text = text.trimmed();
     }
@@ -245,6 +247,7 @@
         QAction *cancelAction = new QAction(KIcon("dialog-cancel"), i18n("&Cancel"), this);
         connect(cancelAction, SIGNAL(triggered()), m_myMenu, SLOT(hide()));
         m_myMenu->addAction(cancelAction);
+        m_myClipItem = item;
 
         if ( m_myPopupKillTimeout > 0 )
             m_myPopupKillTimer->start( 1000 * m_myPopupKillTimeout );
--- trunk/KDE/kdebase/workspace/klipper/urlgrabber.h #1072863:1072864
@@ -74,7 +74,7 @@
   const ActionList& matchingActions( const QString&, bool automatically_invoked );
   void execute( const ClipAction *action, int commandIdx ) const;
   bool isAvoidedWindow() const;
-  void actionMenu( bool wm_class_check );
+  void actionMenu( const HistoryItem* item, bool automatically_invoked );
   void matchingMimeActions(const QString& clipData);
 
   ActionList m_myActions;
@@ -92,7 +92,6 @@
   History* m_history;
 
 private Q_SLOTS:
-  void slotActionMenu() { actionMenu( true ); }
   void slotItemSelected(QAction *action);
   void slotKillPopupMenu();
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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