[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Wed Nov 9 04:18:15 CET 2005


SVN commit 479070 by staikos:

moveLeft/moveRight fixed
BUG: 115748


 M  +18 -10    kst.cpp  
 M  +3 -2      kst.h  
 M  +10 -0     kstviewwindow.cpp  
 M  +3 -0      kstviewwindow.h  


--- trunk/extragear/graphics/kst/kst/kst.cpp #479069:479070
@@ -2503,9 +2503,9 @@
   if (vw) {
     KTabWidget *tw = tabWidget();
     if (tw) { // should always be true, but who knows how KMdi might change
-      int id = pm->insertItem(i18n("Move &Left"), this, SLOT(moveTabLeft()));
+      int id = pm->insertItem(i18n("Move &Left"), vw, SLOT(moveTabLeft()));
       pm->setItemEnabled(id, tw->indexOf(w) > 0);
-      id = pm->insertItem(i18n("Move &Right"), this, SLOT(moveTabRight()));
+      id = pm->insertItem(i18n("Move &Right"), vw, SLOT(moveTabRight()));
       pm->setItemEnabled(id, tw->indexOf(w) < tw->count() - 1);
     }
     pm->insertItem(i18n("R&ename..."), vw, SLOT(rename()));
@@ -2525,19 +2525,27 @@
 }
 
 
-void KstApp::moveTabLeft() {
+void KstApp::moveTabLeft(KstViewWindow *tab) {
   KTabWidget *tw = tabWidget();
-  int cur = tw->currentPageIndex();
-  tw->moveTab(cur, cur - 1);
-  tw->setCurrentPage(cur - 1);
+  if (tw) {
+    int cur = tw->indexOf(tab);
+    if (cur > 0) {
+      tw->moveTab(cur, cur - 1);
+      tw->showPage(tab);
+    }
+  }
 }
 
 
-void KstApp::moveTabRight() {
+void KstApp::moveTabRight(KstViewWindow *tab) {
   KTabWidget *tw = tabWidget();
-  int cur = tw->currentPageIndex();
-  tw->moveTab(cur, cur + 1);
-  tw->setCurrentPage(cur + 1);
+  if (tw) {
+    int cur = tw->indexOf(tab);
+    if (cur >= 0 && cur < tw->count() - 1) {
+      tw->moveTab(cur, cur + 1);
+      tw->showPage(tab);
+    }
+  }
 }
 
 
--- trunk/extragear/graphics/kst/kst/kst.h #479069:479070
@@ -158,6 +158,9 @@
 
     bool paused() const;
 
+    void moveTabLeft(KstViewWindow*);
+    void moveTabRight(KstViewWindow*);
+
   protected:
     void customEvent(QCustomEvent *e);
 
@@ -218,8 +221,6 @@
     void fixKMdi();
     void showContextMenu(QWidget *w, const QPoint& pos);
     void showContextMenu(const QPoint& pos);
-    void moveTabLeft();
-    void moveTabRight();
 
   public slots:
     void fromEnd();
--- trunk/extragear/graphics/kst/kst/kstviewwindow.cpp #479069:479070
@@ -98,6 +98,16 @@
 }
 
 
+void KstViewWindow::moveTabLeft() {
+  KstApp::inst()->moveTabLeft(this);
+}
+
+
+void KstViewWindow::moveTabRight() {
+  KstApp::inst()->moveTabRight(this);
+}
+
+
 void KstViewWindow::updateActions() {
 }
 
--- trunk/extragear/graphics/kst/kst/kstviewwindow.h #479069:479070
@@ -85,6 +85,9 @@
       file and window*/
     void slotFileClose();
 
+    void moveTabLeft();
+    void moveTabRight();
+
     /** print without querying */
     void immediatePrintToFile(const QString& filename);
     void immediatePrintToEps(const QString& filename, const QSize& size);


More information about the Kst mailing list