summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-10-16 19:36:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commit3e97b8f91c33f6b49a93c59b0bcb267fe47554f9 (patch)
treeb0eff0bf036b4d9c1b98f0efd066b8ea7619b7c1
parentRe-enable the restore on crash message bar :) (diff)
downloadrekonq-3e97b8f91c33f6b49a93c59b0bcb267fe47554f9.tar.xz
Zoom actionis restored, yeah! :D
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/webtab/webtab.cpp44
-rw-r--r--src/webtab/webtab.h8
-rw-r--r--src/webwindow/rekonqui.rc162
-rw-r--r--src/webwindow/webwindow.cpp8
5 files changed, 224 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3ba7c641..5ab64859 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -252,3 +252,6 @@ ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH)
INSTALL( TARGETS rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
INSTALL( TARGETS kdeinit_rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
+
+INSTALL( FILES rekonq.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
+INSTALL( FILES webwindow/rekonqui.rc DESTINATION ${DATA_INSTALL_DIR}/rekonq )
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 549fa285..036f62c0 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -68,6 +68,7 @@ WebTab::WebTab(QWidget *parent)
, m_webView(0)
, m_progress(0)
, m_part(0)
+ , m_zoomFactor(10)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -350,3 +351,46 @@ void WebTab::printFrame()
delete printDialog;
}
}
+
+
+void WebTab::zoomIn()
+{
+ if (m_zoomFactor == 50)
+ {
+ emit infoToShow(i18n("Max zoom reached: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+ return;
+ }
+
+ if (m_zoomFactor >= 20)
+ m_zoomFactor+=5;
+ else
+ m_zoomFactor++;
+
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}
+
+
+void WebTab::zoomOut()
+{
+ if (m_zoomFactor == 1)
+ {
+ emit infoToShow(i18n("Min zoom reached: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+ return;
+ }
+
+ m_zoomFactor--;
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}
+
+
+void WebTab::zoomDefault()
+{
+ m_zoomFactor = 10;
+ m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+
+ emit infoToShow(i18n("Default zoom: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
+}
diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h
index 2773dc12..6a9e844f 100644
--- a/src/webtab/webtab.h
+++ b/src/webtab/webtab.h
@@ -94,12 +94,18 @@ private Q_SLOTS:
void printFrame();
+ void zoomIn();
+ void zoomOut();
+ void zoomDefault();
+
Q_SIGNALS:
void loadProgressing();
void titleChanged(const QString &);
void triggerPartPrint();
+ void infoToShow(QString);
+
private:
WebView *m_webView;
@@ -109,6 +115,8 @@ private:
QWeakPointer<PreviewSelectorBar> m_previewSelectorBar;
KParts::ReadOnlyPart *m_part;
+
+ int m_zoomFactor;
};
#endif
diff --git a/src/webwindow/rekonqui.rc b/src/webwindow/rekonqui.rc
new file mode 100644
index 00000000..ef6294a4
--- /dev/null
+++ b/src/webwindow/rekonqui.rc
@@ -0,0 +1,162 @@
+<?xml version="1.0"?>
+<!DOCTYPE gui SYSTEM "kpartgui.dtd">
+<gui name="rekonq" version="64">
+
+<!--- =========== Rekonq Menu ============= -->
+<Menu name="rekonqMenu" noMerge="1">
+ <Action name="new_tab" />
+ <Action name="new_window" />
+ <Action name="private_browsing" />
+ <Separator/>
+ <Action name="file_open" />
+ <Action name="file_save_as" />
+ <Action name="file_print" />
+ <Action name="edit_find" />
+
+ <Menu name="zoomMenu" icon="zoom-in" noMerge="1">
+ <text>&amp;Zoom</text>
+ <Action name="view_zoom" />
+ <Action name="view_zoom_in" />
+ <Action name="view_zoom_out" />
+ </Menu>
+
+ <Separator/>
+
+ <Menu name="toolsMenu" icon="preferences-other" noMerge="1">
+ <text>&amp;Tools</text>
+ <Action name="clear_private_data" />
+ <Separator/>
+ <Action name="webapp_shortcut" />
+ <Action name="web_inspector" />
+ <Action name="page_source" />
+ <Action name="net_analyzer" />
+ <Action name="set_editable" />
+ <Separator/>
+ <Action name="useragent" />
+ <Action name="sync" />
+ <Action name="adblock" />
+ </Menu>
+
+ <Separator/>
+ <Action name="show_history_panel" />
+ <Action name="show_bookmarks_toolbar" />
+ <Action name="show_bookmarks_panel" />
+ <Action name="fullscreen" />
+ <Separator/>
+
+ <Menu name="help" icon="help-browser">
+ <text>&amp;Help</text>
+ <Action name="help_contents"/>
+ <Action name="help_whats_this"/>
+ <Separator weakSeparator="1"/>
+ <Action name="help_report_bug"/>
+ <Separator weakSeparator="1"/>
+ <Action name="switch_application_language"/>
+ <Separator weakSeparator="1"/>
+ <Action name="help_about_app"/>
+ <Action name="help_about_kde"/>
+ </Menu>
+
+ <Action name="options_configure" />
+</Menu>
+<!--- ====================================== -->
+
+
+<MenuBar>
+ <!-- ============ FILE menu =========== -->
+ <Menu name="file" noMerge="1"><text>&amp;File</text>
+ <Action name="file_open" />
+ <Action name="open_location" />
+ <Separator/>
+ <Action name="new_tab" />
+ <Action name="close_tab" />
+ <Separator/>
+ <Action name="file_save_as" />
+ <Separator/>
+ <Action name="file_print_preview" />
+ <Action name="file_print" />
+ <Separator/>
+ <Action name="file_quit" />
+ </Menu>
+
+ <!-- ============ EDIT menu =========== -->
+ <Menu name="edit" noMerge="1"><text>&amp;Edit</text>
+ <Action name="edit_undo" />
+ <Action name="edit_redo" />
+ <Separator/>
+ <Action name="edit_cut" />
+ <Action name="edit_copy" />
+ <Action name="edit_paste" />
+ <Separator/>
+ <Action name="edit_find" />
+ <Action name="edit_find_next" />
+ <Action name="edit_find_prev" />
+ </Menu>
+
+ <!-- ============ VIEW menu =========== -->
+ <Menu name="view" noMerge="1"><text>&amp;View</text>
+ <Action name="view_redisplay" />
+ <Action name="go_home" />
+ <Separator/>
+ <Action name="bigger_font" />
+ <Action name="normal_font" />
+ <Action name="smaller_font" />
+ <Separator/>
+ <Action name="page_source" />
+ </Menu>
+
+ <!-- ============ GO menu =========== -->
+ <Menu name="go" deleted="true">
+ </Menu>
+
+ <!-- ============ HISTORY menu =========== -->
+ <Action name="history" ><text>Hi&amp;story</text>
+ </Action>
+
+ <!-- ============ BOOKMARKS menu =========== -->
+ <Action name="bookmarksActionMenu" ><text>&amp;Bookmarks</text>
+ </Action>
+
+ <!-- ============ TOOLS menu =========== -->
+ <Menu name="tools" noMerge="1"><text>&amp;Tools</text>
+ <Action name="web_inspector" />
+ <Action name="private_browsing" />
+ <Action name="clear_private_data" />
+ <Action name="page_source" />
+ <Action name="net_analyzer" />
+ <Action name="set_editable" />
+ <Separator/>
+ <Action name="useragent" />
+ <Action name="adblock" />
+ </Menu>
+
+ <!-- ============ SETTINGS menu =========== -->
+ <Menu name="settings" noMerge="1"><text>&amp;Settings</text>
+ <Action name="options_show_menubar" />
+ <Merge name="StandardToolBarMenuHandler" />
+ <Merge/>
+ <Separator/>
+ <Action name="fullscreen" />
+ <Separator/>
+ <Action name="options_configure_keybinding" />
+ <Action name="options_configure_toolbars" />
+ <Action name="options_configure" />
+ </Menu>
+</MenuBar>
+
+<!-- ============ Main ToolBar =========== -->
+<ToolBar name="mainToolBar" position="top" iconText="iconOnly" newline="true" noMerge="1">
+<text>Main Toolbar</text>
+ <Action name="go_back" />
+ <Action name="go_forward" />
+ <Action name="url_bar" />
+ <Action name="load_stop_reload" />
+ <Action name="rekonq_tools" />
+</ToolBar>
+
+<!-- ============ Bookmarks ToolBar =========== -->
+<ToolBar noEdit="true" iconText="icontextright" fullWidth="true" name="bookmarkToolBar" iconSize="16" newline="true">
+ <text>Bookmark Toolbar</text>
+</ToolBar>
+
+</gui>
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 0c635800..adca789e 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -140,7 +140,8 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
m_popup->hide();
connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide()));
connect(_tab->page(), SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(notifyMessage(QString)));
-
+ connect(_tab, SIGNAL(infoToShow(QString)), this, SLOT(notifyMessage(QString)));
+
updateHistoryActions();
}
@@ -257,6 +258,11 @@ void WebWindow::setupActions()
actionCollection()->addAction(QL1S("clear_private_data"), a);
connect(a, SIGNAL(triggered(bool)), rApp, SLOT(clearPrivateData()));
+ // Zoom ==============
+ KStandardAction::zoomIn(_tab, SLOT(zoomIn()), actionCollection());
+ KStandardAction::zoomOut(_tab, SLOT(zoomOut()), actionCollection());
+ KStandardAction::zoom(_tab, SLOT(zoomDefault()), actionCollection());
+
// Bookmark ==========
a = KStandardAction::addBookmark(_bar, SLOT(manageBookmarks()), actionCollection());
KShortcut bkShortcut(Qt::CTRL + Qt::Key_D);