« Return to Thread: navigation bar orientation (patch)

navigation bar orientation (patch)

by Bugzilla from jgoday@gmail.com :: Rate this Message:

Reply to Author | View in Thread

Hi, i attach a patch to automatic change the navigation bar tabs orientation (North or west), depending of the areas in the main window.

Regards.

[kaffeine-tabs-orientation.patch]

Index: src/kaffeine.cpp
===================================================================
--- src/kaffeine.cpp (revision 984709)
+++ src/kaffeine.cpp (working copy)
@@ -182,6 +182,8 @@
  // navigation bar - keep in sync with TabIndex enum!
 
  navigationBar = new KToolBar("navigation_bar", this, Qt::LeftToolBarArea);
+    connect(navigationBar, SIGNAL(orientationChanged(Qt::Orientation)),
+            this, SLOT(navigationBarOrientationChanged(Qt::Orientation)));
 
  tabBar = new KTabBar(navigationBar);
  tabBar->addTab(KIcon("start-here-kde"), i18n("Start"));
@@ -465,6 +467,16 @@
  setCursor(Qt::BlankCursor);
 }
 
+void Kaffeine::navigationBarOrientationChanged(Qt::Orientation orientation)
+{
+    if (orientation == Qt::Horizontal) {
+        tabBar->setShape(KTabBar::RoundedNorth);
+    }
+    else {
+        tabBar->setShape(KTabBar::RoundedWest);
+    }
+}
+
 bool Kaffeine::event(QEvent *event)
 {
  bool retVal = KMainWindow::event(event); // this has to be done before calling setVisible()
@@ -520,4 +532,4 @@
  }
 
  KMainWindow::leaveEvent(event);
-}
+}
\ No newline at end of file
Index: src/kaffeine.h
===================================================================
--- src/kaffeine.h (revision 984709)
+++ src/kaffeine.h (working copy)
@@ -61,6 +61,8 @@
  void activateTab(int tabIndex);
  void hideCursor();
 
+    void navigationBarOrientationChanged(Qt::Orientation orientation);
+
 private:
  enum TabIndex {
  StartTabId = 0,



------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
kaffeine-devel mailing list
kaffeine-devel@...
https://lists.sourceforge.net/lists/listinfo/kaffeine-devel

snapshot66.png (90K) Download Attachment

 « Return to Thread: navigation bar orientation (patch)