summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--src/mainview.cpp32
-rw-r--r--src/mainview.h15
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings_general.ui234
-rw-r--r--src/tabbar.cpp2
-rw-r--r--src/tabbar.h16
7 files changed, 195 insertions, 109 deletions
diff --git a/TODO b/TODO
index 38e2bb7e..fef8bd98 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
To 0.0.5
- definitely fix fonts!
- fix crash on example sites..
-- tabbar: fixed dimension
+DONE tabbar: fixed dimension
- tabbar: hide if just one
- bookmarks update
- improve "save as"
diff --git a/src/mainview.cpp b/src/mainview.cpp
index d7e07e14..407db6fe 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -23,6 +23,9 @@
#include "mainview.h"
#include "mainview.moc"
+// Auto Includes
+#include "rekonq.h"
+
// Local Includes
#include "tabbar.h"
#include "application.h"
@@ -86,6 +89,26 @@ MainView::~MainView()
}
+void MainView::viewTabBar()
+{
+ bool always = ReKonfig::alwaysShowTabBar();
+ if(always == true)
+ return;
+
+ if( m_tabBar->count() == 1 )
+ {
+ m_tabBar->hide();
+ }
+ else
+ {
+ if( m_tabBar->isHidden() )
+ {
+ m_tabBar->show();
+ }
+ }
+}
+
+
KAction *MainView::recentlyClosedTabsAction() const
{
return m_recentlyClosedTabsAction;
@@ -367,6 +390,9 @@ WebView *MainView::newTab(bool makeCurrent)
if (count() == 1)
currentChanged(currentIndex());
emit tabsChanged();
+
+ viewTabBar();
+
return webView;
}
@@ -420,6 +446,8 @@ void MainView::closeOtherTabs(int index)
closeTab(i);
for (int i = index - 1; i >= 0; --i)
closeTab(i);
+
+ viewTabBar();
}
@@ -432,6 +460,8 @@ void MainView::cloneTab(int index)
return;
WebView *tab = newTab(false);
tab->setUrl( webView(index)->url() );
+
+ viewTabBar();
}
@@ -474,6 +504,8 @@ void MainView::closeTab(int index)
currentWebView()->setFocus();
if (count() == 0)
emit lastTabClosed();
+
+ viewTabBar();
}
diff --git a/src/mainview.h b/src/mainview.h
index 05a9bb16..94b93c37 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -22,11 +22,9 @@
#ifndef TABWIDGET_H
#define TABWIDGET_H
-
// KDE Includes
#include <KTabWidget>
-
// Forward Declarations
class WebView;
class TabBar;
@@ -41,12 +39,15 @@ class QStackedWidget;
class QLineEdit;
class QUrl;
+
/**
* TabWidget that contains WebViews and a stack widget of associated line edits.
*
* Connects up the current tab's signals to this class's signal and uses WebActionMapper
* to proxy the actions.
+ *
*/
+
class MainView : public KTabWidget
{
Q_OBJECT
@@ -126,6 +127,14 @@ private slots:
void moveTab(int fromIndex, int toIndex);
private:
+
+ /**
+ * show and hide TabBar if user doesn't choose
+ * "Always Show TabBar" option
+ *
+ */
+ void viewTabBar();
+
KAction *m_recentlyClosedTabsAction;
KMenu *m_recentlyClosedTabsMenu;
@@ -137,5 +146,5 @@ private:
TabBar *m_tabBar;
};
-#endif // TABWIDGET_H
+#endif
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index a1b6ca4c..f60d6e86 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -20,6 +20,9 @@
<entry name="expireHistory" type="Int">
<default>1</default>
</entry>
+ <entry name="alwaysShowTabBar" type="Bool">
+ <default>true</default>
+ </entry>
</group>
<!-- Fonts Settings -->
diff --git a/src/settings_general.ui b/src/settings_general.ui
index b155ed56..9b963f89 100644
--- a/src/settings_general.ui
+++ b/src/settings_general.ui
@@ -1,121 +1,151 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>general</class>
- <widget class="QWidget" name="general" >
- <property name="geometry" >
+ <widget class="QWidget" name="general">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>500</width>
- <height>209</height>
+ <width>392</width>
+ <height>269</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>General</string>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Home:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2" >
- <widget class="KLineEdit" name="kcfg_homePage" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>HomePage</string>
</property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Home:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KLineEdit" name="kcfg_homePage">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="setHomeToCurrentPageButton">
+ <property name="text">
+ <string>Set to current page</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="setHomeToCurrentPageButton" >
- <property name="text" >
- <string>Set to current page</string>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>misc</string>
</property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Remove history items:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="kcfg_expireHistory">
+ <item>
+ <property name="text">
+ <string>After one day</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>After one week</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>After two weeks</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>After one month</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>After one year</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Manually</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Save downloads to:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KUrlRequester" name="downloadDirUrlRequester"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="kcfg_alwaysShowTabBar">
+ <property name="text">
+ <string>Always show TabBar</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
- <item row="1" column="2" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>233</width>
- <height>25</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Remove history items:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="QComboBox" name="kcfg_expireHistory" >
- <item>
- <property name="text" >
- <string>After one day</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one week</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After two weeks</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one month</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>After one year</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Manually</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_7" >
- <property name="text" >
- <string>Save downloads to:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="KUrlRequester" name="downloadDirUrlRequester" />
- </item>
- <item row="4" column="1" colspan="2" >
- <spacer name="spacer" >
- <property name="orientation" >
+ <item>
+ <spacer name="spacer">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>384</width>
<height>36</height>
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index ac18d7e8..0b8bdf63 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -66,7 +66,7 @@ QSize TabBar::tabSizeHint (int index) const
{
Q_UNUSED(index);
QSize s = m_parent->sizeHint();
- int w = s.width() / 5;
+ int w = s.width() / 4;
int h = s.height() / 20;
QSize ts = QSize(w,h);
diff --git a/src/tabbar.h b/src/tabbar.h
index 8b670def..7cdc9afd 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -30,8 +30,11 @@
#include <QShortcut>
/**
- * Tab bar with a few more features such as a context menu and shortcuts
+ * Tab bar with a few more features such as
+ * a context menu and shortcuts
+ *
*/
+
class TabBar : public KTabBar
{
Q_OBJECT
@@ -56,6 +59,10 @@ protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
+ /**
+ * Added to fix tab dimension
+ *
+ */
virtual QSize tabSizeHint (int index) const;
private slots:
@@ -67,13 +74,18 @@ private slots:
void contextMenuRequested(const QPoint &position);
private:
+
QList<QShortcut*> m_tabShortcuts;
friend class MainView;
QWidget *m_parent;
QPoint m_dragStartPos;
int m_dragCurrentIndex;
- int m_actualIndex; // the index in which we are seeing a Context menu
+
+ /**
+ * the index in which we are seeing a Context menu
+ */
+ int m_actualIndex;
};
#endif