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

List:       kde-commits
Subject:    kdenetwork/ksirc/KSPrefs
From:       Andrew Stanley-Jones <asj () cban ! com>
Date:       2003-10-04 3:52:45
[Download RAW message or body]

CVS commit by asj: 

Make move up and down work


  M +36 -0     page_rmbmenu.cpp   1.4
  M +2 -0      page_rmbmenu.h   1.4


--- kdenetwork/ksirc/KSPrefs/page_rmbmenu.cpp  #1.3:1.4
@@ -42,4 +42,8 @@ PageRMBMenu::PageRMBMenu( QWidget *paren
     connect(commandLB, SIGNAL(highlighted( int )),
             this, SLOT(highlighted( int )));
+    connect(moveUpPB, SIGNAL(clicked()),
+            this, SLOT(moveDown()));
+    connect(moveDownPB, SIGNAL(clicked()),
+            this, SLOT(moveUp()));
 
 }
@@ -101,4 +105,36 @@ void PageRMBMenu::highlighted(int index)
         moveDownPB->setEnabled(true);
     }
+}
+
+void PageRMBMenu::moveUp()
+{
+    int item = commandLB->currentItem();
+
+    QString txt = commandLB->text(item);
+    commandLB->removeItem(item);
+
+    commandLB->insertItem(txt, item-1);
+    commandLB->setCurrentItem(item-1);
+
+    UserControlMenu *ucm = UserControlMenu::UserMenu.take(item);
+    UserControlMenu::UserMenu.insert(item-1,ucm);
+
+    highlighted(item-1);
+}
+
+void PageRMBMenu::moveDown()
+{
+    int item = commandLB->currentItem();
+
+    QString txt = commandLB->text(item);
+    commandLB->removeItem(item);
+
+    commandLB->insertItem(txt, item+1);
+    commandLB->setCurrentItem(item+1);
+
+    UserControlMenu *ucm = UserControlMenu::UserMenu.take(item);
+    UserControlMenu::UserMenu.insert(item+1,ucm);
+
+    highlighted(item+1);
 }
 

--- kdenetwork/ksirc/KSPrefs/page_rmbmenu.h  #1.3:1.4
@@ -27,4 +27,6 @@ public:
 protected slots:
   void highlighted(int);
+  void moveUp();
+  void moveDown();
 };
 


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

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