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

List:       kde-commits
Subject:    kdelibs/kio/misc
From:       Laurent Montel <montel () kde ! org>
Date:       2003-10-21 10:26:54
[Download RAW message or body]

CVS commit by mlaurent: 

Disable cancel menu when there is not item selected


  M +11 -1     uiserver.cpp   1.102
  M +1 -0      uiserver.h   1.59


--- kdelibs/kio/misc/uiserver.cpp  #1.101:1.102
@@ -654,9 +654,19 @@ void UIServer::slotShowContextMenu(KList
    {
       m_contextMenu=new QPopupMenu(this);
-      m_contextMenu->insertItem(i18n("Cancel Job"), this, SLOT(slotCancelCurrent()));
+      m_idCancelItem = m_contextMenu->insertItem(i18n("Cancel Job"), this, SLOT(slotCancelCurrent()));
 //      m_contextMenu->insertItem(i18n("Toggle Progress"), this, SLOT(slotToggleDefaultProgress()));
       m_contextMenu->insertSeparator();
       m_contextMenu->insertItem(i18n("Settings..."), this, SLOT(slotConfigure()));
    }
+   bool enabled = false;
+   QListViewItemIterator it( listProgress );
+   for ( ; it.current(); ++it ) {
+     if ( it.current()->isSelected() ) {
+       enabled = true;
+       break;
+     }
+   }
+   m_contextMenu->setItemEnabled( m_idCancelItem, enabled);
+   
    m_contextMenu->popup(pos);
 }

--- kdelibs/kio/misc/uiserver.h  #1.58:1.59
@@ -397,4 +397,5 @@ private:
   int m_initWidth;
   int m_initHeight;
+  int m_idCancelItem;
   bool m_bShowList;
   bool m_showStatusBar;


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

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