summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp26
-rw-r--r--src/bookmarks.cpp2
-rw-r--r--src/homepage.cpp35
-rw-r--r--src/homepage.h3
-rw-r--r--src/main.cpp2
-rw-r--r--src/mainview.cpp9
-rw-r--r--src/mainview.h3
-rw-r--r--src/mainwindow.cpp10
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings_general.ui10
-rw-r--r--src/tabbar.cpp57
-rw-r--r--src/urlbar.cpp6
-rw-r--r--src/webpage.cpp10
13 files changed, 131 insertions, 45 deletions
diff --git a/src/application.cpp b/src/application.cpp
index e3c06a5b..6719d456 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -87,6 +87,16 @@ int Application::newInstance()
{
KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+
+ // we share one process for several mainwindows,
+ // so initialize only once
+ static bool first = true;
+
+ if (first)
+ {
+ QTimer::singleShot(0, this, SLOT(postLaunch()));
+ first = false;
+ }
// is your app session restored? restore session...
// this mechanism also falls back to load usual plain rekonq
@@ -151,6 +161,10 @@ void Application::postLaunch()
Application::historyManager();
Application::sessionManager();
+
+ // bookmarks loading
+ connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
+ Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
}
@@ -229,9 +243,16 @@ SessionManager *Application::sessionManager()
KIcon Application::icon(const KUrl &url)
{
+ if(url.scheme() == "rekonq" ||
+ (url.isEmpty() // Urlbar is empty for homepage, but we want an icon
+ && !Application::instance()->mainWindowList().isEmpty() // avoid infinite loop at startup
+ && Application::instance()->mainWindow()->currentTab()->url().scheme() == "rekonq")
+ )
+ return KIcon("go-home");
+
if(url.isEmpty())
return KIcon("text-html");
-
+
KIcon icon = KIcon(QWebSettings::iconForUrl(url));
if (icon.isNull())
{
@@ -393,7 +414,6 @@ MainWindow *Application::newMainWindow()
m_mainWindows.prepend(w);
w->show();
- QTimer::singleShot(0, this, SLOT(postLaunch()));
return w;
}
@@ -413,7 +433,7 @@ MainWindowList Application::mainWindowList()
bool Application::homePage(const KUrl &url)
{
- if ( url == KUrl("rekonq:lastSites")
+ if ( url == KUrl("rekonq:closedTabs")
|| url == KUrl("rekonq:history")
|| url == KUrl("rekonq:bookmarks")
|| url == KUrl("rekonq:favorites")
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index c08784e9..815b2f56 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -219,7 +219,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
if (toolBarGroup.isNull())
return;
- m_bookmarkToolBar->clear();
+ m_bookmarkToolBar->clear(); // FIXME CRASH
KBookmark bookmark = toolBarGroup.first();
while (!bookmark.isNull())
diff --git a/src/homepage.cpp b/src/homepage.cpp
index 3cc908a9..398308be 100644
--- a/src/homepage.cpp
+++ b/src/homepage.cpp
@@ -75,9 +75,9 @@ QString HomePage::rekonqHomePage(const KUrl &url)
QString menu = homePageMenu(url);
QString speed;
- if(url == KUrl("rekonq:lastSites"))
+ if(url == KUrl("rekonq:closedTabs"))
{
- speed = lastVisitedSites();
+ speed = fillRecentlyClosedTabs();
}
if(url == KUrl("rekonq:history"))
{
@@ -182,11 +182,11 @@ QString HomePage::homePageMenu(KUrl currentUrl)
menu += "Favorites</a></div>";
menu += "<div class=\"link";
- if(currentUrl == "rekonq:lastSites")
+ if(currentUrl == "rekonq:closedTabs")
menu += " current";
- menu += "\"><a href=\"rekonq:lastSites\">";
+ menu += "\"><a href=\"rekonq:closedTabs\">";
menu += "<img src=\"file:///" + loader->iconPath("edit-undo", KIconLoader::Desktop) + "\" />";
- menu += "Last Visited</a></div>";
+ menu += "Closed Tabs</a></div>";
menu += "<div class=\"link";
if(currentUrl == "rekonq:bookmarks")
@@ -284,3 +284,28 @@ QString HomePage::createBookItem(const KBookmark &bookmark)
books += "<a href=\"" + bookmark.url().prettyUrl() + "\">" + bookmark.text() + "</a><br />";
return books;
}
+
+
+QString HomePage::fillRecentlyClosedTabs()
+{
+ KUrl::List links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs();
+ QString closed;
+
+ Q_FOREACH( const KUrl &url, links)
+ {
+ QString text = url.prettyUrl();
+ if(text.length() > 20)
+ {
+ text.truncate(17);
+ text += "...";
+ }
+ closed += "<div class=\"thumbnail\">";
+ closed += "<object type=\"application/image-preview\" data=\"";
+ closed += url.path() + "\" width=\"200\">";
+ closed += "</object>";
+ closed += "<br />";
+ closed += "<a href=\"" + url.path() + "\">" + text + "</a></div>";
+ }
+
+ return closed;
+}
diff --git a/src/homepage.h b/src/homepage.h
index 73bb5859..7d62f50a 100644
--- a/src/homepage.h
+++ b/src/homepage.h
@@ -55,7 +55,8 @@ private:
QString lastVisitedSites();
QString fillHistory();
QString fillBookmarks();
-
+ QString fillRecentlyClosedTabs();
+
QString createBookItem(const KBookmark &bookmark);
QString m_homePagePath;
diff --git a/src/main.cpp b/src/main.cpp
index e7f3cc1d..a8fb4178 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -38,7 +38,7 @@ static const char description[] =
I18N_NOOP("A lightweight Web Browser for KDE based on WebKit");
-static const char version[] = "0.2.64";
+static const char version[] = "0.2.65";
int main(int argc, char **argv)
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 0abf6996..3c78a0f6 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -179,6 +179,8 @@ void MainView::clear()
// What exactly do we need to clear here?
m_urlBar->clearHistory();
m_urlBar->clear();
+
+ m_recentlyClosedTabs.clear();
}
@@ -411,6 +413,7 @@ void MainView::slotCloseTab(int index)
return;
}
hasFocus = tab->hasFocus();
+ m_recentlyClosedTabs.prepend(tab->url());
}
QWidget *webView = widget(index);
@@ -569,3 +572,9 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
m_tabBar->setTabButton(index, QTabBar::LeftSide, label);
return label;
}
+
+
+KUrl::List MainView::recentlyClosedTabs()
+{
+ return m_recentlyClosedTabs;
+}
diff --git a/src/mainview.h b/src/mainview.h
index 48e0b58b..96710919 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -89,6 +89,7 @@ public:
*/
WebView *newWebView(bool focused = true, bool nearParent = false);
+ KUrl::List recentlyClosedTabs();
signals:
// tab widget signals
@@ -155,6 +156,8 @@ private:
QString m_loadingGitPath;
int m_currentTabIndex;
+
+ KUrl::List m_recentlyClosedTabs;
};
#endif // MAINVIEW_H
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ac9b83bb..7601e80e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -95,8 +95,8 @@ MainWindow::MainWindow()
, m_findBar(new FindBar(this))
, m_sidePanel(0)
, m_historyBackMenu(0)
- , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true) )
- , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, true, true) )
+ , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, false, false) )
+ , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, false) )
, m_ac( new KActionCollection(this) )
{
// enable window size "auto-save"
@@ -204,10 +204,6 @@ void MainWindow::postLaunch()
// Find Bar signal
connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &)));
- // bookmarks loading
- connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
- Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
-
// setting up toolbars to NOT have context menu enabled
setContextMenuPolicy(Qt::DefaultContextMenu);
@@ -363,7 +359,7 @@ void MainWindow::setupActions()
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this);
- bmMenu->setIcon(KIcon("rating"));
+ bmMenu->setIcon(KIcon("bookmarks-organize"));
bmMenu->setDelayed(false);
actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu);
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 0bffa53d..0a63922f 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -44,6 +44,9 @@
<entry name="openTabsNearCurrent" type="Bool">
<default>false</default>
</entry>
+ <entry name="alwaysShowTabPreviews" type="Bool">
+ <default>true</default>
+ </entry>
</group>
<!-- Fonts Settings -->
diff --git a/src/settings_general.ui b/src/settings_general.ui
index d12d254f..5ea19b09 100644
--- a/src/settings_general.ui
+++ b/src/settings_general.ui
@@ -139,6 +139,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_alwaysShowTabPreviews">
+ <property name="text">
+ <string>Show preview when hovering tab</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 815a153d..569a59c5 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -32,6 +32,7 @@
#include "tabbar.moc"
// Local Includes
+#include "rekonq.h"
#include "application.h"
#include "mainwindow.h"
#include "urlbar.h"
@@ -265,47 +266,53 @@ void TabBar::showTabPreview(int tab)
void TabBar::mouseMoveEvent(QMouseEvent *event)
{
- //Find the tab under the mouse
- int i = 0;
- int tab = -1;
- while (i<count() && tab==-1)
+ if (ReKonfig::alwaysShowTabPreviews())
{
- if (tabRect(i).contains(event->pos()))
+ //Find the tab under the mouse
+ int i = 0;
+ int tab = -1;
+ while (i<count() && tab==-1)
{
- tab = i;
+ if (tabRect(i).contains(event->pos()))
+ {
+ tab = i;
+ }
+ i++;
}
- i++;
- }
- //if found and not the current tab then show tab preview
- if (tab != -1 && tab != currentIndex() && m_currentTabPreview != tab)
- {
- showTabPreview(tab);
- m_currentTabPreview = tab;
- }
+ //if found and not the current tab then show tab preview
+ if (tab != -1 && tab != currentIndex() && m_currentTabPreview != tab)
+ {
+ showTabPreview(tab);
+ m_currentTabPreview = tab;
+ }
- //if current tab or not found then hide previous tab preview
- if (tab==currentIndex() || tab==-1)
- {
- if ( m_previewPopup)
+ //if current tab or not found then hide previous tab preview
+ if (tab==currentIndex() || tab==-1)
{
- m_previewPopup->hide();
+ if ( m_previewPopup)
+ {
+ m_previewPopup->hide();
+ }
+ m_currentTabPreview = -1;
}
- m_currentTabPreview = -1;
}
-
+
KTabBar::mouseMoveEvent(event);
}
void TabBar::leaveEvent(QEvent *event)
{
- //if leave tabwidget then hide previous tab preview
- if ( m_previewPopup)
+ if (ReKonfig::alwaysShowTabPreviews())
{
- m_previewPopup->hide();
+ //if leave tabwidget then hide previous tab preview
+ if ( m_previewPopup)
+ {
+ m_previewPopup->hide();
+ }
+ m_currentTabPreview = -1;
}
- m_currentTabPreview = -1;
KTabBar::leaveEvent(event);
}
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index 5776961b..5ad8314e 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -135,10 +135,12 @@ void UrlBar::setUrl(const QUrl& url)
{
if(url.scheme() == "rekonq")
{
+ m_currentUrl = "";
setFocus();
- return;
}
- m_currentUrl = url;
+ else
+ m_currentUrl = url;
+
slotUpdateUrl();
}
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 59c777d6..2b622847 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -93,6 +93,16 @@ WebPage::~WebPage()
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
+ // advise users on resubmitting data
+ if(type == QWebPage::NavigationTypeFormResubmitted)
+ {
+ int risp = KMessageBox::warningContinueCancel(view(),
+ i18n("Are you sure you want to send your data again?"),
+ i18n("Resend form data") );
+ if(risp == KMessageBox::Cancel)
+ return false;
+ }
+
if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab);