summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sessionmanager.cpp12
-rw-r--r--src/tabwindow/tabbar.cpp26
-rw-r--r--src/tabwindow/tabwindow.cpp29
3 files changed, 53 insertions, 14 deletions
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index adc6fcb3..5c93e2d0 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -34,7 +34,10 @@
#include "application.h"
#include "autosaver.h"
#include "tabhistory.h"
+
#include "tabwindow.h"
+#include "tabbar.h"
+
#include "webwindow.h"
#include "webpage.h"
@@ -97,6 +100,11 @@ int loadTabs(TabWindow *tw, QDomElement & window, bool useFirstTab)
{
tw->loadUrl(u, Rekonq::NewTab, &tabHistory);
}
+
+ if (tab.hasAttribute("pinned"))
+ {
+ tw->tabBar()->setTabData(tabNo, true);
+ }
}
return currentTab;
@@ -184,6 +192,10 @@ void SessionManager::save()
{
tab.setAttribute("currentTab", 1);
}
+ if (w.data()->tabBar()->tabData(tabNo).toBool()) // pinned tab info
+ {
+ tab.setAttribute("pinned", 1);
+ }
QByteArray history;
QDataStream historyStream(&history, QIODevice::ReadWrite);
historyStream << *(w.data()->webWindow(tabNo)->page()->history());
diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp
index f5f3215f..7e493fec 100644
--- a/src/tabwindow/tabbar.cpp
+++ b/src/tabwindow/tabbar.cpp
@@ -42,6 +42,7 @@
#include <KMenu>
#include <KUrl>
+#include <QLabel>
#include <QPropertyAnimation>
#include <QSignalMapper>
#include <QStyleOptionFrameV3>
@@ -509,7 +510,18 @@ void TabBar::pinTab()
tabButton(index, QTabBar::RightSide)->hide();
setTabText(index, QString());
- setTabIcon(index, IconManager::self()->iconForUrl(w->webWindow(index)->url()));
+
+ // workaround: "fix" the icon
+ QLabel *label = qobject_cast<QLabel* >(tabButton(index, QTabBar::LeftSide));
+ if (!label)
+ label = new QLabel(this);
+
+ setTabButton(index, QTabBar::LeftSide, 0);
+ setTabButton(index, QTabBar::LeftSide, label);
+
+ KIcon ic = IconManager::self()->iconForUrl(w->webWindow(index)->url());
+ label->setPixmap(ic.pixmap(16, 16));
+
}
@@ -541,5 +553,15 @@ void TabBar::unpinTab()
tabButton(index, QTabBar::RightSide)->show();
setTabText(index, w->webWindow(index)->title());
- setTabIcon(index, IconManager::self()->iconForUrl(w->webWindow(index)->url()));
+
+ // workaround: "fix" the icon
+ QLabel *label = qobject_cast<QLabel* >(tabButton(index, QTabBar::LeftSide));
+ if (!label)
+ label = new QLabel(this);
+
+ setTabButton(index, QTabBar::LeftSide, 0);
+ setTabButton(index, QTabBar::LeftSide, label);
+
+ KIcon ic = IconManager::self()->iconForUrl(w->webWindow(index)->url());
+ label->setPixmap(ic.pixmap(16, 16));
}
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 36b2caec..55d680b5 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -262,7 +262,7 @@ void TabWindow::tabTitleChanged(const QString &title)
tabTitle.replace('&', "&&");
int index = indexOf(tab);
- if (-1 != index)
+ if (-1 != index && !tabBar()->tabData(index).toBool())
{
setTabText(index, tabTitle);
}
@@ -305,10 +305,12 @@ void TabWindow::tabLoadStarted()
label->setMovie(movie);
movie->start();
}
+
tabBar()->setTabButton(index, QTabBar::LeftSide, 0);
tabBar()->setTabButton(index, QTabBar::LeftSide, label);
- tabBar()->setTabText(index, i18n("Loading..."));
+ if (!tabBar()->tabData(index).toBool())
+ tabBar()->setTabText(index, i18n("Loading..."));
}
}
@@ -323,19 +325,22 @@ void TabWindow::tabLoadFinished(bool ok)
int index = indexOf(tab);
- if (-1 != index)
- {
- QLabel *label = qobject_cast<QLabel* >(tabBar()->tabButton(index, QTabBar::LeftSide));
+ if (-1 == index)
+ return;
- QMovie *movie = label->movie();
- movie->stop();
- delete movie;
+ QLabel *label = qobject_cast<QLabel* >(tabBar()->tabButton(index, QTabBar::LeftSide));
- label->setMovie(0);
+ QMovie *movie = label->movie();
+ movie->stop();
+ delete movie;
- KIcon ic = IconManager::self()->iconForUrl(tab->url());
- label->setPixmap(ic.pixmap(16, 16));
- }
+ label->setMovie(0);
+
+ KIcon ic = IconManager::self()->iconForUrl(tab->url());
+ label->setPixmap(ic.pixmap(16, 16));
+
+ if (!tabBar()->tabData(index).toBool())
+ setTabText(index, tab->title());
}